private void
findAndroid() {
	String re1 = "^\\d+(\\.\\d+){3}$";
	String re2 = "^[0-9a-f]+(:[0-9a-f]*)+:[0-9a-f]+$";
	try { 
		ArrayList maybe = new ArrayList(); 
		String line; 
		Process p = Runtime.getRuntime().exec("getprop"); 
		InputStream in = p.getInputStream();
		InputStreamReader isr = new InputStreamReader(in);
		BufferedReader br = new BufferedReader(isr);
		while ((line = br.readLine()) != null ) { 
			StringTokenizer t = new StringTokenizer( line, ":" );
			String name = t.nextToken();
			if (name.indexOf( ".dns" ) > -1) {
				String v = t.nextToken();
				v = v.replaceAll( "[ \\[\\]]", "" );
				if ((v.matches(re1) || v.matches(re2)) &&
				    !maybe.contains(v))
					maybe.add(v);
			}
		}
		configureFromLists(maybe, null);
	} catch ( Exception e ) { 
		// ignore resolutely
	}
}
private void findAndroid ( ) { String re1 = "^\\d+(\\.\\d+){3}$" ; String re2 = "^[0-9a-f]+(:[0-9a-f]*)+:[0-9a-f]+$" ; try { ArrayList maybe = new ArrayList ( ) ; String line ; Process p = Runtime . getRuntime ( ) . exec ( "getprop" ) ; InputStream in = p . getInputStream ( ) ; InputStreamReader isr = new InputStreamReader ( in ) ; BufferedReader br = new BufferedReader ( isr ) ; while ( ( line = br . readLine ( ) ) != null ) { StringTokenizer t = new StringTokenizer ( line , ":" ) ; String name = t . nextToken ( ) ; if ( name . indexOf ( ".dns" ) > - 1 ) { String v = t . nextToken ( ) ; v = v . replaceAll ( "[ \\[\\]]" , "" ) ; if ( ( v . matches ( re1 ) || v . matches ( re2 ) ) && ! maybe . contains ( v ) ) maybe . add ( v ) ; } } configureFromLists ( maybe , null ) ; } catch ( Exception e ) { } }
Parses the output of getprop, which is the only way to get DNS
info on Android. getprop might disappear in future releases, so
this code comes with a use-by date.