I am trying to create a dialog with a custom title and content views but am running into ResourceNotFoundExceptions when I try and inflate the views.
final TextView titleView = (TextView) View.inflate(activity, R.id.how_to_play_dialog_title, null); final WebView contentView = (WebView) View.inflate(activity, R.id.how_to_play_dialog_text, null); contentView.loadData("<html><body>some text</body></html>", "text/html", "utf-8"); final AlertDialog.Builder builder = new AlertDialog.Builder(activity); builder.setCustomTitle(titleView); builder.setView(contentView); The above code throws the ResourceNotFound on each of the View inflates even though I have res/layout/how_to_play_dialog.xml as the follwing: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/ android" android:layout_width="wrap_content" android:layout_height="wrap_content" > <TextView android:id="@+id/how_to_play_dialog_title" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/how_to_play_dialog_title" style="@style/dialogTitle" /> <WebView android:id="@+id/how_to_play_dialog_text" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </LinearLayout> I can retrieve the Views (using findViewById) if I inflate the entire layout first, but then I need to remove the views from the layout before adding them to the Dialog. Can't I just inflate the Views directly, using View#inflate? The actual stacktrace is: Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x7f0a000c type #0x12 is not valid at android.content.res.Resources.loadXmlResourceParser(Resources.java: 1874) at android.content.res.Resources.getLayout(Resources.java:731) at android.view.LayoutInflater.inflate(LayoutInflater.java: 318) at android.view.LayoutInflater.inflate(LayoutInflater.java: 276) at android.view.View.inflate(View.java:8665) at au.com.xandar.jumblee.widget.DialogFactory.createHowToPlayDialog(DialogFactory.java: 35) -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en