0

My task involves a ListView inside a Fragment.

I'm having trouble populating that ListView.

Here's what I'm trying.

public class UrlListFragment extends Fragment {

public View onCreateView(LayoutInflater inflator, ViewGroup container, Bundle state)
{               
    View returnView = inflator.inflate(R.layout.url_fragment, container, false);

    ListView mylist = (ListView) returnView.findViewById(R.id.mylist);
    String[] urlArray = new String[] { "http://mobile.cs.fsu.edu/android", "http://www.google.com", "http://my-favoriate-website.com" };
    ArrayAdapter<string> arrayAdapter = new ArrayAdapter<string>(getActivity(), android.R.layout.simple_list_item_1, urlArray);
    mylist.setAdapter(arrayAdapter);

    return returnView;
}}

I get the error

The constructor ArrayAdapter<R.string>(Activity, int, String[]) is undefined

How can i solve this?

1 Answer 1

4

R.string is not the same as String. Java is case sensitive. String != string.

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.