Skip to content

Commit

Permalink
Fixed issue with certificate loading
Browse files Browse the repository at this point in the history
  • Loading branch information
devgianlu committed Mar 17, 2019
1 parent 71bf7e9 commit 839ed16
Showing 1 changed file with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;

public class CertificateInputView extends LinearLayout {
Expand Down Expand Up @@ -98,12 +99,14 @@ void showPicker() {
AskPermission.ask(activity, Manifest.permission.READ_EXTERNAL_STORAGE, new AskPermission.Listener() {
@Override
public void permissionGranted(@NonNull String permission) {
try {
activity.startActivityForResult(Intent.createChooser(new Intent(Intent.ACTION_GET_CONTENT)
.setType("*/*")
.addCategory(Intent.CATEGORY_OPENABLE), "Select the certificate"), CODE_PICK_CERT);
} catch (ActivityNotFoundException ex) {
Logging.log(ex);
if (activityProvider instanceof Fragment) {
try {
((Fragment) activityProvider).startActivityForResult(
Intent.createChooser(new Intent(Intent.ACTION_GET_CONTENT).setType("*/*")
.addCategory(Intent.CATEGORY_OPENABLE), "Select the certificate"), CODE_PICK_CERT);
} catch (ActivityNotFoundException ex) {
Logging.log(ex);
}
}
}

Expand Down

0 comments on commit 839ed16

Please sign in to comment.