Speak now
Please Wait Image Converting Into Text...
Embark on a journey of knowledge! Take the quiz and earn valuable credits.
Challenge yourself and boost your learning! Start the quiz now to earn credits.
Unlock your potential! Begin the quiz, answer questions, and accumulate credits along the way.
Course Queries Syllabus Queries 2 years ago
Posted on 16 Aug 2022, this text provides information on Syllabus Queries related to Course Queries. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.
Turn Your Knowledge into Earnings.
I'm having an app A with Settings and Authentication activities. The Authentication b.com/tag/activity">activity is launched whenever some other app(say App B) is launched, so if the b.com/tag/authentication">authentication is successful then app B's launcher Activity is shown(a kind of app lock protection). I have two behaviors to explain here,
When I'm having my App A minimized, I will launch App B. This will trigger the Authentication b.com/tag/activity">activity of App A. If the b.com/tag/authentication">authentication is successful then immediately I'm killing the Authentication Activity using finish(). But this will finish the Authentication b.com/tag/activity">activity and it will bring the b.com/tag/activity">activity of App A that was minimized previously to front(I don't want this to happen) instead of taking it to new app.
If the App A is not running at all(not even minimized) than the Authentication b.com/tag/activity">activity is launched and on successful b.com/tag/authentication">authentication the App B's b.com/tag/activity">activity is shown.
Can someone explain me why these 2 different behaviors are being shown. Also in case 1 also I want to show the Activity of app 2 after successful Authentication.
I was also searching for some thing like this. But i did find some solutions which were out of syllabus for me like using background service or using getTasks method or using package manager like so on.
The simplest solution which i made was some thing like this.
public class MainApplication extends Application implements Application.ActivityLifecycleCallbacks { private static boolean background = false; private static int count = 0; @Override public void onCreate() { super.onCreate(); registerActivityLifecycleCallbacks(this); } @Override public void onActivityCreated(Activity activity, Bundle bundle) { } @Override public void onActivityStarted(Activity activity) { if(background){ background = false; Log.v("activityFocus", "Activity came in foreground "); Toast.makeText(getApplicationContext(), "Foreground", Toast.LENGTH_SHORT).show(); } } @Override public void onActivityResumed(Activity activity) { count++; } @Override public void onActivityPaused(Activity activity) { count--; } @Override public void onActivityStopped(Activity activity) { if(count==0){ Log.v("activityFocus", "Activity is in background "); Toast.makeText(getApplicationContext(), "Background", Toast.LENGTH_SHORT).show(); background=true; } } @Override public void onActivitySaveInstanceState(Activity activity, Bundle bundle) { } @Override public void onActivityDestroyed(Activity activity) { }
}
No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.
Course Queries 4 Answers
Course Queries 5 Answers
Course Queries 1 Answers
Course Queries 3 Answers
Ready to take your education and career to the next level? Register today and join our growing community of learners and professionals.