I am trying to load BROWSER VIEW intent in android within onTouchEvent. Basically i have create a live wallpaper and if i click on it then i want to open BROWSER VIEW intent with a specified uri.
i have tried following code inside onTouchEvent
Uri uri = Uri.parse("http://www.google.com");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
but i am getting following error
I am trying to load BROWSER VIEW intent in android within onTouchEvent. Basically i have create a live wallpaper and if i click on it then i want to open BROWSER VIEW intent with a specified uri.
i have tried following code inside onTouchEvent
Uri uri = Uri.parse("http://www.google.com");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
but i am getting following error
android.util.AndroidRuntimeException: Calling startActivity() from outside of
an Activitycontext requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?
another apporch is that i have create one activity and inside its onCreate function i tried following code
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
browser=new WebView(this);
setContentView(browser);
browser.loadUrl("http://commonsware.com");
}
and tried to load this activity via custom intent message as follows , but still i am getting the same error
Intent intent = new Intent(ACTION);
startActivity(intent);
// over here i have not used context as while creating live wallpaer i don't know here to get
// the context