android - Multiple layout in one Tabactivity -


how few layout , require create in 1 tabactivity.

i have try code below no luck got error.

    tabhost.addtab(tabhost.newtabspec("sales order").setindicator("sales order").setcontent(r.layout.frm_txn_so_item_list)); 

ok let me explain clearly.

i have code below, can see have 4 tab layout page. each of has own activity class. have button belong cls_so_item_list.class, whenever try call in cls_so return me null value.

so have come out idea, remove tab page(item,product,summary,report) activity classes create 1 standalone class cls_so.

my question how put layout page inside tabhost.addtab? thanks

public class cls_so extends tabactivity implements onclicklistener {     protected tabhost tabhost;      int intsalesorderid;     src_txn_so.cls_so_obj objsalesorder;     static final string list_id = "list_id";      @override     public void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);          tabhost = gettabhost();          newtabintent("item", null, cls_so_item_list.class);         newtabintent("product",                 getresources().getdrawable(r.drawable.so_product),                 cls_so_prd_list.class);         newtabintent("summary",                 getresources().getdrawable(r.drawable.so_summary),                 cls_so_summary.class);         newtabintent("report",                 getresources().getdrawable(r.drawable.so_report),                 cls_so_summary.class);           button btnsolinediscount = (button) findviewbyid(r.id.txn_so_btn_line_discount);         btnsolinediscount.setonclicklistener(this);          tabhost.setcurrenttab(0);     }      protected void newtabintent(string label, drawable icon, class<?> pageclass) {         tabspec tabspec = tabhost.newtabspec(label);         tabspec.setindicator(label, icon);          intent sointent = new intent().setclass(this,pageclass);         sointent.putextra(list_id, -1);          tabspec.setcontent(new intent(this, pageclass));         tabhost.addtab(tabspec);     }      @override     public void onclick(view v) {         // todo auto-generated method stub      }   } 

it doesn't work that. in main layout, add in framelayout id of tabcontent element <include> points on layout.

in code you'll have change to.

tabhost.addtab(tabhost.newtabspec("sales order").setindicator("sales order").setcontent(r.id.my_included_layout)); 

if you're <include> has id "@+id/my_included_layout"


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -