Encounter a problem, help us to see ah
@ Override
my programpublic void onStop () which creates a floating window
Press the home button so that the program will generate a floating window, now I have received a floating window click event, the question is how to return to the front display MainActivity it?
private void createView () {
myFV = new MyFloatView (getApplicationContext (), this);
myFV.setImageResource (R.drawable.floatimge);
/ / Get WindowManager
wm = (WindowManager) getApplicationContext () getSystemService ("window");.
/ / Set LayoutParams (global variables) related parameters
wmParams = ((MyApplication) getApplication ()) getMywmParams ();.
/ **
* The following are the relevant attributes
WindowManager.LayoutParams* Refer to the SDK documentation specific uses
* /
wmParams.type = WindowManager.LayoutParams.TYPE_PHONE; / / set the window type
wmParams.format = PixelFormat.RGBA_8888; / / set the image format, the effect of the background transparent
/ / Set Window flag
/ / WmParams.flags = WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
/ / | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE;;
wmParams.flags | = 8;
Others create a floating window code
omitted
What is the recovery window click event in the code, but there are bug ah. Contents of the interface did not
case 1:
Log.i ("11111111111", "jjjjjjjjjjjjjjjjjjjj") ;/ / debug information
timer.cancel (); / / cancel the timer
Intent intent = my.getIntent (); / / return Intent
to restart Activitymy.finish (); / / Close Activity
my.startActivity (intent); / / Restart Activity
I want to click on the box to restore the previous suspension APP interface ah can now resume, but before you enter the edit box contents inside interface on the menu are gone I open the program, there is no in this case
May I ask how to restore the state of APP into the background stop it?
<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
Their top! ! ! ! Popularity not ah
Reply:
onStop (inside) the data saved up, you can choose SharedPreferences, File, SQLite, etc..
Recovery interface when calls onStart (), in which the stored data is read out display just fine.
Reply:
Must be so? Can interface to tune out ah?
In the window management system which can be seen in the history of the program to run, where you can open the program, the interface is not changed;
Re-open the menu, the page has not changed,
Does the program into the background, there is no way to the front it?
Reply:
Can solve the problem on it, no need to stick to a particular method.
No comments:
Post a Comment