I have worked on the application which I present in the RAM after I am out of my application. Also the size in RAM is increases every time when I play the application. I don't know why it is happening. Please suggest me something.
Also I am using timer in my application for 15 sec and after completing the time I show I Dialog that Your time is over. But some times that dialog appear 3-4 times on one time finish of time. This is very embarrassing for my application. Is this thing is due to the app is in background or anything wrong with my timer. Code of timer is below. Globally declare the
MyCount counter = new MyCount(time, 1000);
and the timer code is:
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);
}
}
The for loop inside the application change the visibility of the buttons, rndom_no=randomno(); this function generate the random numbers, showDataOverControls(rndom_no); it fetch the data from the xml file by xml parsing. Please suggest if I am doing something wrong.