Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7531369
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T05:09:08+00:00 2026-05-30T05:09:08+00:00

Although there are numrous examples of this problem on this forum, I still cant

  • 0

Although there are numrous examples of this problem on this forum, I still cant find the appropriate place to start a new Activity.

Heres my 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();
                /**
                 * <-- 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();
                /**
                 * <-- 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) {

    }

}

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.

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T05:09:10+00:00Added an answer on May 30, 2026 at 5:09 am

    I’m guessing you want to change activities at the end of your onClick methods. You’ll actually want to include two, one at the end of each conditional in your onClick method.

    At the end of the condition, just add this code:

    startActivity(new Intent(CurrentActivity.this, NewActivity.class));
    CurrentActivity.this.finish();
    

    Also, make sure you add you new activity to your Manifest file:

    <activity
        android:name=".NewActivity"
        android:label="@string/newActivityTitle" >
    </activity>
    

    Once your code gets to the end of each conditional, if the new activity is setup right, the new activity should take over.

    db

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Although there are a lot of jquery autocomplete code in this forum. However I
I couldn't find a duplicate for this question for Java, although there are a
Although there are some tutorials on web, I'm still lost on why this doesn't
I couldn't find a definitive answer to this in the docs, and although there
Although there's an answer to this question here the circumstances are different however. For
Although there are still bots harvesting emails, I'm wondering if you hide email addresses
Although there are some threads on here about .net charting controls, I'm starting new
Although there are already a few resources online that address this rough topic, I
Although there are a lot of posts about .net config files, I believe that
Although there are some similar questions I’m having difficulties finding an answer on how

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.