Try changing your openpopup(View)
to:
public void openpopup(View v){
orderbutton = (Button) findViewById(v.getId());
final Dialog dialog = new Dialog(context);
// dialog.setContentView(R.layout.custom_popup);
dialog.setTitle("Choose your topings before ordering..");
View dialogView = showFood();
dialog.setContentView(dialogView);
dialog.show();
V = CLVA.getValues();
VLenght = CLVA.getValuesLenght();
Add(V,VLenght);
// showFood();
//CLVA.addToDB(context);
}
Change your showFood()
to:
public View showFood(){
....
....
return v;
}
What's happening is that you are inflating two views from the same layout file. You are setting up the ListView and its adapter in one view but not using dialog.setContentView()
on it.
Instead, you use R.layout.custom_popup
to set the content of the dialog. The ListView does not have an adapter set in this case.