android: Crudely catch exception if no file browser is available
Seen on Android TV in the emulator.
This commit is contained in:
parent
064c97afae
commit
b1b626a1e3
|
@ -18,6 +18,7 @@ package org.strongswan.android.ui;
|
|||
import android.annotation.TargetApi;
|
||||
import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
|
@ -76,7 +77,15 @@ public class TrustedCertificateImportActivity extends AppCompatActivity
|
|||
Intent openIntent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
|
||||
openIntent.setType("*/*");
|
||||
openIntent.putExtra(Intent.EXTRA_MIME_TYPES, ACCEPTED_MIME_TYPES);
|
||||
startActivityForResult(openIntent, OPEN_DOCUMENT);
|
||||
try
|
||||
{
|
||||
startActivityForResult(openIntent, OPEN_DOCUMENT);
|
||||
}
|
||||
catch (ActivityNotFoundException e)
|
||||
{ /* some devices are unable to browse for files */
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ package org.strongswan.android.ui;
|
|||
|
||||
import android.app.Activity;
|
||||
import android.app.LoaderManager;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.AsyncTaskLoader;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
|
@ -64,7 +65,6 @@ import java.io.ByteArrayOutputStream;
|
|||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.lang.OutOfMemoryError;
|
||||
import java.net.URL;
|
||||
import java.net.UnknownHostException;
|
||||
import java.security.KeyStore;
|
||||
|
@ -212,7 +212,15 @@ public class VpnProfileImportActivity extends AppCompatActivity
|
|||
{
|
||||
Intent openIntent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
|
||||
openIntent.setType("*/*");
|
||||
startActivityForResult(openIntent, OPEN_DOCUMENT);
|
||||
try
|
||||
{
|
||||
startActivityForResult(openIntent, OPEN_DOCUMENT);
|
||||
}
|
||||
catch (ActivityNotFoundException e)
|
||||
{ /* some devices are unable to browse for files */
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (savedInstanceState != null)
|
||||
|
|
Loading…
Reference in New Issue