android - What is difference between custom dialog and activity as dialog means "Theme.Dialog"? -
here question real difference between custom dialog , activity made theme dialog , opening dialog, have used both of these, of small difference understand follows
- coding remains in other file in activity , in same file in custom dialog(if haven't created new class file dialog),
- activity stays in activity stack, while dialog not.
is there other difference? y need custom dialog in place of activity dialog , visa versa,
my current problem when click on listitem , opens new activity (as dialog here), , when press button , click again on item "stops unexpectedly", , couldn't understand error, error below
04-18 12:21:18.945: e/androidruntime(915): fatal exception: main 04-18 12:21:18.945: e/androidruntime(915): java.lang.illegalstateexception: content of adapter has changed listview did not receive notification. make sure content of adapter not modified background thread, ui thread. [in listview(2131230777, class android.widget.listview) adapter(class com.logicbridge.lazyloader.myorderslazyadapter)] 04-18 12:21:18.945: e/androidruntime(915): @ android.widget.listview.layoutchildren(listview.java:1538) 04-18 12:21:18.945: e/androidruntime(915): @ android.widget.abslistview$checkfortap.run(abslistview.java:2728) 04-18 12:21:18.945: e/androidruntime(915): @ android.os.handler.handlecallback(handler.java:605) 04-18 12:21:18.945: e/androidruntime(915): @ android.os.handler.dispatchmessage(handler.java:92) 04-18 12:21:18.945: e/androidruntime(915): @ android.os.looper.loop(looper.java:137) 04-18 12:21:18.945: e/androidruntime(915): @ android.app.activitythread.main(activitythread.java:4424) 04-18 12:21:18.945: e/androidruntime(915): @ java.lang.reflect.method.invokenative(native method) 04-18 12:21:18.945: e/androidruntime(915): @ java.lang.reflect.method.invoke(method.java:511) 04-18 12:21:18.945: e/androidruntime(915): @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:784) 04-18 12:21:18.945: e/androidruntime(915): @ com.android.internal.os.zygoteinit.main(zygoteinit.java:551) 04-18 12:21:18.945: e/androidruntime(915): @ dalvik.system.nativestart.main(native method)
my code listview
@override protected void oncreate(bundle savedinstancestate) { // todo auto-generated method stub super.oncreate(savedinstancestate); setcontentview(r.layout.my_order_list); initcontrols(); loadlist(); } private void initcontrols() { progress = new progressdialog(this); progress.setmessage("loading..."); list = (listview) findviewbyid(r.id.my_order_list); } private void loadlist() { staticitems.myorderadapter = new myorderslazyadapter(myorders.this, staticitems.myorderlistarr); list.setadapter(staticitems.myorderadapter); list.setonitemlongclicklistener(new onitemlongclicklistener() { @override public boolean onitemlongclick(adapterview<?> arg0, view arg1, int arg2, long arg3) { // todo auto-generated method stub // starts new activity after process arraylist<string> str = new arraylist<string>(); str.add("loadordersdetail"); str.add("2"); new mytask(str).execute(); return false; } }); }
does happens because of have used new activity instead of dialog??
dialog
, activity
different things. example, service or broadcast receiver can start activity
, cannot start dialog
. in general, dialog
belongs activity
, activity
controls lifecycle of dialog
(ie: when created, shown, dismissed, etc.). note: can have dialog
doesn't belong activity
, special case.
there times when want show user looks dialog
, need use activity
that. example notification
. sometimes, when user chooses notification
notification bar, want show him dialog
. can't start dialog
notification
. instead, use activity
uses theme.dialog
. activity
behaves activity
, user it looks dialog
(ie: doesn't take entire screen, has transparent background user can see activity
underneath it, etc.)
Comments
Post a Comment