help,i have a problem in my code

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

help,i have a problem in my code

Postby Arnold » Fri Mar 13, 2009 10:29 am

i want to display a Bitmap object in the screen ,and change its position per 1000ms. .i use a thread to do it,but it doesnt work....
here is a part of my code, HELP ME :)
i have do the changing position in onDraw().

public class MainActivity extends Activity implements OnTouchListener{
public MainView GameView;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mGameView=new MainView(this);//MainView is my class extends View
setContentView(mGameView);
new Thread(){
public void run(){
try{
while(true){
mGameView.invalidate();//i think use this function can do onDraw(),and chang the postion
sleep(1000);
}
}
catch(Exception e){
e.printStackTrace();
}
}
}.start();
}
Arnold
Freshman
Freshman
 
Posts: 3
Joined: Fri Mar 13, 2009 10:11 am

Top

Postby MrSnowflake » Fri Mar 13, 2009 10:31 am

Uhm yeah, where is it that you actually change the coordinates of the bitmap?
User avatar
MrSnowflake
Moderator
Moderator
 
Posts: 1439
Joined: Sat Feb 16, 2008 3:11 pm
Location: Flanders, Belgium

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: Majestic-12 [Bot], Yahoo [Bot] and 2 guests