0

How to pass the shared preference values as input to the JSONArray, I'm using the following code in my program, Kindly Help me,Thanks in Advance.

shared prefernce to get email id pref = getApplicationContext().getSharedPreferences("set", 0); editor = pref.edit();

Put the Shared Preference Value in RegisterActivity

editor.putString("email", inc_email.getText().toString());

Get the value from Shared Preference in LoginActivity

pref = getApplicationContext().getSharedPreferences("set", 0); final String em=pref.getString("email","");

Parsing Value to service URL

String API="http://groups.com/projects/nic/main.php?email="+em+"&state="+state;

1 Answer 1

2

Do you forgot to commit changes?

Try:

editor.putString("email", inc_email.getText().toString());
editor.commit();

If you need JSON parsing, you may use this useful library https://jsonp.java.net/

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.