我想使用Fragment在SQLite数据库中添加数据,但它不是在数据库中添加并且在运行应用程序时没有错误。 我在AddRoom片段代码:在Android中使用Fragment在SQLite数据库中添加数据
public class AddRoom extends Fragment implements View.OnClickListener {
DatabaseHotel myHotel;
Button bt_addRoom;
EditText ed_roomtype, ed_roomPrice, ed_noOfRoom;
View view;
Context context;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
myHotel = new DatabaseHotel(getActivity());
view = inflater.inflate(R.layout.addroom, container, false);
bt_addRoom = (Button)view.findViewById(R.id.bt_addroom);
ed_roomtype = (EditText)view.findViewById(R.id.ed_roomtype);
ed_roomPrice = (EditText)view.findViewById(R.id.ed_roomprice);
ed_noOfRoom = (EditText)view.findViewById(R.id.ed_noofrooms);
return vie