Team,
Could you please help me debug the issue?
ActivityAdapter activityAdapter = new ActivityAdapter(this,activityList); Log.d("list", "List Display - 1");
setListAdapter( activityAdapter );
Log.d("List", "list done");
It's throwing exception at the time of setListAdapter,
05-01 16:59:15.996: WARN/dalvikvm(251): threadid=3: thread exiting with uncaught exception (group=0x4001b188) 05-01 16:59:15.996: ERROR/AndroidRuntime(251): Uncaught handler: thread main exiting due to uncaught exception 05-01 16:59:16.204: ERROR/AndroidRuntime(251): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.antennasoftware.xml/com.antennasoftware.xml.XMLParsing}: java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list' 05-01 16:59:16.204: ERROR/AndroidRuntime(251): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2454) 05-01 16:59:16.204: ERROR/AndroidRuntime(251): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2470) 05-01 16:59:16.204: ERROR/AndroidRuntime(251): at android.app.ActivityThread.access$2200(ActivityThread.java:119) 05-01 16:59:16.204: ERROR/AndroidRuntime(251): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1821) 05-01 16:59:16.204: ERROR/AndroidRuntime(251): at android.os.Handler.dispatchMessage(Handler.java:99) 05-01 16:59:16.204: ERROR/AndroidRuntime(251): at android.os.Looper.loop(Looper.java:123) 05-01 16:59:16.204: ERROR/AndroidRuntime(251): at android.app.ActivityThread.main(ActivityThread.java:4310) 05-01 16:59:16.204: ERROR/AndroidRuntime(251): at java.lang.reflect.Method.invokeNative(Native Method) 05-01 16:59:16.204: ERROR/AndroidRuntime(251): at java.lang.reflect.Method.invoke(Method.java:521) 05-01 16:59:16.204: ERROR/AndroidRuntime(251): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860) 05-01 16:59:16.204: ERROR/AndroidRuntime(251): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618) 05-01 16:59:16.204: ERROR/AndroidRuntime(251): at dalvik.system.NativeStart.main(Native Method) 05-01 16:59:16.204: ERROR/AndroidRuntime(251): Caused by: java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list' 05-01 16:59:16.204: ERROR/AndroidRuntime(251): at android.app.ListActivity.onContentChanged(ListActivity.java:236) 05-01 16:59:16.204: ERROR/AndroidRuntime(251): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:201) 05-01 16:59:16.204: ERROR/AndroidRuntime(251): at android.app.Activity.setContentView(Activity.java:1622) 05-01 16:59:16.204: ERROR/AndroidRuntime(251): at com.antennasoftware.xml.XMLParsing.onCreate(XMLParsing.java:36) 05-01 16:59:16.204: ERROR/AndroidRuntime(251): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) 05-01 16:59:16.204: ERROR/AndroidRuntime(251): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2417) 05-01 16:59:16.204: ERROR/AndroidRuntime(251): ... 11 more
class ActivityList extends 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);
}
}
public class ActivityAdapter extends 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 );
}
}
Thanks in advance,