データベースからデータを取得するためのカーソルを作成していますが、制御がカーソルに来ると、「Println にはメッセージが必要です」というメッセージが表示され、混乱しています。
コード:
import org.apache.commons.logging.Log;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.os.AsyncTask;
import android.widget.Toast;
public class TableA extends AsyncTask<String, Void, Void>{
String Tablename = "Data";
private String Column1 = "ID";
private String Column2 = "FirstName";
private String Column3 = "LastNAme";
private String C1;
private String C2;
private String C3;
Database rd;
Cursor c;
public final String r_Table = "CREATE TABLE " + Tablename + " (" + Column1+ " INTEGER PRIMARY KEY , " + Column2 + " TEXT, " + Column3 + " Text) ";
public void setcolumn1(String ID1){
C1=ID1;
}
public int getcolumn1(){
return Integer.parseInt(C1);
}
public void setcolumn2(String rname){
C2=rname;
}
public String getcolumn2(){
return C2;
}
public void setcolumn3(String Lname){
C3=Lname;
}
public String getcolumn3(){
return C3;
}
public ContentValues insertdata(){
setcolumn1("1");
setcolumn2("Ravi");
setcolumn3("Kumar");
ContentValues cv=new ContentValues();
cv.put(Column1, Integer.valueOf(getcolumn1()));
cv.put(Column2, getcolumn2());
cv.put(Column3, getcolumn3());
android.util.Log.i(Column1, String.valueOf(getcolumn1()));
android.util.Log.i(Column2, getcolumn2());
android.util.Log.i(Column3, getcolumn3());
System.out.println(getcolumn1());
System.out.println(getcolumn2());
System.out.println(getcolumn3());
return cv;
}
@Override
protected Void doInBackground(String... params) {
c=rd.db.rawQuery("Select * from Data", null);
if(c!=null){
if(c.moveToFirst()){
System.out.println("Column Count is: "+c.getColumnCount());
System.out.println("Row Count is: "+c.getCount());
}
c.close();
}
return null;
}
}
ログキャット
05-01 15:57:57.247: W/ActivityThread(7163): Application com.example.Datamanager is waiting for the debugger on port 8100...
05-01 15:57:57.287: I/System.out(7163): Sending WAIT chunk
05-01 15:57:57.379: I/dalvikvm(7163): Debugger is active
05-01 15:57:57.537: I/System.out(7163): Debugger has connected
05-01 15:57:57.557: I/System.out(7163): waiting for debugger to settle...
05-01 15:57:57.759: I/System.out(7163): waiting for debugger to settle...
05-01 15:57:58.057: I/System.out(7163): waiting for debugger to settle...
05-01 15:57:58.259: I/System.out(7163): waiting for debugger to settle...
05-01 15:57:58.467: I/System.out(7163): waiting for debugger to settle...
05-01 15:57:58.677: I/System.out(7163): waiting for debugger to settle...
05-01 15:57:58.887: I/System.out(7163): waiting for debugger to settle...
05-01 15:57:59.087: I/System.out(7163): waiting for debugger to settle...
05-01 15:57:59.297: I/System.out(7163): waiting for debugger to settle...
05-01 15:57:59.509: I/System.out(7163): waiting for debugger to settle...
05-01 15:57:59.738: I/System.out(7163): waiting for debugger to settle...
05-01 15:57:59.937: I/System.out(7163): waiting for debugger to settle...
05-01 15:58:00.147: I/System.out(7163): waiting for debugger to settle...
05-01 15:58:00.347: I/System.out(7163): waiting for debugger to settle...
05-01 15:58:00.557: I/System.out(7163): waiting for debugger to settle...
05-01 15:58:00.757: I/System.out(7163): waiting for debugger to settle...
05-01 15:58:00.959: I/System.out(7163): waiting for debugger to settle...
05-01 15:58:01.169: I/System.out(7163): waiting for debugger to settle...
05-01 15:58:01.367: I/System.out(7163): waiting for debugger to settle...
05-01 15:58:01.568: I/System.out(7163): waiting for debugger to settle...
05-01 15:58:01.777: I/System.out(7163): debugger has settled (1489)
05-01 15:59:08.807: E/Datamanager(7163): println needs a message
05-01 15:59:11.368: I/Choreographer(7163): Skipped 93 frames! The application may be doing too much work on its main thread.
05-01 15:59:11.748: D/gralloc_goldfish(7163): Emulator without GPU emulation detected.
05-01 15:59:12.846: I/Choreographer(7163): Skipped 100 frames! The application may be doing too much work on its main thread.
05-01 15:59:21.756: D/dalvikvm(7163): Debugger has detached; object registry had 514 entries
カーソルが印刷するメッセージをどのように必要とするかなど、メッセージが異なるため、誰でも続行する方法を教えてください。
ありがとうシヴァ