How to set values after using model class for global ArrayList?

后端 未结 3 973
迷失自我
迷失自我 2021-01-29 10:59

I\'ve created one model class to store my product name,price and quantity,and then I attach it to another Fragment and try to display it in my TextView

3条回答
  •  忘掉有多难
    2021-01-29 11:20

    First create an application class like this,

    public class Applicationc extends Application{

    public String str;
    
    @Override
    public void onCreate() {
        super.onCreate();
    
        str=null;
    }
    

    }

    create its entry like this in manifest

    then in onPost of Async Task set the value in following way,

    Applicationc app=(Applicationc)getApplicatoncotext(); app.str="data";

    And where you want to retrieve value in following way,

    Applicationc app=(Applicationc)getApplicatoncotext(); String dd=app.str;

提交回复
热议问题