FAQ Database Discussion Community


Android - Back button doesn't call onResume()

android,back-button,android-theme,onresume,up-button
I'm a beginner at this, so bear with me. In my app, I want the theme of the app to update based upon user preference. I have a preferences page with a theme section, and here is the code for my MainActivity: @Override protected void onCreate(Bundle savedInstanceState) { SharedPreferences preferences...

App crashing when saving to shared preferences

java,android,sharedpreferences,onresume,onpause
I am trying to save to shared preferences. I want to be able to load from shared preferences but when I save and or load at the moment my app crashes. I also want to be able to have my handler/runnable resume when my app starts up. How can I...

Close app and reopen Continue read text

android,textview,onresume
This is simple code with multi text in one textview, int stringIdList[] = {R.string.text1, R.string.text2, R.string.text3, R.string.text4}; int stringListCounter = 0; TextView text1; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button next = (Button) findViewById(R.id.next1); Button previous = (Button) findViewById(R.id.pre1); text1 = (TextView) findViewById(R.id.textView1); next.setOnClickListener(this); previous.setOnClickListener(this); @Override...

Android onResume not called after onNewInetent

android,android-intent,android-activity,android-broadcast,onresume
I have a BroadcastReceiver which should launch activity: @Override public void onReceive(Context context, Intent intent) { if (wakeLock == null) { PowerManager pm = (PowerManager) ApplicationScreen.instance.getApplicationContext() .getSystemService(Context.POWER_SERVICE); wakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, TAG); } if (!wakeLock.isHeld()) { wakeLock.acquire(); } try { if (ApplicationScreen.instance != null) { Intent dialogIntent = new Intent(context, MainScreen.class);...

Runnable, Pause and Resume thread

java,android,runnable,onresume,onpause
my app is working fine but i cant figure out why my void run(); still runs in the background when i click the "home" button. I want my thread to pause the Thread onPause and start the thread again when onResume() i called! Cant figure out what im doing wrong!...

App crashes when Resumed

java,android,onresume
I am creating a simple Flashlight App, but every time I leave the app and reopen it, it crashes. Am I missing something in my code, because I am not sure what, below is an error when it crashes. Please let me know what I need to do in order...

Android Login Screen after Application enters foreground again. Login Screen is NOT root Activity

android,login,onresume,onpause
I'm programming a Voting Android Application. After the user has chosen an Election where he wants to make a vote, the user gets redirected to a Login Activity where he has to enter a password. After that, a Ballot Activity gets started and the person can choose some candidates. A...

Unable to resume activity - SharedPreferences

android,sharedpreferences,onresume
I'm trying to implement a "first-launch" method that will open a specific activity the first time the user opens the app. I have a SharedPreferences called prefs: public class MainActivity extends ActionBarActivity { SharedPreferences prefs = null; public static final String DEFAULT = "N/A"; @Override protected void onCreate(Bundle savedInstanceState) {...