Example usage for android.app AlertDialog setOwnerActivity

List of usage examples for android.app AlertDialog setOwnerActivity

Introduction

In this page you can find the example usage for android.app AlertDialog setOwnerActivity.

Prototype

public final void setOwnerActivity(@NonNull Activity activity) 

Source Link

Document

Sets the Activity that owns this dialog.

Usage

From source file:com.aujur.ebookreader.activity.ReadingFragment.java

private void showPickProgressDialog(final List<BookProgress> results) {

    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    builder.setTitle(getString(R.string.cloud_bm));

    ProgressListAdapter adapter = new ProgressListAdapter(context, bookView, results);
    builder.setAdapter(adapter, adapter);

    AlertDialog dialog = builder.create();
    dialog.setOwnerActivity(getActivity());
    dialog.show();/*from  ww w .j av a2s .co m*/
}

From source file:com.aujur.ebookreader.activity.ReadingFragment.java

private void showSearchResultDialog(final List<SearchResult> results) {

    if (isSearchResultsDialogShowing) {
        return;/*from   w  w  w  . j  av  a 2  s.  c  o m*/
    }

    isSearchResultsDialogShowing = true;

    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    builder.setTitle(R.string.search_results);

    SearchResultAdapter adapter = new SearchResultAdapter(context, bookView, results);
    builder.setAdapter(adapter, adapter);

    AlertDialog dialog = builder.create();
    dialog.setOwnerActivity(getActivity());
    dialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
        @Override
        public void onDismiss(DialogInterface dialogInterface) {
            isSearchResultsDialogShowing = false;
        }
    });
    dialog.show();
}