I am using Toggle button
to call other activity
, and using code which we use with normal android button to call another activity like this:
toggleButton.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton arg0, boolean isChecked) {
textMap.setText("Status: " + isChecked);
String strMapStatus = textMap.getText().toString();
Toast.makeText(TrackerActivity.this, strMapStatus, Toast.LENGTH_LONG).show();
if(strMapStatus.equalsIgnoreCase("true"))
{
Bundle bundle = new Bundle();
bundle.putSerializable("viewall",arrayList);
Intent sendtosecond = new Intent(TrackerActivity.this, MapActivity.class);
sendtosecond.putExtra("bundle", bundle);
startActivity(sendtosecond);
}
}
});
I am getting Check status as "true" and "false" in Toast
but unable to call MapActivity
replace
if(strMapStatus.equalsIgnoreCase("true"))
to
if(isChecked)