¡@

Home 

2014/10/16 ¤W¤È 08:09:27

android Programming Glossary: activity's

How to determine when Fragment becomes visible in ViewPager

http://stackoverflow.com/questions/10024739/how-to-determine-when-fragment-becomes-visible-in-viewpager

Playing HTML5 video on fullscreen in android webview

http://stackoverflow.com/questions/15768837/playing-html5-video-on-fullscreen-in-android-webview

WebChromeClient. @param activityNonVideoView A View in the activity's layout that contains every other view that should be hidden.. full screen. @param activityVideoView A ViewGroup in the activity's layout that will display the video. Typically you would like.. WebChromeClient. @param activityNonVideoView A View in the activity's layout that contains every other view that should be hidden..

Force Screen On

http://stackoverflow.com/questions/2131948/force-screen-on

flag FLAG_KEEP_SCREEN_ON which you can enable on your activity's window in your onCreate like this @Override protected void onCreate..

How to check visibility of software keyboard in Android?

http://stackoverflow.com/questions/2150078/how-to-check-visibility-of-software-keyboard-in-android

custom Layout type a much simpler solution is to give your activity's root view a known ID say '@ id activityRoot' hook a GlobalLayoutListener.. and from there calculate the size diff between your activity's view root and the window size final View activityRootView findViewById..

Detect application heap size in Android

http://stackoverflow.com/questions/2630158/detect-application-heap-size-in-android

1 above maxMemory which can be invoked e.g. in your main activity's onCreate method as follows Runtime rt Runtime.getRuntime long..

On logout, clear Activity history stack, preventing “back” button from opening logged-in-only Activites

http://stackoverflow.com/questions/3007998/on-logout-clear-activity-history-stack-preventing-back-button-from-opening-l

previously opened activities. One option is to have each activity's onCreate check logged in status and finish if not logged in...

How do I pause Flash content in an Android WebView when my activity isn't visible?

http://stackoverflow.com/questions/3431351/how-do-i-pause-flash-content-in-an-android-webview-when-my-activity-isnt-visibl

to get this to work. We call it with onPause in the activity's onPause function and onResume in the activity's onResume function.. in the activity's onPause function and onResume in the activity's onResume function private void callHiddenWebViewMethod String..

Android Launcher label vs. activity title

http://stackoverflow.com/questions/3488664/android-launcher-label-vs-activity-title

takes its label from the mainfest section about the main activity's label as here activity android name MainActivity android label.. here. BUT big BUT this also of course changes this activity's default title And I did not want that to happen there's enough..

Determining the size of an Android view at runtime

http://stackoverflow.com/questions/3779173/determining-the-size-of-an-android-view-at-runtime

methods and inspecting the object in the debugger in my activity's onCreate and in onPostCreate . How can I figure out the exact..

Usage CursorLoader without ContentProvider

http://stackoverflow.com/questions/7182485/usage-cursorloader-without-contentprovider

managing the given Cursor's lifecycle for you based on the activity's lifecycle. That is when the activity is stopped it will automatically..

Android app out of memory issues - tried everything and still at a loss

http://stackoverflow.com/questions/7536988/android-app-out-of-memory-issues-tried-everything-and-still-at-a-loss

in onStop such as calling setContentView to clear out the activity's view hierarchy and clear variables of whatever else it may be..

Android Activity Life Cycle - What are all these methods for?

http://stackoverflow.com/questions/8515936/android-activity-life-cycle-what-are-all-these-methods-for

This method also provides you with a Bundle containing the activity's previously frozen state if there was one. Always followed by.. where the system does not have enough memory to keep your activity's process running after its onPause method is called. onDestroy..

DefaultHttpClient to AndroidHttpClient

http://stackoverflow.com/questions/8706464/defaulthttpclient-to-androidhttpclient

policy Add the above code into your main activity's onCreate method. In addition it is always recommended to move..

difference and when to use getApplication(), getApplicationContext(), getBaseContext() and someClass.this

http://stackoverflow.com/questions/10347184/difference-and-when-to-use-getapplication-getapplicationcontext-getbasecon

attached to a window. Activity context is attached to the Activity's life cycle and can be destroyed if the activity's onDestroy..

How to make application completely ignore screen orientation change in Android?

http://stackoverflow.com/questions/1410504/how-to-make-application-completely-ignore-screen-orientation-change-in-android

desired Activity. Just add the function below to your Activity's class. @Override public void onConfigurationChanged Configuration..

Playing HTML5 video on fullscreen in android webview

http://stackoverflow.com/questions/15768837/playing-html5-video-on-fullscreen-in-android-webview

has been pressed by the user. This must be called from the Activity's onBackPressed and if it returns false the activity itself should.. android layout_height match_parent RelativeLayout Activity's onCreate in which we initialize it private VideoEnabledWebView..

findViewById() returns null for custom component in layout XML, not for other components

http://stackoverflow.com/questions/1691569/findviewbyid-returns-null-for-custom-component-in-layout-xml-not-for-other-co

TextView android id @ id boring some other params In my Activity's onCreate I do this setContentView R.layout.main TextView boring..

Android SplashScreen

http://stackoverflow.com/questions/1979524/android-splashscreen

hide the splash screen once the task is complete. So your Activity's onCreate method would simply create a ProgressDialog and show..

Android: How to get a radiogroup with togglebuttons?

http://stackoverflow.com/questions/2379527/android-how-to-get-a-radiogroup-with-togglebuttons

onClick attribute i.e. a button click will trigger your Activity's onToggle View method. RadioGroup android id @ id toggleGroup..

How to implement a custom AlertDialog View

http://stackoverflow.com/questions/2795300/how-to-implement-a-custom-alertdialog-view

that you're trying to extract the body id from your Activity's layout and that won't work. You probably want something like..

Blur or dim background when Android PopupWindow active

http://stackoverflow.com/questions/3221488/blur-or-dim-background-when-android-popupwindow-active

... ... your activity's content ... FrameLayout Here's the Activity's onCreate method public void onCreate Bundle savedInstanceState..

Rotate View Hierarchy 90 degrees

http://stackoverflow.com/questions/3444764/rotate-view-hierarchy-90-degrees

duration 0 android fillAfter true rotate Then in your Activity's onCreate do @Override public void onCreate Bundle icicle super.onCreate..

Show popup above map marker in MapView

http://stackoverflow.com/questions/3707923/show-popup-above-map-marker-in-mapview

way to do this One idea is to have the LinearLayout in my Activity's root layout and show it when needed. But how to make it move..

Activity restart on rotation Android

http://stackoverflow.com/questions/456211/activity-restart-on-rotation-android

Start by adding the android configChanges node to your Activity's manifest node android configChanges keyboardHidden orientation..

BroadcastReceiver as inner class

http://stackoverflow.com/questions/4854807/broadcastreceiver-as-inner-class

I know the BroadcastReceiver can't be used if defined as Activity's inner class. But I wonder why Is it because the system would..

How to stop youtube video playing in Android webview?

http://stackoverflow.com/questions/5946698/how-to-stop-youtube-video-playing-in-android-webview

need to call the WebView's onPause method from your own Activity's onPause method. The only trick with this is that you cannot.. code should get you started on setting up your own Activity's onPause method @Override public void onPause super.onPause try..

ViewPager and fragments ??what's the right way to store fragment's state?

http://stackoverflow.com/questions/7951730/viewpager-and-fragments-whats-the-right-way-to-store-fragments-state

with my callback interface call for initiating data via Activity's implemented method. But this method points to newly created.. points to newly created fragment which is created via Activity's onCreate method. Issue Maybe I'm using wrong patterns but even..

Best way to manage the ProgressDialog from AsyncTask

http://stackoverflow.com/questions/8295003/best-way-to-manage-the-progressdialog-from-asynctask

consuming task in the background thread once done update Activity's view in UI thread. This is why it is always recommended to use..

Using Application context everywhere?

http://stackoverflow.com/questions/987072/using-application-context-everywhere

your approach is excellent it's good practice to use an Activity's Context within that Activity and the Application Context when..

How to determine when Fragment becomes visible in ViewPager

http://stackoverflow.com/questions/10024739/how-to-determine-when-fragment-becomes-visible-in-viewpager

Playing HTML5 video on fullscreen in android webview

http://stackoverflow.com/questions/15768837/playing-html5-video-on-fullscreen-in-android-webview

public VideoEnabledWebChromeClient Builds a video enabled WebChromeClient. @param activityNonVideoView A View in the activity's layout that contains every other view that should be hidden when the video goes full screen. @param activityVideoView A.. every other view that should be hidden when the video goes full screen. @param activityVideoView A ViewGroup in the activity's layout that will display the video. Typically you would like this to fill the whole layout. @SuppressWarnings unused public.. null this.isVideoFullscreen false Builds a video enabled WebChromeClient. @param activityNonVideoView A View in the activity's layout that contains every other view that should be hidden when the video goes full screen. @param activityVideoView A..

Force Screen On

http://stackoverflow.com/questions/2131948/force-screen-on

thus leave the screen on. It is far far better to use the window flag FLAG_KEEP_SCREEN_ON which you can enable on your activity's window in your onCreate like this @Override protected void onCreate Bundle icicle super.onCreate icicle getWindow .addFlags..

How to check visibility of software keyboard in Android?

http://stackoverflow.com/questions/2150078/how-to-check-visibility-of-software-keyboard-in-android

lurking in the SDK since version 1. Rather than requiring a custom Layout type a much simpler solution is to give your activity's root view a known ID say '@ id activityRoot' hook a GlobalLayoutListener into the ViewTreeObserver and from there calculate.. hook a GlobalLayoutListener into the ViewTreeObserver and from there calculate the size diff between your activity's view root and the window size final View activityRootView findViewById R.id.activityRoot activityRootView.getViewTreeObserver..

Detect application heap size in Android

http://stackoverflow.com/questions/2630158/detect-application-heap-size-in-android

different method for determining each of the above. For item 1 above maxMemory which can be invoked e.g. in your main activity's onCreate method as follows Runtime rt Runtime.getRuntime long maxMemory rt.maxMemory Log.v onCreate maxMemory Long.toString..

On logout, clear Activity history stack, preventing “back” button from opening logged-in-only Activites

http://stackoverflow.com/questions/3007998/on-logout-clear-activity-history-stack-preventing-back-button-from-opening-l

I need to either clear the history stack or finish all previously opened activities. One option is to have each activity's onCreate check logged in status and finish if not logged in. I do not like this option as the back button will still be..

How do I pause Flash content in an Android WebView when my activity isn't visible?

http://stackoverflow.com/questions/3431351/how-do-i-pause-flash-content-in-an-android-webview-when-my-activity-isnt-visibl

Update Here is the function we ended up adding to our activity to get this to work. We call it with onPause in the activity's onPause function and onResume in the activity's onResume function private void callHiddenWebViewMethod String name if mWebView.. to our activity to get this to work. We call it with onPause in the activity's onPause function and onResume in the activity's onResume function private void callHiddenWebViewMethod String name if mWebView null try Method method WebView.class.getMethod..

Android Launcher label vs. activity title

http://stackoverflow.com/questions/3488664/android-launcher-label-vs-activity-title

a different shorter caption. It seems the launcher takes its label from the mainfest section about the main activity's label as here activity android name MainActivity android label @string app_short_name intent filter action android name.. app's name @string app_name to a different shorter string resource here. BUT big BUT this also of course changes this activity's default title And I did not want that to happen there's enough space for a long application name Setting the long title..

Determining the size of an Android view at runtime

http://stackoverflow.com/questions/3779173/determining-the-size-of-an-android-view-at-runtime

but that has no effect. I have tried calling these methods and inspecting the object in the debugger in my activity's onCreate and in onPostCreate . How can I figure out the exact dimensions of this view at runtime android share improve..

Usage CursorLoader without ContentProvider

http://stackoverflow.com/questions/7182485/usage-cursorloader-without-contentprovider

package. This method allows the activity to take care of managing the given Cursor's lifecycle for you based on the activity's lifecycle. That is when the activity is stopped it will automatically call deactivate on the given Cursor and when it is..

Android app out of memory issues - tried everything and still at a loss

http://stackoverflow.com/questions/7536988/android-app-out-of-memory-issues-tried-everything-and-still-at-a-loss

weight activities. Unless you do a serious amount of stuff in onStop such as calling setContentView to clear out the activity's view hierarchy and clear variables of whatever else it may be holding on to you are just going to run out of memory. You..

Android Activity Life Cycle - What are all these methods for?

http://stackoverflow.com/questions/8515936/android-activity-life-cycle-what-are-all-these-methods-for

normal static set up create views bind data to lists etc. This method also provides you with a Bundle containing the activity's previously frozen state if there was one. Always followed by onStart . onRestart Called after your activity has been stopped.. this method may never be called in low memory situations where the system does not have enough memory to keep your activity's process running after its onPause method is called. onDestroy The final call you receive before your activity is destroyed...

DefaultHttpClient to AndroidHttpClient

http://stackoverflow.com/questions/8706464/defaulthttpclient-to-androidhttpclient

StrictMode.ThreadPolicy.Builder .permitAll .build StrictMode.setThreadPolicy policy Add the above code into your main activity's onCreate method. In addition it is always recommended to move network operation off the UI thread for example using AsyncTask...

difference and when to use getApplication(), getApplicationContext(), getBaseContext() and someClass.this

http://stackoverflow.com/questions/10347184/difference-and-when-to-use-getapplication-getapplicationcontext-getbasecon

be raised from anywhere with in your application and is not attached to a window. Activity context is attached to the Activity's life cycle and can be destroyed if the activity's onDestroy is raised. If you want to launch a new activity you must need..

How to make application completely ignore screen orientation change in Android?

http://stackoverflow.com/questions/1410504/how-to-make-application-completely-ignore-screen-orientation-change-in-android

implementation Now you need to override a single function within desired Activity. Just add the function below to your Activity's class. @Override public void onConfigurationChanged Configuration newConfig super.onConfigurationChanged newConfig This..

Playing HTML5 video on fullscreen in android webview

http://stackoverflow.com/questions/15768837/playing-html5-video-on-fullscreen-in-android-webview

will be called Notifies the class that the back key has been pressed by the user. This must be called from the Activity's onBackPressed and if it returns false the activity itself should handle it. Otherwise don't do anything. @return Returns.. android id @ id webView android layout_width match_parent android layout_height match_parent RelativeLayout Activity's onCreate in which we initialize it private VideoEnabledWebView webView private VideoEnabledWebChromeClient webChromeClient..

findViewById() returns null for custom component in layout XML, not for other components

http://stackoverflow.com/questions/1691569/findviewbyid-returns-null-for-custom-component-in-layout-xml-not-for-other-co

android id @ id foo some other params TextView android id @ id boring some other params In my Activity's onCreate I do this setContentView R.layout.main TextView boring findViewById R.id.boring ...find other elements... MyCustomView..

Android SplashScreen

http://stackoverflow.com/questions/1979524/android-splashscreen

an instance of AsyncTask to go download all your data then hide the splash screen once the task is complete. So your Activity's onCreate method would simply create a ProgressDialog and show it. Then create the AsyncTask and start it. I would make the..

Android: How to get a radiogroup with togglebuttons?

http://stackoverflow.com/questions/2379527/android-how-to-get-a-radiogroup-with-togglebuttons

I'd just re use the RadioGroup like so please note the onClick attribute i.e. a button click will trigger your Activity's onToggle View method. RadioGroup android id @ id toggleGroup android layout_width fill_parent android layout_height wrap_content..

How to implement a custom AlertDialog View

http://stackoverflow.com/questions/2795300/how-to-implement-a-custom-alertdialog-view

correct it's because you didn't manually inflate it. It appears that you're trying to extract the body id from your Activity's layout and that won't work. You probably want something like this LayoutInflater inflater getLayoutInflater FrameLayout..

Blur or dim background when Android PopupWindow active

http://stackoverflow.com/questions/3221488/blur-or-dim-background-when-android-popupwindow-active

fill_parent android foreground @drawable shape_window_dim ... ... your activity's content ... FrameLayout Here's the Activity's onCreate method public void onCreate Bundle savedInstanceState super.onCreate savedInstanceState setContentView R.layout.activity_mainmenu..

Rotate View Hierarchy 90 degrees

http://stackoverflow.com/questions/3444764/rotate-view-hierarchy-90-degrees

android toDegrees 90 android pivotX 50 android pivotY 50 android duration 0 android fillAfter true rotate Then in your Activity's onCreate do @Override public void onCreate Bundle icicle super.onCreate icicle setContentView R.layout.myscreen Animation..

Show popup above map marker in MapView

http://stackoverflow.com/questions/3707923/show-popup-above-map-marker-in-mapview

with the map when the user scrolls the map. What is the best way to do this One idea is to have the LinearLayout in my Activity's root layout and show it when needed. But how to make it move with the map Another way to do that may be to create an Overlay..

Activity restart on rotation Android

http://stackoverflow.com/questions/456211/activity-restart-on-rotation-android

visibility changes and handle them within your Activity. Start by adding the android configChanges node to your Activity's manifest node android configChanges keyboardHidden orientation or for Android 3.2 API level 13 and newer android configChanges..

BroadcastReceiver as inner class

http://stackoverflow.com/questions/4854807/broadcastreceiver-as-inner-class

as inner class I know the BroadcastReceiver can't be used if defined as Activity's inner class. But I wonder why Is it because the system would have to instantiate a large Activity object to just have instantiated..

How to stop youtube video playing in Android webview?

http://stackoverflow.com/questions/5946698/how-to-stop-youtube-video-playing-in-android-webview

post about WebView threads never stopping Essentially you'll need to call the WebView's onPause method from your own Activity's onPause method. The only trick with this is that you cannot call the WebView's onPause method directly because it is hidden... you will need to call it indirectly via reflection. The following code should get you started on setting up your own Activity's onPause method @Override public void onPause super.onPause try Class.forName android.webkit.WebView .getMethod onPause..

ViewPager and fragments ??what's the right way to store fragment's state?

http://stackoverflow.com/questions/7951730/viewpager-and-fragments-whats-the-right-way-to-store-fragments-state

mechanism calls old fragments onAttach onCreateView etc with my callback interface call for initiating data via Activity's implemented method. But this method points to newly created fragment which is created via Activity's onCreate method. Issue.. data via Activity's implemented method. But this method points to newly created fragment which is created via Activity's onCreate method. Issue Maybe I'm using wrong patterns but even Android 3 Pro book doesn't have much about it. So please..

Best way to manage the ProgressDialog from AsyncTask

http://stackoverflow.com/questions/8295003/best-way-to-manage-the-progressdialog-from-asynctask

case in Android application life cycle that is run some time consuming task in the background thread once done update Activity's view in UI thread. This is why it is always recommended to use it as a inner class of Activity. A more OO design IMO is..

Using Application context everywhere?

http://stackoverflow.com/questions/987072/using-application-context-everywhere

LayoutInflator you will get an Exception. Generally speaking your approach is excellent it's good practice to use an Activity's Context within that Activity and the Application Context when passing a context beyond the scope of an Activity to avoid..