Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to fetch data from sqlite table and display it in textview in android?
    primarykey
    data
    text
    <p>I have been working on some sqlite database and i have created one table,and have successfully inserted data,How to fetch the data and display in a textview?</p> <pre><code> public class EmployeeTable{ public static final String KEY_NAME = "emp_name"; public static final String KEY_DESIGNATION = "emp_designation"; public static final String KEY_ROWID = "_id"; private static final String TAG = "EmployeeTable"; private DatabaseHelper mDbHelper; private SQLiteDatabase mDb; private static final String DATABASE_NAME = "employee_database"; private static final String DATABASE_TABLE = "employee"; private static final int DATABASE_VERSION = 3; /** * Database creation sql statement */ private static final String DATABASE_CREATE = "create table " + DATABASE_TABLE + " (" + KEY_ROWID + " integer primary key autoincrement, " + KEY_NAME +" text not null, " + KEY_DESIGNATION + " text not null);"; private final Context mCtx; private static class DatabaseHelper extends SQLiteOpenHelper { DatabaseHelper(Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); } @Override public void onCreate(SQLiteDatabase db) { Log.i(TAG, "Creating DataBase: " + DATABASE_CREATE); db.execSQL(DATABASE_CREATE); }` </code></pre> <p><strong>following in my main class:</strong></p> <pre><code> public class SqliteDBActivity extends Activity { /** Called when the activity is first created. */ private static final String TAG = "EmployeeTable"; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); EmployeeTable employeeTable = new EmployeeTable(this); employeeTable.open(); employeeTable.createEmployee("Prashant Thakkar", "Tech Lead"); employeeTable.createEmployee("Pranay anand", "Tech Lead"); employeeTable.createEmployee("rajeev kumar", "Tech Lead"); Log.i(TAG, "Fetching record..."); employeeTable.close(); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload