I have an Alert Dialog and when I press the button to show what I chose, it shows nothing, only the black faded screen like something has to show.
There is my code:
final AlertDialog.Builder raspunsgresit = new AlertDialog.Builder(Intrebarea644.this);
LayoutInflater factory = LayoutInflater.from(Intrebarea644.this);
final View view = factory.inflate(R.layout.raspuns644, null);
raspunsgresit.setView(view);
if(view.getParent()!=null)
((ViewGroup)view.getParent()).removeView(view);
raspunsgresit.setPositiveButton("", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dlg, int sumthin) {
}
});
It's just the AlertDialog.Builder
. You need to create()
the AlertDialog
then show()
it. So, your code will look like :
final AlertDialog.Builder raspunsgresit = new AlertDialog.Builder(Intrebarea644.this);
LayoutInflater factory = LayoutInflater.from(Intrebarea644.this);
final View view = factory.inflate(R.layout.raspuns644, null);
raspunsgresit.setView(view);
if(view.getParent()!=null)
((ViewGroup)view.getParent()).removeView(view);
raspunsgresit.setPositiveButton("", new DialogInterface.OnClickListener(){
public void onClick(DialogInterface dlg, int sumthin){
}
});
raspunsgresit.create().show();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.