1
当我插入数据,然后该数据显示在custome列表视图,也把按钮列表视图所以,现在当点击按钮在那时执行一些操作,那么我需要创建onClickListener的按钮,所以当延伸ListActivity再没有在我器件的应用在Android中运行onClickListener .... 我也送代码这个....当扩展ListActivity然后不工作onClickListener
public class MydatabaseforlistActivity extends ListActivity {
DbHelper dbhelper;
SQLiteDatabase db;
Button btnEdit,btnDel;
String[] id;
String[] title;
int size;
SimpleCursorAdapter adapter;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
/*{
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
super.onCreate(savedInstanceState);*/
//setContentView(R.layout.listcarda);
dbhelper = new DbHelper(this);
dbhelper.oninsert("HELLO");
dbhelper.oninsert("hjkhkjhl");
dbhelper.oninsert("happy mother");
dbhelper.oninsert("happy sorry");
db=dbhelper.getReadableDatabase();
Cursor c = db.query(DbHelper.TABLE_NAME, new String[] { DbHelper.U_ID,
DbHelper.TITLE }, null, null, null, null, null);
int i = 0;
c.moveToFirst();
size = c.getCount();
id = new String[size];
title = new String[size];
while (c.moveToNext()) {
id[i] = c.getString(1);
// title[i] = c.getString(2);
i++;
c.moveToNext();
}
c.close();
db.close();
//lv = getListView();
setListAdapter(new Notes(this));
ü没有写代码onclicklistener! ! – Farhan 2012-03-16 05:43:20