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 7030441
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T00:40:16+00:00 2026-05-28T00:40:16+00:00

I am trying to get to the point where I have a Input (EditText)

  • 0

I am trying to get to the point where I have a Input (EditText) box in my Activity where users can input ther names. I need it so each time a name is inputed and the button “Add” is clicked it will save that name into a Array So that I can display them on the screen next to the Input (EditText) but also the user needs the ability to remove the last name they just added to the Array with a button that will appear next to the name once it has been added (so kind of needs to save them maybe?).

Also I need to be able to carry over the Array to the next Activity would I have to make it a global Array?

This is what I have so Far:

public class AddRemove extends Activity {

ArrayList<String> playerList = new ArrayList<String>();
String playerlist[];

@Override
protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.addremove);

    Button confirm = (Button) findViewById(R.id.confirm);
    confirm.setOnClickListener(new OnClickListener() {   
        public void onClick(View v) {
            final EditText playername = (EditText) findViewById(R.id.userinput);
            String name = playername.getText().toString();
            playerList.add(name); 


    }});

}
}

And the XML:

<EditText
    android:id="@+id/userinput"
    android:layout_width="190dp"
    android:layout_height="40dp"
    android:layout_alignParentLeft="true"
    android:layout_alignParentTop="true"
    android:layout_marginLeft="22dp"
    android:layout_marginTop="95dp"
    android:hint="Enter Name"
     >
    <requestFocus />
</EditText>

<Button
    android:id="@+id/confirm"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignLeft="@+id/userinput"
    android:layout_centerVertical="true"
    android:text="Add" />
  • 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-28T00:40:16+00:00Added an answer on May 28, 2026 at 12:40 am

    This is a very dense question, so I’ll try to summarize what you need to do and you can tell me if you need help doing any one thing.

    You would need to programmatically add views within the OnClick. In your case, a TextView and a Button. With the Button you just created, you would need to remove the TextView string from the playerList on its OnClickListener. You would also remove the View from it’s parent so the user no longer sees it.

    In order to pass an array over to the next Activity, you can use Bundle

    Intent i = new Intent( this, NewActivity.class );
    Bundle extras = new Bundle();
    extras.putSerializable( "com.example.playerList", playerList );
    i.putExtras( extras ); 
    startActivity( i );
    

    And to read the ArrayList from your new Activity

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Bundle extras = getIntent().getExtras();
        ArrayList<String> playerLIst = extras.getSerializable( "com.example.playerList" );
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an Activity which lets the user input names and the save them.
I'm trying to get 4x6 cards to print in Cocoa (story cards). I have
We're trying to get a conditional attribute to work, case in point, there's a
Trying to get comfortable with jQuery and I have encountered some sample code that
I'm trying to get only the selected part of an input string that was
Well I'm having a hell of a time trying to get my CPU down
I'm trying (yet again) to get better at programming, this time in python, and
I am trying to get input from the user at the command prompt. The
Ramble : I have been goggling for the past ~week trying to get information
I am trying to check character-by-character so I need to get access to one

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.