ListView一直没加载出来。报的异常如下
ClassLoader referenced unknown path: /data/app/com.example.helloworld-2/lib/arm
简单的demo困扰了一个下午。最后才发现是自己粗心。没有setContentView.
贴出代码
package com.example.helloworld;
import java.util.ArrayList;
import java.util.List;
import com.example.helloworld.adapter.MyAdapter;
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.widget.ArrayAdapter;
import android.widget.ListView;
public class ActivityTestOne extends Activity{
private ListView listView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_test);
listView = (ListView) findViewById(R.id.listView1);
//填充的数据
List<String> adapterData = new ArrayList<String>();
for (int i = 0; i < 20; i++) {
adapterData.add("条目" + i);
}
//适配器
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1, adapterData);
listView.setAdapter(adapter);
}
}