I have created an AlertDialog to appear with information displayed from my DB. The issue is the AlertDialog box does not show at all. There are no errors which occur which makes it difficult to solve the problem.
public void viewAll() {
button.setOnClickListener(
new View.OnClickListener() {
@Override
public void onClick(View v) {
Cursor result = myDB.getData();
if (result.getCount() == 0) {
showMessage("ERROR", "NO DATA");
return;
}
StringBuffer buffer = new StringBuffer();
while (result.moveToNext()) {
buffer.append("COL1: " + result.getString(1) + "\n");
buffer.append("COL2: " + restul.getString(2) + "\n");
buffer.append("COL3: " + result.getString(3) + "\n");
buffer.append("COL4: " + result.getString(4) + "\n");
}
showMessage("DATA", buffer.toString());
}
}
);
}
public void showMessage(String title, String message) {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setCancelable(true);
builder.setTitle(title);
builder.setMessage(message);
builder.show();
}
Forgive me for using pseudo code