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

user603695 picture user603695 · Feb 4, 2011 · Viewed 28.1k times · Source

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!

Answer

Bert F picture Bert F · Feb 4, 2011

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

Needless to say the app errors.

The debugger is simply saying your stack frame currently highlight in the debugger is in the ListView class and you don't have the source code to be able it in the editor. This certainly is not the cause of your whatever problem you're having with your program. If you find the stackframe that corresponds to your source code, the debugger will happily show you the code corresponding to the stack frame. You could go to the trouble of installing the Android source code, but it won't solve whatever problem you're having with your program.

Please clarify what your program is doing wrong - what are the symptoms other than that message. Please look in LogCat for error messages, exceptions, and stack traces and post them.