public static boolean executeCommand(){
System.out.println("executeCommand");
Runtime runtime;
runtime = Runtime.getRuntime();
try
{
Process mIpAddrProcess = runtime.exec("/system/bin/ping -c 1 8.8.8.8");
int mExitValue = mIpAddrProcess.waitFor();
System.out.println(" mExitValue "+mExitValue);
if(mExitValue==0)
{
return true;
}
else
{
return false;
}
}
catch (InterruptedException ignore)
{
ignore.printStackTrace();
System.out.println
(" Exception:"+ignore);
}
catch (IOException ex)
{
ex.printStackTrace();
System.out.println(" Exception:"+ex);
}
return false;}
Tuesday, 29 September 2015
How to Ping External IP from Java Android
Wednesday, 16 September 2015
TextView Marquee not working
<TextView
//id
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:paddingLeft="10dp"
android:gravity="center_vertical"
android:textSize="12dp"
android:singleLine="true"
android:ellipsize="marquee"
android:marqueeRepeatLimit="marquee_forever"
android:scrollHorizontally="true"
/>
//id
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:paddingLeft="10dp"
android:gravity="center_vertical"
android:textSize="12dp"
android:singleLine="true"
android:ellipsize="marquee"
android:marqueeRepeatLimit="marquee_forever"
android:scrollHorizontally="true"
/>
Subscribe to:
Posts (Atom)