Multiple shapes on Android
- by LucaB
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();
}