Note that there are some explanatory texts on larger screens.

plurals
  1. PODont know where to add new activity
    primarykey
    data
    text
    <p>Although there are numrous examples of this problem on this forum, I still cant find the appropriate place to start a new Activity.</p> <p>Heres my code:</p> <pre><code>public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.screen1); final EditText milein = (EditText) findViewById(R.id.milein); final EditText zipin = (EditText) findViewById(R.id.zipin); final EditText mileout = (EditText) findViewById(R.id.mileout); final EditText zipout = (EditText) findViewById(R.id.zipout); final ToggleButton checkinbutton = (ToggleButton) findViewById(R.id.checkinbutton); final Button submit = (Button) findViewById(R.id.submit); /** Boolean for Sharedpreferences */ final SharedPreferences preferences = getPreferences(MODE_PRIVATE); boolean tgpref = preferences.getBoolean("tgpref", false); checkinbutton.setChecked(tgpref); /** ToggleButton Check-IN */ checkinbutton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (checkinbutton.isChecked()) { milein.setVisibility(View.VISIBLE); zipin.setVisibility(View.VISIBLE); mileout.setVisibility(View.GONE); zipout.setVisibility(View.GONE); submit.setVisibility(View.VISIBLE); SharedPreferences.Editor editor = preferences.edit(); /** * &lt;-- Boolean Preferences for Checkinbutton ToggleButton * Checked */ editor.putBoolean("tgpref", true); editor.commit(); } else { milein.setVisibility(View.GONE); zipin.setVisibility(View.GONE); mileout.setVisibility(View.VISIBLE); zipout.setVisibility(View.VISIBLE); submit.setVisibility(View.VISIBLE); SharedPreferences.Editor editor = preferences.edit(); /** * &lt;-- Boolean Preferences for Checkinbutton ToggleButton * UnChecked */ editor.putBoolean("tgpref", false); editor.commit(); /** AlertDialog Button Configurations */ final AlertDialog alertDialog = new AlertDialog.Builder( screen1.this).create(); alertDialog.setMessage("Check-Out?"); alertDialog.setButton("Yes", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { } }); alertDialog.setButton2("No", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { checkinbutton.setChecked(true); milein.setVisibility(View.VISIBLE); zipin.setVisibility(View.VISIBLE); mileout.setVisibility(View.GONE); zipout.setVisibility(View.GONE); } }); alertDialog.show(); } }; }); } public void onClick(View v) { } } </code></pre> <p>Ive tried to implement a new screen activity just about everywhere but still cant quite get it. any help on suggesting where it should go would be MUCH appreciated.</p> <p>Thanks.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload