无法设置setText的值

时间:2016-12-22 12:02:33

标签: android

public class Cust_Details_address extends Fragment{
   String operator;
   EditText operator_name;
   @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.details_customer_2, container, false);

     Intent intent=getActivity().getIntent();
     operator = intent.getStringExtra("operator");
     operator_name = (EditText)view.findViewById(R.id.operator_id);
     operator_name.setText(operator);
    Toast.makeText(getActivity().getApplicationContext(),"operator"+operator,Toast.LENGTH_SHORT).show();

    return view;
  }
}

在Toast中显示操作员名称但EditText是空白的,请提前感谢。

0 个答案:

没有答案