Android shared preferences for creating one time activity

0 votes

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.


We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.

Closed 5 years ago.

Improve this question

I have three activities A,B and C where A and B are forms and after filling and saving the form data in database(SQLITE). I am using intent from A to B and then B to C.What i want is that every time I open my app I want C as my home screen and not A and B anymore.

I guess shared preferences would work for this, but I cannot find a good example to give me a starting place. Any help would be appreciated.

Jun 20 in Others by polo
• 1,500 points
7 views

1 answer to this question.

0 votes

How to Intialize?

// 0 - for private mode`
SharedPreferences pref = getApplicationContext().getSharedPreferences("MyPref", 0); 

Editor editor = pref.edit();

How to Store Data In Shared Preference?

editor.putString("key_name", "string value"); // Storing string

OR

editor.putInt("key_name", "int value"); //Storing integer

And don't forget to apply :

editor.apply();

How to retrieve Data From Shared Preferences ?

pref.getString("key_name", null); // getting String

pref.getInt("key_name", 0); // getting Integer
answered Jun 21 by nisha
• 2,160 points

Related Questions In Others

0 votes
1 answer

Creating custom property for .net assembly

While your compiler does not really support ...READ MORE

answered Nov 13, 2018 in Others by DataKing99
• 8,240 points
185 views
+2 votes
2 answers
+1 vote
1 answer
0 votes
0 answers

Date time convert in Replace activity in word document scope

we have input in excel  New date/Header 31/12/2020 31/12/2019 We  want ...READ MORE

Jun 22, 2020 in Others by Sapna
• 120 points

recategorized Jun 22, 2020 by Gitika 146 views
0 votes
1 answer

"Default Activity Not Found" on Android Studio upgrade

If you see that ERROR occurrence after ...READ MORE

answered Feb 11 in Others by Soham
• 8,730 points
163 views
0 votes
1 answer

How to get current time and date in Android

In order to get the current date ...READ MORE

answered Feb 23 in Others by Aditya
• 7,280 points
175 views
0 votes
1 answer

How to prepare an APK for the Amazon Android App Store

you should use zipalign during every build, ...READ MORE

answered Jun 1 in Others by nisha
• 2,160 points
22 views
0 votes
1 answer

How to make Diamond shape xml background for android view

you can do this: <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> ...READ MORE

answered Jun 1 in Others by nisha
• 2,160 points
32 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP