Multiple shapes on Android
Posted
by LucaB
on Stack Overflow
See other posts from Stack Overflow
or by LucaB
Published on 2010-03-17T12:11:05Z
Indexed on
2010/04/20
6:13 UTC
Read the original article
Hit count: 344
Hi Hi I'm trying to build a layout where some shapes will popup every 2 seconds. If the user will click one of these shapes, they have to disappear.
What is the correct way of doing this? I thought about a thread, but i missed out. Here's my code at the moment (is not working):
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
l = new LinearLayout(this);
setContentView(l);
int counter = 1;
View v = new CustomDrawableView(this,20,50);
l.addView(v);
Thread t = new Thread() {
public void run() {
while (true) {
Log.i("THREAD","INSIDE");
View h = new CustomDrawableView(c,
(int)Math.round(Math.random()*100),
(int)Math.round(Math.random()*100));
SystemClock.sleep(2000);
l.addView(h);
}
}
};
t.start();
}
© Stack Overflow or respective owner