Reputation: 75
I have 2 Activities. In "A" activity I have a button and when user clicks this button, "B" Activity long data will change.
If the user doesn't click this button, in "B" Activity change standard long data...
Here is my code in "A" Activity's button;
SharedPreferences prefs = getSharedPreferences("sure", MODE_PRIVATE);
SharedPreferences.Editor editor = prefs.edit();
editor.putString("veri", "31000");
editor.commit();
Here is my code in "B" Activity's for get;
SharedPreferences prefs = getSharedPreferences("sure", MODE_PRIVATE);
long kalansure = prefs.getLong("veri", 61000);
But it is not working...
Upvotes: 0
Views: 41
Reputation: 37645
You are using putString
in A
and then getLong
in B
. You should either use String
in both places or long
in both places, depending on what you need.
Upvotes: 1