我想从Fragment_A中更改Fragment_B的文本。我该怎么做?
就像这样。
Fragment_A
ola = (TextView) v.findViewById(R.id.textView12);
ola2 = (TextView) (FRAGMENT_B).findViewById(R.id.textView2);
AsyncTask(ola,ola2).execute //this should set text on Fragment_A and Fragment_B
片段A:
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.activity_second,container,false);
ola = (TextView) v.findViewById(R.id.textView12);
Asynctask(ola).execute
return v;
}
片段B:
public class Fragmento_B extends android.support.v4.app.Fragment{
public TextView ola2;
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.activity_third,container,false);
ola2 = (TextView) v.findViewById(R.id.textView2);
Asynctask(ola2).execute
return v;
}
}
发布于 2016-08-16 09:03:11
你面临的问题是什么?它是显示了某种错误,还是没有将文本更改为您的文本或其他内容?
https://stackoverflow.com/questions/38964028
复制相似问题