am 7506f499: Merge "Fix to crash when clicking text link without view activity"
* commit '7506f499b523d05c6bca5acb6d83f55820d33771': Fix to crash when clicking text link without view activity
This commit is contained in:
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package android.text.style;
|
package android.text.style;
|
||||||
|
|
||||||
|
import android.content.ActivityNotFoundException;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
@@ -23,6 +24,7 @@ import android.os.Parcel;
|
|||||||
import android.provider.Browser;
|
import android.provider.Browser;
|
||||||
import android.text.ParcelableSpan;
|
import android.text.ParcelableSpan;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
public class URLSpan extends ClickableSpan implements ParcelableSpan {
|
public class URLSpan extends ClickableSpan implements ParcelableSpan {
|
||||||
@@ -59,6 +61,10 @@ public class URLSpan extends ClickableSpan implements ParcelableSpan {
|
|||||||
Context context = widget.getContext();
|
Context context = widget.getContext();
|
||||||
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
|
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
|
||||||
intent.putExtra(Browser.EXTRA_APPLICATION_ID, context.getPackageName());
|
intent.putExtra(Browser.EXTRA_APPLICATION_ID, context.getPackageName());
|
||||||
context.startActivity(intent);
|
try {
|
||||||
|
context.startActivity(intent);
|
||||||
|
} catch (ActivityNotFoundException e) {
|
||||||
|
Log.w("URLSpan", "Actvity was not found for intent, " + intent.toString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user