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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T18:16:43+00:00 2026-05-20T18:16:43+00:00

I am working on a storage handling application(real storage). My app. is calling on

  • 0

I am working on a storage handling application(real storage). My app. is calling on button push the ZXing barcode reader, after scaning the code, a new activity(window) pops up. Where i can read the scanned code, and i can put in an amount(how much i want from that product). I got there a next and a finish button, on the finish button i go back to the main window. On the next button, the ZXing is called again, i scan the result window pops up , amount input and so on so on… Now to the question, i am going to store the scannedcode+amount in an array. So i can display them in a ListView. I got this:

String[] names = new String[] { "Linux", "Windows7", "Eclipse", "Suse", "Ubuntu", "Solaris", "Android", "iPhone"};

so i know thats how i make an array with data and thats how i display it:

this.setListAdapter(new ArrayAdapter<String>(this,android.R.layout.simple_list_item_checked, product));

I would like to know how i do an empty array, and how i can add new string to it when ever i push the Next button, i will pass the array with bundle between the activitys. So thats it. Uhm and yea is it possible to edit a specific part of the array, cause thats the reason of the list where i show the array to the user, so he can go for example on the Eclipse row, click it and he can write in Android and save.

I hope some one can help or give me some hint on both problems. Thank you in front.

  • 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-20T18:16:43+00:00Added an answer on May 20, 2026 at 6:16 pm

    You’d be more flexible if instead you used an ArrayList. You don’t need to change the ArrayAdapter part because it has a constructor that works with ArrayLists.

    See the doc here: http://developer.android.com/reference/java/util/ArrayList.html

    ArrayList allows you to replace, append, and remove as many elements as you want without worrying about reallocating your array or any other low level operation you’d need to do if you’d implemented your own data structure.

    Here’s an entire example that I was playing with the other day:

    import java.util.ArrayList;
    import android.app.Activity;
    import android.os.Bundle;
    import android.view.KeyEvent;
    import android.view.View;
    import android.view.View.OnKeyListener;
    import android.widget.ArrayAdapter;
    import android.widget.EditText;
    import android.widget.ListView;
    
    public class TODOActivity extends Activity {
        /** Called when the activity is first created. */
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.main);
    
            // Get a handle to the ListView and hook it up to the todoList via the
            // adapter.
            ListView myListView = (ListView) findViewById(R.id.myListView);
            final ArrayList<String> todoList = new ArrayList<String>();
            final ArrayAdapter<String> todoListAdapter = new ArrayAdapter<String>(
                    this, android.R.layout.simple_list_item_1, todoList);
            myListView.setAdapter(todoListAdapter);
            todoList.
            // Get a handle to the EditText and set a key listener to enter text.
            // with the dpad or enter key.
            final EditText myEditText = (EditText) findViewById(R.id.myEditText);
            myEditText.setOnKeyListener(new OnKeyListener() {
                public boolean onKey(View v, int keyCode, KeyEvent event) {
                    if (event.getAction() == KeyEvent.ACTION_DOWN
                            && (keyCode == KeyEvent.KEYCODE_DPAD_CENTER
                                    || keyCode == KeyEvent.KEYCODE_ENTER))  {
                        todoList.add(0, myEditText.getText().toString());
                        todoListAdapter.notifyDataSetChanged();
                        myEditText.setText("");
                        return true;    // consume event
                    }
                    // TODO Auto-generated method stub
                    return false;
                }
            });
    
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a way to programmatically disable usb storage devices from working while still
Working in Eclipse on a Dynamic Web Project (using Tomcat (v5.5) as the app
Working with an Oracle 9i database from an ASP.NET 2.0 (VB) application using OLEDB.
I'm in the middle of working on my first native application with networking and
If you are handling all your own licensing(working under a BizSpark license), is it
I'm working on designing a multi-tiered app in Perl and I'm wondering about the
I am working in one real-estate website and I have large database around 250
For my understanding there are always two types of memory: the working storage the
Working with dates in ruby and rails on windows, I'm having problems with pre-epoch
Working with a SqlCommand in C# I've created a query that contains a IN

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.