android - Close an Activity after 10 seconds? -
i use call activity
main.java
intent intent = new intent(this, message_note.class); intent.setflags(intent.flag_activity_new_task); startactivity(intent);
message_note.java :
public class message_note extends activity { @override protected void oncreate(bundle savedinstancestate) { // todo auto-generated method stub super.oncreate(savedinstancestate); setcontentview(r.layout.message); } }
how can close message_note activity after 10 seconds ?? should use thread ?
after 100 ms, activity finish using following code.
public class message_note extends activity { @override protected void oncreate(bundle savedinstancestate) { // todo auto-generated method stub super.oncreate(savedinstancestate); setcontentview(r.layout.message); handler handler = new handler(); handler.postdelayed(new runnable() { public void run() { finish(); } }, 100); } }
Comments
Post a Comment