我有一个编辑器活动,用户可以在编辑文本和单选按钮中进行更改。我已经在编辑器活动中放置了FAB按钮"当用户点击fab时,所有更改都应该保存"但我不知道我怎么做到这一点。我从POJO得到的数据。提前谢谢。
btnSave = (FloatingActionButton) findViewById(R.id.fab);
radioGroup1 = (RadioGroup) findViewById(R.id.radio_group_broadcast);
rbPub = (RadioButton)findViewById(R.id.radio_button_public);
rbPri = (RadioButton)findViewById(R.id.radio_button_private);
rbUnl = (RadioButton)findViewById(R.id.radio_button_unlisted);
rbOnl = (RadioButton)findViewById(R.id.radio_button_logged_only);
if (videoDetail.getBroadcast().contains("public")) {
radioGroup1.check(R.id.radio_button_public);
}
else if (videoDetail.getBroadcast().contains("private")) {
radioGroup1.check(R.id.radio_button_private);
}
else if (videoDetail.getBroadcast().contains("unlisted")) {
radioGroup1.check(R.id.radio_button_unlisted);
}
else if (videoDetail.getBroadcast().contains("loggedin")) {
radioGroup1.check(R.id.radio_button_logged_only);
}
radioGroup1.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
int selectedId = radioGroup1.getCheckedRadioButtonId();
rbPub = (RadioButton)findViewById(selectedId);
Toast.makeText(VideoEditorActivity.this, "Broadcast " + rbPub.getText().toString()
,Toast.LENGTH_SHORT).show();
}
});
btnSave.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//i think something need to do here
}
});