Вы можете использовать вот так.
lv1.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
long arg3) {
LayoutInflater layout = (LayoutInflater) getBaseContext()
.getSystemService(LAYOUT_INFLATER_SERVICE);
View popupView = layout.inflate(R.layout.popup1, null);
Display display = getWindowManager().getDefaultDisplay();
int height = display.getHeight();
int width = display.getWidth();
final PopupWindow popupWindaow = new PopupWindow(popupView,
(int) (width/1.4), (int) (height/2.5));
popupWindaow.showAtLocation(popupView, Gravity.CENTER, 0, 0);
TextView tv1 = (TextView) popupView
.findViewById(R.id.textView1);
tv1.setText("Really delete this entry?");
Button No = (Button) popupView.findViewById(R.id.No);
Button Yes = (Button) popupView.findViewById(R.id.Yes);
Yes.setOnClickListener(new OnClickListener() {
public void onClick(View arg0) {
//code to delete
}
});
No.setOnClickListener(new OnClickListener() {
public void onClick(View arg0) {
popupWindaow.dismiss();
}
});
}
});
Надеюсь, это поможет вам.
сделал и отправить контекст деятельности конструктору адаптер? –