Команда
Не могли бы вы помочь мне отладить проблему?
ActivityAdapter ActivityAdapter = новый ActivityAdapter (это, ActivityList);
Log.d («список», «отображение списка - 1»);
setListAdapter( activityAdapter );
Log.d("List", "list done");
Выдает исключение во время setListAdapter,
05-01 16: 59: 15.996: WARN / dalvikvm (251): threadid = 3: поток завершается с необработанным исключением (группа = 0x4001b188)
05-01 16: 59: 15.996: ОШИБКА / AndroidRuntime (251): обработчик Uncaught: выход из основного потока из-за необработанного исключения
05-01 16: 59: 16.204: ОШИБКА / AndroidRuntime (251): java.lang.RuntimeException: Невозможно запустить действие ComponentInfo {com.antennasoftware.xml / com.antennasoftware.xml.XMLParsing}: java.lang.RuntimeException: Ваш содержимое должно иметь ListView с атрибутом id 'android.R.id.list'
05-01 16: 59: 16.204: ОШИБКА / AndroidRuntime (251): на android.app.ActivityThread.performLaunchActivity (ActivityThread.java:2454)
05-01 16: 59: 16.204: ОШИБКА / AndroidRuntime (251): на android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:2470)
05-01 16: 59: 16.204: ОШИБКА / AndroidRuntime (251): на android.app.ActivityThread.access $ 2200 (ActivityThread.java:119)
05-01 16: 59: 16.204: ОШИБКА / AndroidRuntime (251): на android.app.ActivityThread $ H.handleMessage (ActivityThread.java:1821)
05-01 16: 59: 16.204: ОШИБКА / AndroidRuntime (251): на android.os.Handler.dispatchMessage (Handler.java:99)
05-01 16: 59: 16.204: ОШИБКА / AndroidRuntime (251): на android.os.Looper.loop (Looper.java:123)
05-01 16: 59: 16.204: ОШИБКА / AndroidRuntime (251): на android.app.ActivityThread.main (ActivityThread.java:4310)
05-01 16: 59: 16.204: ОШИБКА / AndroidRuntime (251): в java.lang.reflect.Method.invokeNative (собственный метод)
05-01 16: 59: 16.204: ОШИБКА / AndroidRuntime (251): в java.lang.reflect.Method.invoke (Method.java:521)
05-01 16: 59: 16.204: ОШИБКА / AndroidRuntime (251): на com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run (ZygoteInit.java:860)
05-01 16: 59: 16.204: ОШИБКА / AndroidRuntime (251): на com.android.internal.os.ZygoteInit.main (ZygoteInit.java:618)
05-01 16: 59: 16.204: ОШИБКА / AndroidRuntime (251): в dalvik.system.NativeStart.main (собственный метод)
05-01 16: 59: 16.204: ОШИБКА / AndroidRuntime (251): вызвано: java.lang.RuntimeException: у вашего контента должен быть ListView с атрибутом id 'android.R.id.list'
05-01 16: 59: 16.204: ОШИБКА / AndroidRuntime (251): на android.app.ListActivity.onContentChanged (ListActivity.java:236)
05-01 16: 59: 16.204: ОШИБКА / AndroidRuntime (251): на com.android.internal.policy.impl.PhoneWindow.setContentView (PhoneWindow.java:201)
05-01 16: 59: 16.204: ОШИБКА / AndroidRuntime (251): на android.app.Activity.setContentView (Activity.java:1622)
05-01 16: 59: 16.204: ОШИБКА / AndroidRuntime (251): в com.antennasoftware.xml.XMLParsing.onCreate (XMLParsing.java:36)
05-01 16: 59: 16.204: ОШИБКА / AndroidRuntime (251): на android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1047)
05-01 16: 59: 16.204: ОШИБКА / AndroidRuntime (251): на android.app.ActivityThread.performLaunchActivity (ActivityThread.java:2417)
05-01 16: 59: 16.204: ОШИБКА / AndroidRuntime (251): ... еще 11
класс ActivityList расширяет LinearLayout {
public ActivityList(Context context, ActivityBean activityBean) {
super(context);
this.setOrientation(HORIZONTAL);
ListView listView = new ListView(context);
LinearLayout.LayoutParams idParams =
new LinearLayout.LayoutParams(100, LayoutParams.WRAP_CONTENT);
//cityParams.setMargins(10, 10, 10, 10);
TextView idColumn = new TextView( context );
idColumn.setText( activityBean.getActivityId() );
idColumn.setTextSize(14f);
idColumn.setTextColor(Color.WHITE);
listView.addView( idColumn, idParams);
LinearLayout.LayoutParams accountNameParams =
new LinearLayout.LayoutParams(20, LayoutParams.WRAP_CONTENT);
TextView accountNameView = new TextView(context);
accountNameView.setText( activityBean.getAccountName() );
accountNameView.setTextSize( 14f );
accountNameView.setTextColor(Color.WHITE);
listView.addView( accountNameView, accountNameParams);
LinearLayout.LayoutParams typeParams =
new LinearLayout.LayoutParams(25, LayoutParams.WRAP_CONTENT);
//ImageView skyControl = new ImageView( context );
TextView typeView = new TextView(context);
typeView .setText( activityBean.getAccountName() );
typeView.setTextSize( 14f );
typeView .setTextColor(Color.WHITE);
listView.addView( typeView, typeParams );
addView(listView);
}
}
открытый класс ActivityAdapter расширяет BaseAdapter {
public ActivityAdapter(Context context, List activityList) {
this.context = context;
this.activityList = activityList;
}
private Context context;
private List activityList;
@Override
public int getCount() {
// TODO Auto-generated method stub
return activityList.size();
}
@Override
public Object getItem(int arg0) {
// TODO Auto-generated method stub
return null;
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ActivityBean activity = (ActivityBean) activityList.get(position);
return new ActivityList(this.context, activity );
}
}
Заранее спасибо,