我正在开发一个Android应用程序。我通过如下填充行来填充ListView:
public class MyListAdapter extends BaseAdapter {
Context con;
private LayoutInflater layoutinf;
ArrayList<Boolean> itemChecked = new ArrayList<Boolean>();
ArrayList<String> items_ = new ArrayList<String>();
public MyListAdapter(ChatActivity context) {
con = context;
}
public int getCount() {
return item_id.size();
}
public Object getItem(int position) {
return item_id.size();
}
public long getItemId(int position) {
return item_id.get(position).hashCode();
}
public View getView(final int position, View arg1, ViewGroup arg2) {
View v = arg1;
ViewHolder holder = null;
if (v == null) {
layoutinf = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); …Run Code Online (Sandbox Code Playgroud) 我在rawquery中使用WHERE子句从SQLite数据库中检索数据,如下所示:
public Cursor Return_SMS(String contact_no)
{
SQLiteDatabase db=this.getReadableDatabase();
//String[] params=new String[]{contact_no};
Cursor c=db.rawQuery("SELECT * FROM "+ "SMS_TABLE_RCV"+" WHERE "+ "Phone_number " + " = " + contact_no,null);
return c;
}
Run Code Online (Sandbox Code Playgroud)
但是没有检索到数据.如何使用Phone_number获取的数据等于我从游标中的Activity传递为"contact_no"的值?