onresume

How to update ListView after onResume from other activity?

柔情痞子 提交于 2019-12-01 08:51:55
问题 Im trying to create an application that enable user to create event, then invite participant. So when user go to "add participant" page, after entering all information, im trying to direct back to the "participant list" page by using onResume(), but how to update the listview? i tried to use notifyDataSetChanged() but not working. Here is the code for participant list: public class EventPage extends ListActivity implements OnClickListener { Intent intent; TextView friendId; EventController

Replacing a Fragment with itself does not show anything

本秂侑毒 提交于 2019-12-01 04:38:15
I'm trying to decide and show a fragment in activity's onResume method, but in case a previously added fragment is chosen again, then the activity goes blank. Sample code (with one fragment): @Override protected void onResume(){ FragmentTransaction trans = getSupportFragmentManager().beginTransaction(); trans.replace(R.id.myLayout, fragA); trans.commit(); getSupportFragmentManager().executePendingTransactions(); } With above code, when the activity is created for the first time, it shows fragA correctly, but in case I press Home Key and then switch back to my activity (in order to provoke

Refresh(recreate) the activities in back stack when change locale at run time

前提是你 提交于 2019-12-01 00:05:26
I have an Activity say ActivityMain from this activity I moved to another activity called ActivitySettings and in settings activity I'm changing the App locale by clicking on a button, and using recreate I achieved the change I need in current activity but when I press back my `ActivityMain' will resume but locale is not updated. Can some one tell me how to 'Recreate' backstack activities? what will be the correct approach. I can't call recreate on refresh as it will be infinite loop In each Activity's onCreate() you can maintain the currentLangCode . Check this value in onResume() , if it

Refresh(recreate) the activities in back stack when change locale at run time

前提是你 提交于 2019-11-30 18:34:14
问题 I have an Activity say ActivityMain from this activity I moved to another activity called ActivitySettings and in settings activity I'm changing the App locale by clicking on a button, and using recreate I achieved the change I need in current activity but when I press back my `ActivityMain' will resume but locale is not updated. Can some one tell me how to 'Recreate' backstack activities? what will be the correct approach. I can't call recreate on refresh as it will be infinite loop 回答1: In

how do I restart an activity in android? [duplicate]

断了今生、忘了曾经 提交于 2019-11-30 13:39:27
This question already has an answer here: How do I restart an Android Activity 21 answers in an app that I am writing, there is a part of it that allows you to change a curtain setting. the problem is, that this setting won't take effect until the activity is recreated. is there a way to tell the app to restart using the onResume() method (hopefully allowing it to save everything in the onSaveInstanceState())? Ted Hopp This has been posted before : Intent intent = getIntent(); finish(); startActivity(intent); As of API level 11, you can also just call an activity's recreate() method. Not only

Android: “Application level” Pause and Resume [closed]

只愿长相守 提交于 2019-11-30 11:36:30
I've been trying to get Application Level Pause and Resume similar to an activity's onPause and onResume. I know there's no API that has this functionality. I try to follow this post: http://curioustechizen.blogspot.com/2012/12/android-application-level-pause-and.html But I've had no luck so far. Has anyone been able to achieve this? What paradigm did you use? Let me know if you need me to paste some code into this question. Thanks for the help Another solution to the problem would be to just keep track of the count of onStart() and onStop() calls from every activity. Example: First, create a

Why is onResume() called when an activity starts?

拥有回忆 提交于 2019-11-30 07:34:16
I have an app where after sign in it throws you at the welcome screen. I put a Toast to see when the onResume fires, but it also fires after onCreate protected void onResume(){ super.onResume(); Database openHelper = new Database(this);//create new Database to take advantage of the SQLiteOpenHelper class myDB2 = openHelper.getReadableDatabase(); // or getWritableDatabase(); myDB2=SQLiteDatabase.openDatabase("data/data/com.example.login2/databases/aeglea", null, SQLiteDatabase.OPEN_READONLY);//set myDB to aeglea cur = fetchOption("SELECT * FROM user_login");//use above to execute SQL query msg

Android: “Application level” Pause and Resume [closed]

匆匆过客 提交于 2019-11-29 17:15:29
问题 I've been trying to get Application Level Pause and Resume similar to an activity's onPause and onResume. I know there's no API that has this functionality. I try to follow this post: http://curioustechizen.blogspot.com/2012/12/android-application-level-pause-and.html But I've had no luck so far. Has anyone been able to achieve this? What paradigm did you use? Let me know if you need me to paste some code into this question. Thanks for the help 回答1: Another solution to the problem would be to

Canvas draw functions not working after screen locked and unlocked

谁都会走 提交于 2019-11-29 09:29:12
I'm working on an augmented reality application in which I have a camera preview screen on which I draw some markers which moves with respect to device movement. When I lock and unlock the device, the markers freezes and doesn't move further. I'm unable to find the reason why this happens.Is there any possible work around for this? Any help will be greatly appreciated. My SurfaceView class: public class CameraSurface extends SurfaceView implements SurfaceHolder.Callback { private static SurfaceHolder holder = null; public static Camera camera = null; Activity ctx; public CameraSurface(Activity

Android onCreate onResume

一世执手 提交于 2019-11-29 09:16:41
I have a problem. When I start for the first time my android application, in the main activity both the onCreate and the onResume are called. but I want to be called only the onCreate. What can I do? According to the SDK docs what you are seeing is the intended behavior. Have a look at the flowchart in the docs for Activity - Activity Lifecycle . Programmatically you can overcome this by keeping an instance member to track whether onResume has been called before - the first time it is called, set the variable and return e.g. private boolean resumeHasRun = false; @Override protected void