Redirect user once app is opened - Android -


i working on android app , want happen simply, when user select's app open browser specified webpage. right have following on oncreate:

intent viewintent =                 new intent("android.intent.action.view",                   uri.parse("http://www.stackoverflow.com/"));                 startactivity(viewintent); 

the problem is, when app first loads works once try clicking on again , such, opens app. trying figure out how make that, whenever app opened redirect user , close app.

suggestions , ideas?

update:

here resume() function placed on top see happen, seems work tells me has stopped working , opens web browser.

@override     protected void onresume() {         //start new activity         intent viewintent =                 new intent("android.intent.action.view",                   uri.parse("http://www.stackoverflow.com/"));                 startactivity(viewintent);     } 

try finish app after launching intent. might want spawn new task too.

protected void onresume() {   super.onresume();   intent viewintent = new intent("android.intent.action.view", uri.parse("http://www.stackoverflow.com/"));   viewintent.addflags(intent.flag_activity_new_task);   startactivity(viewintent);   finish(); } 

Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -