public List
List
SQLiteDatabase database = dbopenhelper.getWritableDatabase();
Cursor cursor = database.rawQuery("select date from health", new String[]{});//这边写上你的查询语句
while(cursor.moveToNext()){
list.add(cursor.getString(0));
}
cursor.close();
database.close();
return list;
}
之后就是把这个LIST显示在Listview中;
如:SimpleAdapter adapter=new SimpleAdapter(Listview.this,list
,R.layout.viewdate,new String[]{"date"},
new int[]{R.id.tdate});
listview.setAdapter(adapter);
listview.setOnItemClickListener(new AdapterView.OnItemClickListener() { //事件
public void onItemClick(AdapterView> arg0, View arg1, int position,
long arg3) {
....
}
});
希望对你有用
代码:
if(username.length()>0&&password.length()>0)
{
SQLiteAdapter db=new SQLiteAdapter(Main.this);
db.openToWrite();
if(db.Login(username,password))
{
System.out.println("goutham");
Intent intent=new Intent(getApplicationContext(),ExampleActivity.class);
startActivity(intent);
}