我的 Android 应用程序有问题。我有一个自定义 ListView 适配器,但是当我启动应用程序时,列表没有显示任何项目!
我的代码:
import android.app.Activity;
import android.os.Bundle;
import android.widget.ListView;
public class AccountContents extends Activity {
private ListView ls1;
String username = fourshared.username;
String password = fourshared.password;
private AccountItem[] rootContents;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
rootContents = fourshared.rootContents;
CArrayAdapter adapter = new CArrayAdapter(AccountContents.this, rootContents);
setContentView(R.layout.main);
ls1 = new ListView(AccountContents.this);
ls1.setAdapter(adapter);
}
}