• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

i need to make the restart app

 
sam liya
Ranch Hand
Posts: 1243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need to restart the my app when the button clicks.how to do this?
 
Steve Luke
Bartender
Posts: 4181
22
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The answer depends a bit on what you really mean. Restart the application usually means shut down the application and then launch it from scratch. Launching the application again is fairly simple, you could use the AlarmManager so schedule an intent in, say 1 second, that launches the main activity. The problem is how to shut the application down. You typically don't do that, you let the user navigate away from the application and then as the OS needs resources it cleans up the memory held by your activities, services, and application until the app is completely out of memory.

So a question is: what do you really want to do? Why do you want to restart the application? What are you trying to achieve?
 
sam liya
Ranch Hand
Posts: 1243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
in my apps ,when it runs in first time ,user have to select the SIM type.whether it's prepaid or post paid.Then it saved in sqlite database.So if user has select wrong the SIM type at the begging ,he can change it in the settings menu.So when user change the SIM type app need to restart.because currently it shows the wrong info.
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why can't the app display the correct information instead?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic