Error Message-The source attachment does not contain the source for the file ListView.class

Posted by user603695 on Stack Overflow See other posts from Stack Overflow or by user603695
Published on 2011-02-04T20:03:11Z Indexed on 2011/02/20 15:24 UTC
Read the original article Hit count: 279

Filed under:

Hello, new to Android. I get the following message in the debugger perspective:

The source attachment does not contain the source for the file ListView.class You can change the source attachment by clicking the change attached Source Below

Needless to say the app errors. I've tried to change the source attachment to the location path:

C:/Program Files/Android/android-sdk-windows/platforms/android-8/android.jar

However, this did not work.

Any thoughts would be much appreciated.

Code is:

import android.app.ListActivity;
import android.os.Bundle;
import android.view.*;
import android.widget.*;


public class HelloListView extends ListActivity 
{
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);

      setListAdapter(new ArrayAdapter<String>(this, R.layout.main, COUNTRIES));

      ListView lv = getListView();
      lv.setTextFilterEnabled(true);

     lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        public void onItemClick(AdapterView<?> parent, View view,
            int position, long id) {
          // When clicked, show a toast with the TextView text
          Toast.makeText(getApplicationContext(), ((TextView) view).getText(),
              Toast.LENGTH_SHORT).show();
        }
      });
    }


    static final String[] COUNTRIES = new String[] {
        "Afghanistan", "Albania", "Algeria", "American Samoa...

Thanks!

© Stack Overflow or respective owner

Related posts about android