点击项目在对话框内不起作用..
描述:我有一个打印按钮,当我单击该按钮时,将出现一个对话框,其中包含使用适配器的列表视图。当我单击列表视图行时,它必须转到其他活动。但问题是 onitemclick 在列表视图对话框中不起作用。
提前谢谢你。
WorkDetailView.java
printbutton = (Button) findViewById(R.id.barcodePrintButton);
printbutton.setOnClickListener(new OnClickListener() {
private Context context = WorkDetailView.this;
/**
*
* Description: barcodePrintButton onClick to ServiceManager.callPrintService
*
*/
@Override
public void onClick(View view) {
dialog = new Dialog(context);
dialog.setContentView(R.layout.dialoglistview);
dialog.setTitle("Print Dialog");
listviewDialog = (ListView) dialog.findViewById(R.id.dialogList);
dataDialogAdapter = new WorkDetailDialogAdapter(context, sampleDetailsArray);
listviewDialog.setAdapter(dataDialogAdapter);
listviewDialog.setClickable(true);
listviewDialog.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapter, View view, int position, long id) {
Log.i("selectedAdapter", "selectedAdapter"+ position);
Intent intent = new Intent("com.google.zxing.client.android.ENCODE");
intent.putExtra("ENCODE_DATA", patient.getMrnNumber());
intent.putExtra("ENCODE_FORMAT", "CODE_128");
// intent.putExtra("ENCODE_SHOW_CONTENTS", false);
startActivity(intent);
Toast.makeText(WorkDetailView.this, "Printing Barcode Result", Toast.LENGTH_LONG).show();
}
});
dialog.show();
}
});