android - How can I call an URL when I use setContentView()? -


i developed simple game , want give external url web page. problem that, i'm using setcontentview in oncreate method of main activity. game content dynamic , cannot use intents instead of setcontentview. however, know, oncreate called once , way found on web call url "using intents". not working because setcontentview thing running. here codes:

gameactivity.java

private static gamecontent gamecontent;  @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);      gamecontent = new gamecontent(this);     setcontentview(gamecontent);  } // on.c.ends 

my gamecontent class extends surfaceview , runnable. call draw(), pause() , resume() methods here. have class basicbutton , added gamecontent , draw it. works. here part want use:

basicbutton.java

@override public void update() {      if (xx > (rate.getx()) && xx < (rate.getx() + rate.getplaybutton('x')))         if (yy > (rate.gety()) && yy < (rate.gety() + rate.getplaybutton('y'))) {             userinput.setxy(0, 0);             if (userinput.getaction() == true) {                 // want add code here open web page             } // fi         } // fi  } // update ends 

my solution create boolean in gameactivity , change basicbutton class , using intent , startactivity, open web page. not working.

do have suggestion?

you can't. setcontentview works pre-compiled xml files in apk. can't write new 1 on fly , call setcontentview on it. don't think understand setcontentview does.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -