表示するデータベースがあるため、画面をしばらく一時停止する必要があります..... xml レイアウトに行ごとにデータベースを表示します... 問題は、xml レイアウトが常にデータベースの一番下を表示することです.. . だから、しばらく画面を止めれば、レイアウトから他の行を見ることができると信じています...
これが私のコードです:
public void get() {
Bundle bundle = getIntent().getExtras();
String count = bundle.getString("x");
//Toast.makeText(getApplicationContext(), count, Toast.LENGTH_SHORT).show();
db = new DBAdapter(this);
db.open();
Cursor z = db.getAllList();
if (z.moveToFirst())
{
do {
DisplayList(z,count);
} while (z.moveToNext());
}
db.close();
}
public void DisplayList(Cursor z, String count) {
String b = z.getString(1);
if (count.equals(b)) {
/*Toast.makeText(this,
"Id : " + z.getString(0) + "\n" +
"Product : " + z.getString(1) + "\n" +
"Brand : " + z.getString(2) + "\n" +
"Place : " + z.getString(3) + "\n" +
"Date : " + z.getString(4) + "\n" +
"Price : Rp. " + z.getString(5),
Toast.LENGTH_LONG).show();*/
TextView X = (TextView) findViewById(R.id.a);
TextView Y = (TextView) findViewById(R.id.b);
TextView Z = (TextView) findViewById(R.id.c);
TextView A = (TextView) findViewById(R.id.d);
TextView B = (TextView) findViewById(R.id.e);
String a = z.getString(1);
String f = z.getString(2);
String c = z.getString(3);
String d = z.getString(4);
String e = z.getString(5);
X.setText("Product : " + a);
Y.setText("Brand : " + f);
Z.setText("Bought at : " + c);
A.setText("Date : " + d);
B.setText("Price : Rp. " + e);
}
}
私の計画は、表示リストの直後に一時停止することです:
do {
DisplayList(z,count);
//here
} while (z.moveToNext());
何か案は ???私はthread.sleepを試しましたが、役に立ちません......
このような :
do {
DisplayList(z,count);
try {Thread.sleep(1000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} while (z.moveToNext());