Shabeel Backer Shabeel Backer - 5 months ago 13
Android Question

In Android databse connection does not work " toast "

public void DisplayRecord(Cursor c) {
Toast.makeText(this,("id: " + c.getString(0) + "\n" + "Title: " +.getString(1)+ "\n" + "Due Date: " + getString(2)),Toast.LENGTH_SHORT).show();

}

Answer

I assume you did Cursor query already. then Try this,

import android.widget.Toast;

public void DisplayRecord(Cursor c) {

 c.moveToFirst();

Toast.makeText(YOUR_ACTIVITY_NAME.this,"id: " + c.getString(0) + "\n" + 
        "Title: " +c.getString(1)+ "\n" +
        "Due Date:  " + c.getString(2)),
Toast.LENGTH_SHORT).show();

}

this may helps you

Comments