Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.


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 ?