I have these codes in my project:
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) {
int intPos = getArguments().getInt(ARG_SECTION_NUMBER);
View rootView;
rootView = inflater.inflate(R.layout.fragment_main, container,false);
TableLayout ll = (TableLayout) rootView.findViewById(R.id.tableLayoutList);
View mTableRow = null;
Typeface tf = Typeface.createFromAsset(getActivity().getAssets(), "fonts/Far_DastNevis.otf");
for (int i =1; i <= 2000; ++i)
{
mTableRow = (TableRow) View.inflate(getActivity(), R.layout.mrowrayout, null);
final TextView txtBody = (TextView)mTableRow.findViewById(R.id.txtItem);
txtBody.setText("Some Text" + i);
txtBody.setId(i);
txtBody.setTypeface(tf);
mTableRow.setTag(i);
ll.addView(mTableRow);
}
return rootView;
}
It needs some seconds (or minutes) to load and I wanna show process dialog or something like this to users until it load. But I can't use process dialog in onCreateView. Please help me guys.