Got exception: fragment already active

前端 未结 8 1747
攒了一身酷
攒了一身酷 2021-01-30 12:49

I have a fragment;

MyFragment myFrag = new MyFragment();

I put bundle data to this fragment:

         


        
8条回答
  •  野性不改
    2021-01-30 13:27

    Just call public method from fragment

    if(userFragment==null){
                        userFragment = new UserFragment();
                        Bundle bundle = new Bundle();
                        bundle.putString(Constants.EXTRA_CUSTOMER, result);
                        userFragment.setArguments(bundle);
                    }else{
                        try {
                            Customer customer = new Customer();
                            customer.parseCustomer(new JSONObject(result));
                            userFragment.updateVeiw(customer);
                        } catch (JSONException e) {
                            e.printStackTrace();
                        }
                    }
    

提交回复
热议问题