我想在 RecyclerView.Adapter 中使用onActivityResult。但我不明白这个释放在我的情况下是如何进行的。我有一个动态 RecyclerView.Adapter
public class SettingsActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.layout_settings);
ArrayList<SettingsTypeModel> list= new ArrayList<>();
list.add(new SettingsTypeModel(SettingsTypeModel.TYPE_SEND_TO_MAIL));
list.add(new SettingsTypeModel(SettingsTypeModel.TYPE_SEND_TO_DRIVE));
SettingsRecyclerAdapter adapter = new SettingsRecyclerAdapter(list,this);
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this, OrientationHelper.VERTICAL, false);
RecyclerView mRecyclerView = (RecyclerView) findViewById(R.id.recyclerVieww);
mRecyclerView.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL));
mRecyclerView.setLayoutManager(linearLayoutManager);
mRecyclerView.setItemAnimator(new DefaultItemAnimator());
mRecyclerView.setClickable(true);
mRecyclerView.setAdapter(adapter);
}
public void onActivityResult(final int requestCode, final int resultCode, final Intent data) {
super.onActivityResult(requestCode, resultCode, data);
}
@Override
protected void onDestroy() {
super.onDestroy();
}
@Override
public void onBackPressed() {
super.onBackPressed();
}
}
单击switchSendMailReport或 switchDriveReport 后,我需要调用函数onActivityResult。
如何在RecyclerView.Adapter中使用onActivityResult?
慕运维8079593
慕仙森
相关分类