アプリケーションを終了した後、RAM に表示するアプリケーションで作業しました。また、アプリケーションを再生するたびに RAM のサイズが増加します。なぜそれが起こっているのかわかりません。何か提案してください。
また、アプリケーションでタイマーを 15 秒間使用しており、時間を完了した後、あなたの時間が終わったことをダイアログに示します。ただし、そのダイアログが1回の終了時に3〜4回表示される場合があります。これは私のアプリケーションにとって非常に恥ずかしいことです。これは、アプリがバックグラウンドにあるためか、タイマーに問題があるためですか。タイマーのコードは以下です。グローバルに宣言する
MyCount counter = new MyCount(time, 1000);
タイマーコードは次のとおりです。
public class MyCount extends CountDownTimer {
public MyCount(long millisInFuture, long countDownInterval) {
super(millisInFuture, countDownInterval);
}
//call when time is finish
public void onFinish() {
// TODO Auto-generated method stub
AlertDialog.Builder alertbox = new AlertDialog.Builder(game.this);
alertbox.setMessage("Oops, your time is over");
alertbox.setNeutralButton("Ok",
new DialogInterface.OnClickListener() {
// Click listener on the neutral button of alert box
public void onClick(DialogInterface arg0, int arg1) {
quesCount++;
for(int i=0;i<4;i++){
btn[i].setVisibility(View.VISIBLE);
}
rndom_no=randomno();
showDataOverControls(rndom_no);
counter.start();
}
});
alertbox.show();
}
@Override
public void onTick(long millisUntilFinished) {
time1 = (TextView) findViewById
(R.id.time);
time1.setText(""+millisUntilFinished / 1000);
}
}
アプリケーション内の for ループは、ボタンの可視性を変更します。 rndom_no=randomno(); この関数は、乱数 showDataOverControls(rndom_no) を生成します。xml 解析によって xml ファイルからデータを取得します。私が何か間違ったことをしている場合は、提案してください。