I have class that extend FragmentActivity in it I add fragment to layout as following
public class maincontrolActivity extends FragmentActivity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.maincontrol);
oUnit fragment = new oUnit();
fragmentTransaction.add(R.id.mainLayout,fragment, "MY_FRAG");
fragmentTransaction.commit();
}
}
the Ounit is look like
public class oUnit extends Fragment {
View view = inflater.inflate(
R.layout.chemounit,
container,
false);
///// my other code
return view;
}
oCreateView in Ounit I try to add progress bar like
ProgressDialog connectionProgressDialog = new ProgressDialog( getActivity());
connectionProgressDialog.setCancelable(false);
connectionProgressDialog.setCanceledOnTouchOutside(false);
connectionProgressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
connectionProgressDialog.setMessage("Uploading Leads...");
connectionProgressDialog.show();
but it never show
I have in this fragement list I path to its constructor context using view.getContext()
I try to display AlertDialog
AlertDialog.Builder alert = new AlertDialog.Builder(v.getContext());
final EditText input = new EditText(v.getContext());
alert.setView(input);
alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
// Toast.makeText(getApplicationContext(), s_spin_text,
// Toast.LENGTH_SHORT).show();
}
});
alert.setNegativeButton("Cancel",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
dialog.cancel();
}
});
alert.show();
is this problems due to this line
View view = inflater.inflate(
R.layout.chemounit,
container,
false);
if yes ? how to replace it
Best regards
I think that to do this you should use: DialogFragment.
There you have method
OnCreateDialog()and there you can put your code: