How to pass value from 1st activity to 3rd activity

前端 未结 7 1988
暖寄归人
暖寄归人 2020-12-12 07:25

I wish to pass the value from 1st activity to 3rd activity.

My 1st activity: CustomizedListview

2nd activity is: SingleMenuItemActivity

3rd activity

7条回答
  •  暖寄归人
    2020-12-12 08:08

    I have to passed orderid value from 1st activity to second activity

    Send as you send to second activity . Just change name of second activity to third activity.

    Or

    Just Store Order Id in Shared Preference and get it in third Activity.

    SharedPrefernce Example

    SharedPreferences myPrefs = this.getSharedPreferences("myPrefs", MODE_WORLD_READABLE);
    SharedPreferences.Editor prefsEditor = myPrefs.edit();
    prefsEditor.putString("order_id", "5");
    prefsEditor.commit();
    

    Get Shared Preference.

     SharedPreferences myPrefs = this.getSharedPreferences("myPrefs", MODE_WORLD_READABLE);
     String prefName = myPrefs.getString("order_id", "0");
    

提交回复
热议问题