android - how to open menu profile to relayted activity -
this code
textview product1 = new textview(this); product1.setclickable(true); product1.setonclicklistener(new onclicklistener() { @override public void onclick(view v) { if(v.gettag().tostring().equals("test")){ //toast.maketext(mainactivity.this, "hi", toast.length_long).show(); startactivity(new intent(mainactivity.this, testactivity.class)); } });
i have tag example profile how open tag want open no of tag using
if(v.gettag().tostring().equals("test")){ ----------- }
if did'nt wrong. can use switch statement achieve that.
switch (v.gettag().tostring()) { case "test": startactivity(new intent(mainactivity.this, testactivity.class)); break; case "profile": startactivity(new intent(mainactivity.this, registeractivity.class)); break; }
Comments
Post a Comment