I have a tab activity. 1 of its tab it contains a listView which contains fragment items. I have a button on these list items (which are fragments), and I want whenerver I click it to show a popup window. Unfortunatly I can see the popup, and I assume it's because the display ot the list item is too small. I would actually like to see it on the activity which contains the list.
Any ideas?
edit: The dialog:
public class CancelRunPupUp extends DialogFragment {
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setTitle(getResources().getString(R.string.cancelRunTitle))
.setMessage(getResources().getString(R.string.AreYouSure))
.setPositiveButton(getResources().getString(R.string.yes), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
})
.setNegativeButton(getResources().getString(R.string.no), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
AlertDialog dialog = builder.create();
dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
return dialog;
}
}
The button which calls this dialog:
In public class RowInHomeTab extends Fragment:
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
// Inflate the layout for this fragment
view = inflater.inflate(R.layout.fragment_row_in_home_tab, container, false);
ImageButton cancelRun = (ImageButton) view.findViewById(R.id.cancelRunButton);
cancelRun.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
CancelRunPupUp dialog = new CancelRunPupUp();
dialog.show(getFragmentManager(), "cancelRunDialog");
}
});
return view;
}
RowInHomeTab is an item in a listView which is placed in a tabActivity.