I have written below code for showing a custom dialog void CheckHighScore() {
AlertDialog.Builder builder; AlertDialog alertDialog; Context mContext = getApplicationContext(); LayoutInflater inflater = (LayoutInflater) mContext.getSystemService (LAYOUT_INFLATER_SERVICE); ViewGroup vg = (ViewGroup) findViewById(R.id.layout_root); View layout = inflater.inflate(R.layout.mydialog, vg); builder = new AlertDialog.Builder(mContext); builder.setView(layout); alertDialog = builder.create(); alertDialog.show(); } __________ xml file __________ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/ android" android:id="@+id/layout_root" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:padding="10dp"> <TextView android:id="@+id/desc" android:text="@string/ask_info" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#FFF" /> <EditText android:text="Enter your info here" android:id="@+id/ yourinfo" android:layout_width="wrap_content" android:layout_height="wrap_content"></EditText> </LinearLayout> it is unable to find ViewGroup in above code and is crashing. I have another main.xml file which is set to content layout in this activity. So how can I correct this thing ? Also I need to add some validation here to this dialog like info cannot be empty ! thanks in advance Jags -- 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