Android loading different contents in the same screen but different activities -


i new android , facing problem in calling different activities same screen same user interface. want implement d functionality of tab activity instead of tabs providing buttons , buttons should act tabs. unable that. going wrong where. can me please..... homescreen class is:

public class homescreen extends activity implements onitemclicklistener {     public integer[] images = { r.raw.mobile, r.raw.note_books, r.raw.ac,             r.raw.drivers, r.raw.camera, r.raw.home_theaters, r.raw.pda,             r.raw.tv, r.raw.washing_machines, r.raw.scanners };      @override     public void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.grid);         gridview gv = (gridview) findviewbyid(r.id.gridv);         layoutinflater inflater = getlayoutinflater();          gv.setadapter(new gridviewadapter(images, inflater));         gv.setonitemclicklistener(this);          if (staticutils.scheckstatus){             parsedata();         }     }      @override     public void onitemclick(adapterview<?> arg0, view arg1, int arg2, long arg3) {         intent contents = new intent(homescreen.this, cat.class);         contents.putextra("homescreen", arg2);         startactivity(contents);     } 

cat.class this:

class cat extends activity implements onclicklistener{     private button mbtncontents, mbtnbrand, mbtncategory, mbtnback;     @override     public void oncreate(bundle si){         super.oncreate(si);         setcontentview(r.layout.gridtab);         int = getintent().getintextra("homescreen", 0);         mbtncontents=(button) findviewbyid(r.id.btncontents);         mbtncontents.setonclicklistener(this);          mbtnbrand=(button) findviewbyid(r.id.btnbrand);         mbtnbrand.setonclicklistener(this);          mbtncategory=(button) findviewbyid(r.id.btncategory);         mbtncategory.setonclicklistener(this);          mbtnback=(button) findviewbyid(r.id.btnback);         mbtnback.setonclicklistener(this);      }     @override     public void onclick(view v) {         if(v==mbtncontents){             int = getintent().getintextra("homescreen", 0);             intent in=new intent(cat.this, pc.class);             in.putextra("homescreen", i);             startactivity(in);         } else if(v==mbtnbrand){             startactivity(new intent(cat.this, sd.class));         } else if(v==mbtncategory){             startactivity(new intent(cat.this, sbc.class));         } else if(v==mbtnback){             startactivity(new intent(cat.this, hs.class));         }      } } 

when click on contents button displaying details when click on other buttons not showing anythng

instead of "v==mbtncontents" use "v.equals(mbtncontents)" because view object.


Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -