我有两个片段。当我尝试从第一个更改第二个时,调试器加入第二个片段但内容不显示。我尝试添加和替换方法,但都一样。第二个的内容没有改变。
FragmentManager fragmentManager = getFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
RepairViewFragment fragment = new RepairViewFragment();
fragmentTransaction.add(R.id.detailFragment, fragment);
fragmentTransaction.commit();
谢谢。
这是代码RepairViewFragment
public class RepairViewFragment extends Fragment implements OnClickListener {
// private final static int REQUEST_ENABLE_BT = 1;
// private final static int REQUEST_BT_SETTINGS = 2;
ProgressDialog myProgressDialog = null;
BluetoothAdapter mBluetoothAdapter = null;
ArrayList<MachineBT> Machines = new ArrayList<MachineBT>();
String BluetoothDevices = "";
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
Button btn_cl = (Button)getView().findViewById(R.id.btn_client_automat);
btn_cl.setOnClickListener(this);
Button btn_own = (Button)getView().findViewById(R.id.btn_own_automat);
btn_own.setOnClickListener(this);
ImageButton img_back = (ImageButton)getView().findViewById(R.id.img_back);
img_back.setOnClickListener(this);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.repair_layout, container, false);
return view;
}