我有片段1内容edittext和片段2内容列表视图,如何将数据从1传递到2。 注意:不是textview Iwant to listview。
答案 0 :(得分:0)
Fragment A{
ArrayList<Model> mList;
Adapter... mAdapter;
String str =null;
public ArrayList<Model> getList(){return mList;}
public void setList(ArrayList<Model> l){this.mList = l;}
public void setStr(String s){
this.str = s;
//handle here
}
}
Fragment B{
TextView mTextView;
Fragment A a;
ArrayList<Model> mList;
//you can change content of a list here
mList = a.getList();
mList...
//Or
a.setStr(myTextView.getText().toString());
}