If you are creating a custom Dialog for Android, and following the Android Developers’ Creating Dialogs tutorial, then most likely you would have faced a Force Close with this exception showing up in logcat. I did too. Although I figured it out quickly, it might not be easy to find out for many, so posting it here for reference. Basically, the code given in the tutorial goes something like this:
Context mContext = getApplicationContext();
Dialog dialog = new Dialog(mContext);
dialog.setContentView(R.layout.custom_dialog);
dialog.setTitle("Custom Dialog");
TextView text = (TextView) dialog.findViewById(R.id.text);
text.setText("Hello, this is a custom dialog!");
ImageView image = (ImageView) dialog.findViewById(R.id.image);
image.setImageResource(R.drawable.android);
All looks well, but when you execute it, you will get a Force Close. The error appearing in logcat would be something like this: