Example usage for android.content Intent setTypeAndNormalize

List of usage examples for android.content Intent setTypeAndNormalize

Introduction

In this page you can find the example usage for android.content Intent setTypeAndNormalize.

Prototype

public @NonNull Intent setTypeAndNormalize(@Nullable String type) 

Source Link

Document

Normalize and set an explicit MIME data type.

Usage

From source file:com.afwsamples.testdpc.common.Util.java

public static void showFileViewerForImportingCertificate(PreferenceFragment fragment, int requestCode) {
    Intent certIntent = new Intent(Intent.ACTION_GET_CONTENT);
    certIntent.setTypeAndNormalize("*/*");
    try {/*ww  w  .j ava  2 s  .  c  o m*/
        fragment.startActivityForResult(certIntent, requestCode);
    } catch (ActivityNotFoundException e) {
        Log.e(TAG, "showFileViewerForImportingCertificate: ", e);
    }
}

From source file:com.afwsamples.testdpc.policy.PolicyManagementFragment.java

/**
 * Shows the file viewer for importing a certificate.
 *///  w w w . j ava  2  s. c  o m
private void showFileViewerForImportingCertificate(int requestCode) {
    Intent certIntent = new Intent(Intent.ACTION_GET_CONTENT);
    certIntent.setTypeAndNormalize("*/*");
    try {
        startActivityForResult(certIntent, requestCode);
    } catch (ActivityNotFoundException e) {
        Log.e(TAG, "showFileViewerForImportingCertificate: ", e);
    }
}