android - How can i pass a string value, that has been created in an if statement, through a bundle inside another if statement? -


public class mainactivity extends activity implements onclicklistener, adapterview.onitemselectedlistener, oncheckedchangelistener{  @override public void oncreate(bundle icicle) {     super.oncreate(icicle);     setcontentview(r.layout.main);      //declare variables used     final bundle bundle = new bundle();     final checkbox checkbox01 = (checkbox) findviewbyid(r.id.checkbox01);       //all if statements builds     final button findbuilds = (button) findviewbyid(r.id.btn_findbuildstab1);{         findbuilds.setonclicklistener(new view.onclicklistener() {             public void onclick(view v) {                  if ((v==findbuilds)&&(checkbox01.gettext()==("ahri-ap"))&&((checkbox01).ischecked())){                      final string charactername = "ahri-ap";                  }                  if ((checkbox01).ischecked(){                    //all bundles placed here                      bundle.putstring("charactername value key", charactername);                     //start tabhost activity , pass bundle(s)                      intent nextactivity = new intent(v.getcontext(),                      nextactivity.putextras(bundle);                      startactivity(nextactivity); tabhostactivity.class);                  } 

basically, trying create string character's name in first if-statement, , bundle in if-statement. reason need bundle string(s) in different if-statement avoid reaching bytes limit of method. have total of 64 different strings need bundled each if-statement, , have total of 126 if-statements need happen. problem of course string variable never found or resolved bundle in 2nd if-statement. there way this? or maybe more efficient way? in advance help! :)

just pull definition of variable outside of if statement. eg:

final string charactername  if() {     charactername = ... } if() {     bundle stuff charactername  } 

Comments

Popular posts from this blog

jquery - Invalid Assignment Left-Hand Side -

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -