[java]
public static boolean isApplicationSentToBackground(final Context context) {
ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
List<RunningTaskInfo> tasks = am.getRunningTasks(1);
if (!tasks.isEmpty()) {
ComponentName topActivity = tasks.get(0).topActivity;
if (!topActivity.getPackageName().equals(context.getPackageName())) {
return true;
}
}
return false;
}
[/java]
Monday, October 22, 2012
Sunday, October 21, 2012
How to prevent a scrollview from scrolling to a webview after data is loaded?
You should create new class extend ScrollView, then Override requestChildFocus:
Then in your xml layout, using:
The ScrollView will not auto scroll to the WebView anymore.
Solution taken from :
http://stackoverflow.com/questions/9842494/how-to-prevent-a-scrollview-from-scrolling-to-a-webview-after-data-is-loaded
public class MyScrollView extends ScrollView {
@Override
public void requestChildFocus(View child, View focused) {
if (focused instanceof WebView )
return;
super.requestChildFocus(child, focused);
}
}
Then in your xml layout, using:
<MyScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/background" >
The ScrollView will not auto scroll to the WebView anymore.
Solution taken from :
http://stackoverflow.com/questions/9842494/how-to-prevent-a-scrollview-from-scrolling-to-a-webview-after-data-is-loaded
webview showing white bar on right side
Use the following to hide but not remove the functionality of the scrollbar. The layout margin adjustment is a nasty work-around.
Solution from:
http://stackoverflow.com/questions/2279978/webview-showing-white-bar-on-right-side
//webview being your WebView object reference.
webview.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
Solution from:
http://stackoverflow.com/questions/2279978/webview-showing-white-bar-on-right-side
Subscribe to:
Posts (Atom)