fragment中显示toast

Toast.makeText(getActivity(), getResources().getString(R.string.root_fail_text), Toast.LENGTH_SHORT).show();
注意getAcitivity写成getContext后,toast不显示

你可能感兴趣的:(android小知识备忘)