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:
Alan Viverette
2015-03-25 19:03:21 +00:00
committed by Android Git Automerger

View File

@@ -16,6 +16,7 @@
package android.text.style;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
@@ -23,6 +24,7 @@ import android.os.Parcel;
import android.provider.Browser;
import android.text.ParcelableSpan;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
public class URLSpan extends ClickableSpan implements ParcelableSpan {
@@ -59,6 +61,10 @@ public class URLSpan extends ClickableSpan implements ParcelableSpan {
Context context = widget.getContext();
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
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());
}
}
}