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

  • Home
  • SEARCH
  • 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 6552155
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:25:33+00:00 2026-05-25T12:25:33+00:00

I am making an android app in which the user needs to add information.

  • 0

I am making an android app in which the user needs to add information. I want if the user left any blank field and clicks on the button the same activity in which other fields were filled should be started.

I am using intents for this and able to start the activity again but all the fields get emptied.
How can I do this with intent.

Thanks

  public void onCreate(Bundle savedInstanceState)
    {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.register);


    Register=(ImageButton)findViewById(R.id.register);
    Reset=(ImageButton)findViewById(R.id.reset);

    firstName=(EditText)findViewById(R.id.firstName);
    surName=(EditText)findViewById(R.id.surname);
    email=(EditText)findViewById(R.id.eMAil);
    password=(EditText)findViewById(R.id.passWord);
    retypePassword=(EditText)findViewById(R.id.retypePassword);
    town=(EditText)findViewById(R.id.town);
    cellno=(EditText)findViewById(R.id.cellno);
    dateOfBirth=(Button)findViewById(R.id.datepickerbutton);         
 Register.setOnClickListener(clickRegisterListener);

  private OnClickListener clickRegisterListener = new OnClickListener() {
    public void onClick(View v)
    {
         try{
                FirstName=firstName.getText().toString();
                SurName=surName.getText().toString();
                sex.setOnItemSelectedListener(new            MyOnItemSelectedListener());
                Email=email.getText().toString();
                Password=password.getText().toString();
                RetypePassword=retypePassword.getText().toString();
                Town=town.getText().toString();
                Cellno=cellno.getText().toString();

                if(FirstName.equals(""))
                {
                    AlertDialog.Builder alertbox = new AlertDialog.Builder(Register.this);
                    alertbox.setMessage("First Name field can not be left empty!");
                    alertbox.setNeutralButton("Ok", new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface arg0, int arg1)
                        {

                        Intent intent = new Intent(Register.this, Register.class);
                       //   onSaveInstanceState(bundle);
                        startActivity(intent);
                        }
                      });
                    alertbox.show();
                }
  • 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-25T12:25:34+00:00Added an answer on May 25, 2026 at 12:25 pm

    What you need to do is pass all information that you want displayed to the activity with the intent. When you create your intent you “put extra” information in the intent.

    Intent i = new Intent(this, OtherActivity.class);
    i.putExtra("variableName", "variable value");
    

    Then in the activity you can retrieve the information:

    Bundle extras = this.getIntent().getExtras(); 
    String var = extras.getString("variableName");
    

    Edit:

    If you want to save the activity state when it is is paused you need to save the variables of interest in the onPause() method and then recover them in the onResume() method

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

Sidebar

Related Questions

I am making an android app in which i want to make a dynamic
i am making a app which takes photo on button click i have camera.java
I am making an android app in which I need to make different tables
I am making an android database app in which when i fetch values from
I am mking an android app in which i am making dynamically table rows
We are in the making of an Android app, a quiz game, which we
I am making an android app which will have two services that will keep
i am making the app in which user will be able to c the
I’m making an android app, which uses Google maps. One functionality is that the
So I'm making this android application, that needs to read data from user-provided CSV

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.