This question is a continuation of the topic Create a popup window with arbitrary content . In that question the following solution was proposed:
AlertDialog.Builder adb = new AlertDialog.Builder(this); View my_custom_view = (LinearLayout) getLayoutInflater().inflate(R.layout.alert, null); //находим разметку adb.setView(my_custom_view); //ставим ее в окно TextView ad_tv = (TextView)my_custom_view.findViewById(R.id.ad_tv); //находим TextView ad_tv.setTextColor(Color.BLACK); AlertDialog ad = adb.create(); ad.show(); I invoke the dialog with FloatingActionButton and get this Exception:
android.support.v4.widget.DrawerLayout cannot be cast to android.widget.LinearLayout The exception occurs in the second line. Immediately the question: where does DrawerLayout ? Moreover, I did not cast it, I cast Linear.
In such matters (as in this ), it was said that this is indeed related to DrawerLayout , but this solution did not help:
mDrawerLayout.closeDrawer(Gravity.LEFT); I ask you not just to write a solution, but to explain what is happening.