u miss one things the most import codes : setContentView(R.layout.main); make sure done this,before u use the id of the view customdialog
On 12月14日, 上午6时34分, Antony BODY <[email protected]> wrote: > Hi, > > I try to implement an custom dialog .... sadly when i call "show" > method i get this stac: > > Thread [<3> main] (Suspended (exception WindowManager > $BadTokenException)) > ViewRoot.setView(View, WindowManager$LayoutParams, View) line: 491 > WindowManagerImpl.addView(View, ViewGroup$LayoutParams, boolean) > line: 177 > WindowManagerImpl.addView(View, ViewGroup$LayoutParams) line: 91 > Dialog.show() line: 238 > BudgetMonitoringActivity.itemClicked(long) line: 292 > BudgetMonitoringActivity.onItemLongClick(AdapterView, View, int, > long) line: 318 > ListView(AbsListView).performLongPress(View, int, long) line: 1693 > AbsListView.access$500(AbsListView, View, int, long) line: 71 > AbsListView$CheckForLongPress.run() line: 1651 > ViewRoot(Handler).handleCallback(Message) line: 587 > ViewRoot(Handler).dispatchMessage(Message) line: 92 > Looper.loop() line: 123 > ActivityThread.main(String[]) line: 4203 > Method.invokeNative(Object, Object[], Class, Class[], Class, int, > boolean) line: not available [native method] > Method.invoke(Object, Object...) line: 521 > ZygoteInit$MethodAndArgsCaller.run() line: 791 > ZygoteInit.main(String[]) line: 549 > NativeStart.main(String[]) line: not available [native method] > > I tried with an simple layout like this and i get the same error > stack: > > <LinearLayout xmlns:android="http://schemas.android.com/apk/res/ > android" > android:id="@+id/layout_root" > android:orientation="horizontal" > android:layout_width="fill_parent" > android:layout_height="fill_parent" > android:padding="10dp" > > > <TextView android:id="@+id/text" > android:layout_width="wrap_content" > android:layout_height="fill_parent" > android:textColor="#FFF" > /> > </LinearLayout> > > And my code just do this: > > Context mContext = getApplicationContext(); > Dialog dialog = new Dialog(mContext); > dialog.setContentView(R.layout.customdialog); > dialog.show(); > > Just one thing the current activity is launch in a tab host. > > Somebody have an idea? > Regards. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

