android - black screen appears when come back from an external application -
android - black screen appears when come back from an external application -
i have application open external application read pdf files. here code open external app.
if(file!=null){ packagemanager packagemanager = getpackagemanager(); intent testintent = new intent(intent.action_view); testintent.settype("application/pdf"); list list = packagemanager.queryintentactivities(testintent, packagemanager.match_default_only); if (list.size() > 0 && file.isfile()) { intent intent = new intent(); intent.setaction(intent.action_view); uri uri = uri.fromfile(file); intent.setdataandtype(uri, "application/pdf"); startactivity(intent); }else{ toast.maketext(this, "problem loading file", toast.length_long).show(); } }
the problem when come pdf application (adobe reader or pdf reader app), in first click of button black screen , in sec can reach activity? how perchance solve problem?
i think normal activity lifecycle @ work.
once activity goes background, deemed no longer critical os , process may killed in order reclaim memory or resources foreground activity. black screen see when pressing button window background of application's theme appears while activity recreated , state restored.
this normal behavior. ensure activity saves , restores state efficently implementing appropriate lifecycle methods cut down time takes re-create.
see http://developer.android.com/reference/android/app/activity.html#activitylifecycle
android android-activity android-package-managers
Comments
Post a Comment