problem:
No matter what I activity, when my phone switches to the main screen , or open , when other applications . Then return back to my app. How to get to this event ?
------ Solution ---------------------------------------- ----
let them inherit a unified class A Class A class which inherits ACtivity A on the realization of an operation of this onresume and onpause whether this can be solved it ?
Although onresume and onpause not a complete process, but no matter how you start the application how to exit the application must take this step .
------ Solution ---------------------------------------- ----
write a base class Activity
In onStop () determines the entire application is not in the phone reception. Then record flag flag
In onResume () where the decision is not based on flag gesture password. Reset flag flag
check whether an application running in the foreground code is as follows :
public boolean isAppOnForeground() {
// Returns a list of application processes that are running on the
// device
ActivityManager activityManager = (ActivityManager) getApplicationContext().getSystemService(Context.ACTIVITY_SERVICE);
String packageName = getApplicationContext().getPackageName();
List<RunningAppProcessInfo> appProcesses = activityManager.getRunningAppProcesses();
if (appProcesses == null)
return false;
for (RunningAppProcessInfo appProcess : appProcesses) {
// The name of the process that this object is associated with.
if (appProcess.processName.equals(packageName) && appProcess.importance == RunningAppProcessInfo.IMPORTANCE_FOREGROUND) {
return true;
}
}
return false;
}
------ For reference only ----------------------------------- ----
you onpause sets a flag bit and then onresume time to read this flag bit , and then call this gesture password ?
------ For reference only -------------------------------------- -
onpause sets a flag bit that is set up in activity in ?
------ For reference only -------------------------------------- -
onpause sets a flag bit that is set up in activity in ?
Yes ah
------ For reference only ------------------------------- --------
sharedPreference this stored it
------ For reference only ---------------------------------------
onpause settings a flag bit , this is the activity Lane ?
Yes ah
activity of the pause to resume, not necessarily the entire application to be cut out ah. Moreover , you need to go for each activity in Canada, is not very troublesome thing ? This should think of ways to start it in the application
------ For reference only ------------------------------ ---------
onpause sets a flag bit that is set up in activity in ?
Yes ah
activity of the pause to resume, not necessarily the entire application to be cut out ah. Moreover , you need to go for each activity in Canada, is not very troublesome thing ? This should think of ways to start it in the application
sorry please disregard the above answer . I did not take into account your internal multiple activity handover
------ For reference only -------------------------- -------------
With you modify the internal startactivity when the first bit of the mark , you can avoid the internal switch when the lock screen . Other circumstances or in accordance with the above process to carry out his .
------ For reference only -------------------------------------- -
onpause sets a flag bit that is set up in activity in ?
Yes ah
activity of the pause to resume, not necessarily the entire application to be cut out ah. Moreover , you need to go for each activity in Canada, is not very troublesome thing ? This should think of ways to start it in the application
sorry please disregard the above answer . I did not take into account your circumstances internal switching multiple activity
ah the good way to think of other
------ For reference only ------------------------- --------------
considering this logic Haha several conditions
I guess ah need two markers first marker bit indicates whether the application opens the lock
second marker bit indicates whether the need to open this lock
------ For reference only ---------------- -----------------------
Haha brother So you are a master ah ha ha really do a lot of things
------ For reference only ------------- --------------------------
leadership saw the new version of QQ has this feature , it is required to achieve , alas, I am a little no start
------ For reference only ------------------------------------ ---
leadership saw the new version of QQ has this feature , it is required to achieve , alas, I am a bit impossible to start
demanding a wage ah
------ For reference only ------------------------------ ---------
seeking expert prompt ah
------ For reference only --------------------- ------------------
open a service, or open a thread inside the aplication by
ActivityManager activityManager = (ActivityManager) getSystemService (ACTIVITY_SERVICE);
ComponentName componentName = activityManager.getRunningTasks (2). get (1). topActivity;
Gets the currently active activity, I do not know have not tried okay
------ For reference only ---------------------------------- -----
open threads , then to affect the efficiency of the bar
------ For reference only ------------------ ---------------------
+1
------ For reference only ------------ ---------------------------
as long as no visible ACT go nonstop () on the inside with a Bundle saved. Go back onresume () Read about the page state assignment can repeat
------ For reference only ---------------------- -----------------
how do you not consider the application of the jump
------ For reference only ----- ----------------------------------
my answer was not adopted it . . . .
------ For reference only ---------------------------------------
upstairs good ideas have been well
------ For reference only ----------------------------------- ----
没有评论:
发表评论