hi all.
i wanted to show my solution that works good but maybe there is something to notice so i will appreciate to any creative advice . is it good code or bad ?
i used interface to communicate between fragments
i deleted unnecessary codes and summarized it
private static final int REQUEST_CRIME = 0;
…
private abstract class GenericCrimeHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
…
public void onClick(View view) {
Intent intent = CrimeActivity.newIntent(getActivity(),mCrime.getId(),getLayoutPosition());
startActivityForResult(intent,REQUEST_CRIME);
}
}
…
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if(resultCode != Activity.RESULT_OK) {
return;
}
if(requestCode == REQUEST_CRIME) {
if(data == null) {
return;
}
int layoutPosition = CrimeActivity.resultDecodeToLayoutIdInt(data);
mAdapter.notifyItemChanged(layoutPosition);
}
}