0
需要從列表視圖適配器中提取數據到android studio中的字符串變量。從列表視圖提取數據到android項目中的變量(適配器變量)
目前它發送一切到tableview列我需要它發送到android studio logcat或將它們放在變量中,這樣我就可以在應用程序中使用它。
lvMsg = (ListView) findViewById(R.id.lvMsg);
// Create Inbox box URI
Uri inboxURI = Uri.parse("content://sms/inbox");
// List required columns
String[] reqCols = new String[]{"_id", "address", "body"};
// Get Content Resolver object, which will deal with Content
// Provider
ContentResolver cr = getContentResolver();
// Fetch Inbox SMS Message from Built-in Content Provider
Cursor c = cr.query(inboxURI, reqCols, null, null, null);
System.out.println(c);
// Attached Cursor with adapter and display in listview
adapter = new SimpleCursorAdapter(this, R.layout.row, c, new String[]{"body", "address"}, new int[]{
R.id.lblMsg, R.id.lblNumber
});
lvMsg.setAdapter(adapter);