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 to be used
final Bundle bundle = new Bundle();
final CheckBox checkbox01 = (CheckBox) findViewById(R.id.CheckBox01);
//All if statements for 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 are placed here
bundle.putString("CharacterName Value Key", charactername);
//Start Tabhost Activity and pass bundle(s)
Intent nextActivity = new Intent(v.getContext(),
nextActivity.putExtras(bundle);
startActivity(nextActivity); TabHostActivity.class);
}
基本上,我要做的是在第一个 if 语句中为角色名称创建字符串,然后将其捆绑在另一个 if 语句中。我需要将字符串捆绑在不同的 if 语句中的原因是为了避免达到方法的字节限制。我总共需要为每个 if 语句捆绑 64 个不同的字符串,并且我总共需要发生 126 个 if 语句。问题当然是在第二个 if 语句中的捆绑包中永远找不到或解决 String 变量。有没有办法做到这一点?或者也许是更有效的方法?在此先感谢您的帮助!:)