我已经查看了logCat上的输出,但我无法在模拟器中看到我的联系人列表
import java.util.List;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.widget.ListView;
public class dbb extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
DatabaseHandler db = new DatabaseHandler(this); //i have created this class
/**
* CRUD Operations
* */
// Inserting Contacts
Log.d("Insert: ", "Inserting ..");
db.addContact(new contact("Ravi", "9100000000"));
db.addContact(new contact("Srinivas", "9199999999"));
db.addContact(new contact("Tommy", "9522222222"));
db.addContact(new contact("Karthik", "9533333333"));
// Reading all contacts
Log.d("Reading: ", "Reading all contacts..");
List<contact> contacts = db.getAllContacts();
ListView lv = new ListView(this);
lv = (ListView)findViewById(R.id.list1);
for (contact cn : contacts) {
String log = "Id: "+cn.getID()+" ,Name: " + cn.getName() + " ,Phone: " + cn.getPhoneNumber();
// Writing Contacts to log
Log.d("Name: ", log);
}
}
}
*//Here what should i do to show List[contact] as my desired output? which is saved in the list array.
提前致谢。