I tried with threads, but android throws \"CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.\".
So how can
There is an easier way to do it: use View.postDelayed(runnable, delay)
View view = yourView;
view.postDelayed(new Runnable() {
public void run() {
view.setVisibility(View.GONE);
}
}, 3000);
It's not very precise: may be hidden in 3.5 or 3.2 seconds, because it posts into the ui thread's message queue.
Use post() or runOnUiThread() just something as setTimeout().