Android : How to start an activity from a thread when a particular condition is satisfied?

on Saturday, October 11, 2014


Please check the following code



public void run() {
while(isItOk){
if(!holder.getSurface().isValid()){
continue;
}
if(limitcounter>limitframes){
isItOk=false;
//want to launch an activity when this condition is satisfired
continue;
}
framecounter++;
score=framecounter;
if(hit){
counter++;
if(counter>50){
counter=0;
hit=false;
rys=0;
cx=900;
groan=true;
ux=1280;
}
}
Canvas killRoom=holder.lockCanvas();
mx=killRoom.getWidth()/2;
my=killRoom.getHeight()/2;
ry=killRoom.getHeight()/25;
draw(killRoom);
limitcounter++;
holder.unlockCanvasAndPost(killRoom);
if(speed<=70)
speed+=5;
else speed=20;
}
}


I am new to using threads. I am trying to make a game in Android. I want to launch a game when



limitcounter>limitframes


is it possible, if it is please tell me a way to solve the issue


0 comments:

Post a Comment