我正在开发一个由Fragment
下的三个Activity
组成的应用程序:
1.Fragment(1)由Text-views组成 2.Fragment(2)由编辑文本组成。
这是我的问题:
在片段(1)中选择TextView
时,应将TextView
值传递给片段(2)中的EditText
。
public class OrdersActivity extends Activity {
private Bundle bundle;
private ArrayList<String> eList;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.orders);
bundle = new Bundle();
bundle.putStringArrayList("elist", eList);
FragmentTransaction order = getFragmentManager().beginTransaction();
OrdersList orderList = new OrdersList();
orderList.setArguments(bundle);
order.add(R.id.frmOrderlist, orderList);
order.commit();
FragmentTransaction input = getFragmentManager().beginTransaction();
InputEdit inputEdit = new InputEdit();
input.add(R.id.frmOrderinput, inputEdit);
input.commit();
FragmentTransaction quoteorder = getFragmentManager().beginTransaction();
QuoteFragment quotefragment = new QuoteFragment();
quoteorder.add(R.id.frmSecondList, quotefragment);
quoteorder.commit();
FragmentTransaction quotechart = getFragmentManager().beginTransaction();
ChartOrderFragment chartquote = new ChartOrderFragment();
quotechart.add(R.id.frmOrderChart, chartquote);
quotechart.commit();
}
答案 0 :(得分:0)
好的方法是使用Activity作为调度程序来相互传递碎片。