Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial


Saeed Mulla othman
Saeed Mulla othman
13,200 Points

problem in in ArrayAdapter in android lesson

Hi, i'm watching the (Filling Our String Array and Creating the Adapter) lesson in (Build a Blog Reader Android App) and i'm applying this lesson on Android studio ( Mr.Ben using eclipse) the problem is , when write this code : //---- ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,mBlogPostTitle);

i got this error :
Error:(147, 52) cannot find symbol constructor ArrayAdapter(lujix.com.blogreader.MainListActivity.getBlogPostsTasks,int,java.lang.String[])

i've tried to google it and see how to fix it but i couldn't , could any one help ?


2 Answers

Hi Saeed,

This usually happens when the parameter list does not match. This is a strict match i.e. if you have a parameter list like hello (String [], int, boolean), you will have to follow the sequence and thus an int argument cannot be written in the end, but should should always come second

Apparently the constructor for ArrayAdapter does the same

ArrayAdapter(Context context, int resource, T[] objects)  

// or

ArrayAdapter(Context context, int resource, int textViewResourceId, T[] objects)

Hope this helps you. However you can always paste that section of code and it will help us understand the problem a little better

Saeed Mulla othman
Saeed Mulla othman
13,200 Points

i just found the solution and it's works fine

the problem : the ( private void updateList() ) method was under (private class getBlogPostsTasks extends AsyncTask<Object , Void , JSONObject>)

i moved private void updateList() out of AsyncTask and it's Work :)

the question now, why this happen ?