0

I have this code of arraylist:

public List<String> column = new ArrayList<String>();
public List<String> price = new ArrayList<String>();

can you teach me how to display all the elements of the arraylist to a two column listview? also i want to display it through a new Intent.

    else if(v.getId()==R.id.btnFinal){
        Intent intent = new Intent(main.this, Finalize.class);
        startActivity(intent);
        }

I want my list view to be diplayed on the Finalize class. please help me.

1
  • Search about 1. Custom Adapter 2. Transfer data between Activities 3. Add your code you wrote here if there's something wrong. Commented Sep 30, 2012 at 10:34

1 Answer 1

2

Try this to get arraylist item to listview.This is used for a single column listview

 ArrayAdapter aa = new ArrayAdapter(this,
android.R.layout.simple_list_item_1, column);
 listViewobj.setAdapter(aa);

IF you need to display it to a 2 column listview you can use a customized adapter you can have an example here and even the link contains how to know which item is clicked

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.