Reputation: 6606
I keep getting this error and I'm not sure how to resolve it, I have an ArrayList
of object arrays, I can store the elements but I'm not sure how to get the elements back out, Is there anything here that's obviously wrong?
ArrayList<Object[]> pA = processArray(statii);
for(Object pAs: pA){
Toast.makeText(TweetstagramActivity.this, pAs[0], //error occurs here
Toast.LENGTH_LONG).show();
Upvotes: 2
Views: 2312
Reputation: 1501656
This is the problem:
for(Object pAs: pA) {
You want:
for (Object[] pAs : pA) {
The first is legal because any Object[]
reference is also a valid Object
reference - but then you can't use pAs[0]
as you're trying to in the loop.
(I'd also encourage you to use more descriptive variable names, btw.)
Upvotes: 4