I have my custom RecyclerView to create a ListView. And it works great, when I am trying to populate a list view in my layout's id.
FragmentTransaction ft = getFragmentManager().beginTransaction();
Bundle bundle = new Bundle();
bundle.putBoolean("enablePullToRefresh", false);
GridValues gridValues = new GridValues();
gridValues.rowViewLayout = R.layout.my_detail_row_view;
gridValues.delegate = this;
mygrid = new CustomGridView(gridValues, bundle);
mygrid.showAsGrid = true;
mygrid.spanCount = 2;
mygrid.layoutOrientation = LinearLayoutManager.VERTICAL;
mygrid.noRowColor = true;
mygrid.gridName = "mygrid";
mygrid.setArguments(mygrid.bundle);
ft.replace(R.id.MyGridContainer, mygrid);
Now, I would like to populate a new list inside a dialog. How can I do that?
I tried this, Having mygrid as static
public static class MyDialogFragment extends DialogFragment {
static MyDialogFragment newInstance() {
return new MyDialogFragment();
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return mygrid.getView();
}
}
And then,
FragmentTransaction ft = getFragmentManager().beginTransaction();
DialogFragment newFragment = MyDialogFragment.newInstance();
ft.add(R.id.MyGridContainer, newFragment);
//getView().findViewById(R.id.MyGridContainer).setVisibility(View.VISIBLE);
ft.commit();