Ecplise - Android Add a button with code -


i´m trying add button screen can´t seem work. code:

    public class graph extends activity {  @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     bundle values = getintent().getextras();     float value1 = values.getfloat("value1");     float value2 = values.getfloat("value2");     float value3 = values.getfloat("value3");     float value4 = values.getfloat("value4");     float value5 = values.getfloat("value5");     system.out.println(values);     setcontentview(new graphview(this, value1, value2, value3, value4, value5));     // guess it´s here add button? }  @override public boolean oncreateoptionsmenu(menu menu) {     // inflate menu; adds items action bar if present.     getmenuinflater().inflate(r.menu.activity_graph, menu);     return true; } } 

i not know how can add button because use code

     setcontentview(new graphview(this, value1, value2, value3, value4, value5)); 

thank help.

first need define want add button. if want add bellow graphview this

linearlayout ll = new linearlayout(this); ll.addview(new graphview(this, value1, value2, value3, value4, value5); button button = new button(this); button.settext("button text"); ll.addview(button); setcontentview(ll); 

hope helps , enjoy work.


Comments

Popular posts from this blog

.htaccess - First slash is removed after domain when entering a webpage in the browser -

Automatically create pages in phpfox -

c# - Farseer ContactListener is not working -