Screen2.java file has the following code :
public class screen2 extends Activity {
public int globalZip=0;
//Some validations & update globalZip
//Code control goes to Screen3,java
}
Screen3.java file has the following code :
public class Screen3 extends Activity
{
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.screen3);
screen2 objs2= new screen2();
int myzip = objs2.globalZip;
Toast.makeText(getBaseContext(), "Screen3 "+myzip, 5).show();
System.out.println("WTHDude"+"Screen3 "+myzip);
}
Now the problem i am having that if i have updated value of globalZip in Screen2.java file as 90034 it is not getting updated in the screen3. Can anyone help me with this error. Thank you.
Activity. As mentioned in the answers, create anIntentand add 'extra' data to it then pass it tostartActivity(...)orstartActivityForResulrt(...)