0

I have nine fragment in my ViewPager and each fragment have 10 EditText. User enter value in all EditText. I have submit button on my last ninth fragment. I want to store data in Sqite and then send to server when user fill all the data then press submit button.

I want to know how can i take all EditText data from my all nine fragment to my last ninth fragment where i call my webservice and send data to server when user press submit button.

what is the best way to achieve this ?

I used Bundle to achieve this but giving error. Below is my bundle code. I am getting error in bundle2 because i want to take data from second fragment to third fragment. Can anyone give good solution ?

Fragment First-

    Bundle bundle = new Bundle();
    bundle.putString("ConsAcNo", txtConsAcNo.getText().toString());
    bundle.putString("MeterSrMo", txtMeterSrMo.getText().toString());
    fragment.setArguments(bundle);

Fragment Second-

    // getting data from first fragment
    Bundle bundle = this.getArguments();
    String ConsAcNo= bundle.getString("ConsAcNo");
    String MeterSrMo= bundle.getString("MeterSrMo");

    //this is my second bundle to take data to third fragment.
    Bundle bundle2 = new Bundle();
    bundle2.putString("txtConsAcNo1", ConsAcNo.toString());
    bundle2.putString("txtMeterSrMo1", MeterSrMo.toString());
    bundle2.putString("txtTestNo", txtTestNo.getText().toString());
    bundle2.putString("txtAccucheckNo",txtAccucheckNo.getText().toString());
    fragment1.setArguments(bundle2);
Akeshwar Jha
  • 4,516
  • 8
  • 52
  • 91

0 Answers0