Native Shopify Mobile App with 20 new features
Kickstart your hyperlocal marketplace in Corona pandemic with a starter guide
Android App Development
iOS App Development
Cross Platform App Development
Hire on-demand project developers and turn your idea into working reality.
Big thanks to Webkul and his team for helping get Opencart 18.104.22.168 release ready!
Owner and Founder. Opencart
In this blog,
I have talked about activity recreating in android. And will give the some facts related to save the Activity State.
There are a few scenarios in which your activity is destroyed due to normal app behavior, such as
However, if the system destroys the activity due to system constraints, then although the actual Activity instance is gone,
The system remembers that it existed such that if the user navigates back to it, the system creates a new instance of the activity using a set of saved data that describes the state of the activity when it was destroyed. The saved data that the system uses to restore the previous state is called the “instance state” and is a collection of key-value pairs stored in a Bundle object.
Note: Your activity will be destroyed and recreated each time the user rotates the screen.
For recreating the activity, you can use the simple recreate() or startActivity(intent).
While using the recreate method works by doing,
or can use to reopen the activty by startActivity.
It was only added in API level 11. If you want to include more devices you can check the API level.
You can use both by making an if statement,
As your activity begins to stop, the system calls onSaveInstanceState() so your activity can save state information with a collection of key-value pairs.
When your activity is recreated after it was previously destroyed, you can recover your saved state from the Bundle that the system passes your activity. Both the onCreate() and onRestoreInstanceState() callback methods receive the same Bundle that contains the instance state information.
Your email address will not be published. Required fields are marked*
Save my name email and website in this browser for the next time I comment.
Be the first to comment.
Great Product, Great Team, and Great Support Service. And if you want to add more features to the product, they can submit any idea that comes to your mind. They really care about their clients and we are really happy and honored to deal with Webkul.
Enquiry or Requirement
If you have more details or questions, you can reply to the received confirmation email.