Android studio不会在新线程中打印
我正试图调试一个数据库进程,但Android studio似乎没有将新线程中的语句打印到控制台。比如说Android studio不会在新线程中打印,android,android-studio,Android,Android Studio,我正试图调试一个数据库进程,但Android studio似乎没有将新线程中的语句打印到控制台。比如说 System.out.println("About to start new thread"); //this gets printed to the console new Thread(new Runnable() { public void run() { Cont
System.out.println("About to start new thread"); //this gets printed to the console
new Thread(new Runnable() {
public void run() {
ContactsDatabase db = ContactsDatabase.getContactsDatabase(getApplicationContext());
db.contactDao().insertAll(contact);
db.close();
System.out.println("Inside new thread"); //this doesn't get printed, why not?
}
});
我完全卡住了。我做的事情真的很愚蠢吗?你需要在最后调用
.start()
System.out.println("About to start new thread"); //this gets printed to the console
new Thread(new Runnable() {
@Override
public void run() {
System.out.println("Inside new thread"); //this doesn't get printed, why not?
}
}).start();
您是否考虑过改用android.util.Log?