0

I am trying to read a specific row and column from an ArrayList<String> to display it in a textview.

In a previous activity I read a Firebase table and stored all information selected by the user in an ArrayList<String>. I do a putExtra, and I recover all data by a Bundle. The ArrayList<String> recovered seems correct. But now I don't know what to do to read this ArrayList.

I've looked at different solutions in Stack Overflow and Github without success.

Have you any idea?

enter image description here

Result of ArrayList

1 Answer 1

2

From your picture, it seems you don't have an ArrayList<String> but rather a ArrayList<ArrayList<String>>

To access it, use .get(index)

ArrayList<ArrayList<String>> ContenuAnnonceA;
int i=1, j=2;
String s = ContenuAnnonceA.get(i).get(j);
Sign up to request clarification or add additional context in comments.

2 Comments

Thank you for your reply. In fact this is my problem,. Indeed, In the previous activity i've defined an ArrayList<ArrayList<String>>. I've tried to do a putExtra of my ArrayList<ArrayList<String>> and then in the last activity, the only solution i've found is to use a Bundle for the getStringExtra. In this case is not possible to use an ArrayList<ArrayList<String>> but an ArrayList<String> and i don't know what to do
@GeorgesGRESSIEN I really don't understand what you want now ^^

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.