Minimum magnitude

SckrUt Mm minimum mdgnlLude fanhqiiitli^ th r p-pnrr


LISTING 6-5: Saving Activity state

Available for download on protected void saveActivityPreferences(){

// Create or retrieve the activity preference object.

SharedPreferences activityPreferences = getPreferences(Activity.MODE_PRIVATE)

// Retrieve an editor to modify the shared preferences. SharedPreferences.Editor editor = activityPreferences.edit();

// Retrieve the View

TextView myTextView = (TextView)findViewByld(;

// Store new primitive types in the shared preferences object. editor.putString("currentTextValue", myTextView.getText().toString());

// Commit changes. editor.commit();

Was this article helpful?

0 0
Mobile Apps Made Easy

Mobile Apps Made Easy

Quick start guide to skyrocket your offline and online business success with mobile apps. If you know anything about mobile devices, you’ve probably heard that famous phrase coined by one of the mobile device’s most prolific creators proclaiming that there’s an app for pretty much everything.

Get My Free Training Guide

Post a comment