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
Post a Comment