mirror of
https://github.com/CatimaLoyalty/Android.git
synced 2026-01-07 22:47:59 -05:00
Fix a crash when there's no web browser installed
Signed-off-by: Alexander Ivanov <vanogrid@gmail.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package protect.card_locker;
|
||||
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
@@ -9,6 +10,7 @@ import android.util.Log;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
@@ -166,7 +168,12 @@ public class AboutActivity extends CatimaAppCompatActivity implements View.OnCli
|
||||
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||
intent.setData(Uri.parse(url));
|
||||
startActivity(intent);
|
||||
try {
|
||||
startActivity(intent);
|
||||
} catch (ActivityNotFoundException e) {
|
||||
Toast.makeText(this, R.string.failedToOpenUrl, Toast.LENGTH_LONG).show();
|
||||
Log.e(TAG, "No activity found to handle intent", e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -247,4 +247,5 @@
|
||||
</plurals>
|
||||
<string name="previousCard">Предишна</string>
|
||||
<string name="nextCard">Следваща</string>
|
||||
<string name="failedToOpenUrl">Първо инсталирайте уеб браузър</string>
|
||||
</resources>
|
||||
@@ -292,4 +292,5 @@
|
||||
</plurals>
|
||||
<string name="previousCard">Previous</string>
|
||||
<string name="nextCard">Next</string>
|
||||
<string name="failedToOpenUrl">Install a web browser first</string>
|
||||
</resources>
|
||||
|
||||
Reference in New Issue
Block a user