Issue
I have two activities A and B.
public class A extends Activity
{
....
@Override
protected void onResume()
{
super.onResume();
if(MyStaticVarz.myFlag)
{
MyStaticVarz.myFlag= false;
SomeTask();
}
}
MyStaticVarz.java :
public class MyStaticVarz
{
public static boolean myFLag = false;
}
Go from A to B and change myFlag to true like:
MyStaticVarz.myFlag = true;
and go back to A again,but in onResume if(MyStaticVarz.myFlag) is false and SomeTask() not reached.
Going from A to B like :
Intent i = new Intent(A.this, B.class);
startActivity(i);
UPDATE SomeTask() is for change fontsize of a text in A and B.
myFlag is for on demand reinitialize of UI that if font setting changed,then SomeTask() run.
When click on optionMenu in B,and change font size,and go to B,i see changes,but when go back to A,text font size not happen.
Maybe Important: when i'm back to A and font size is not ok and myFlag is false too,if i change oriantation,text fontsize is ok but myFlag is false again!
Solution
Your answer is simple, when you change MyStaticVarz.myFlag
to true
in getView
, then you back to activity B, in onResume()
the value of MyStaticVarz.myFlag
change from true
to false
and when you back to activity A , the value of MyStaticVarz.myFlag
is false
not true
and is obvious that activity A never get true
value.
To solve this problem you must save changed value :
String value = entryValues[index].toString();
to static String
in MyStaticVarz
and in activity A and B onResume()
event check the static String
with local String
to understand change.
Answered By - CooL i3oY
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.