Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This is my activity class</p> <p>public class d extends Activity {</p> <p>/** Called when the activity is first created. */</p> <p>@Override public void onCreate(Bundle savedInstanceState) {</p> <p>super.onCreate(savedInstanceState);</p> <p>setContentView(R.layout.main);</p> <pre><code> String name=getIntent().getStringExtra("name"); String email=getIntent().getStringExtra("email"); String phone=getIntent().getStringExtra("phone"); Log.e("d3","came to other activity"); SmartDBHelper d=new SmartDBHelper(getApplicationContext()); d.open(); d.insertTitle(name, phone, email); Cursor c=d.getAllTitles(); // c.getColumnName(0); for( int i=0;i&lt;c.getCount();i++){ if(c.moveToNext()){ Log.e("c", ""+ c.getString(0) ); Log.e("d", ""+ c.getString(1) ); Log.e("d4", ""+ c.getString(2) ); } Log.e("r",""+c.getCount()); finish(); } } </code></pre> <p>}</p> <p>here is my sqllite class</p> <p>public class SmartDBHelper extends SQLiteOpenHelper { </p> <pre><code>private SQLiteDatabase dBH; private static final String DATABASE_NAME = "yo.db"; private static final int DATABASE_VERSION = 2; private static final String NOTIFY_TABLE_NAME = "user_notify_data"; private static final String HR_TABLE_NAME = "user_hr_data"; private static final String NOTIFY_TABLE_CREATE = "CREATE TABLE " + NOTIFY_TABLE_NAME + " (counter INTEGER PRIMARY KEY, " + "userresponse TEXT, " + "notifytime TEXT);"; private static final String HR_TABLE_CREATE = "CREATE TABLE " + HR_TABLE_NAME + " (counter INTEGER PRIMARY KEY, " + "hr TEXT, " + "act TEXT, " + "timestamp TEXT);"; public SmartDBHelper(Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); // TODO Auto-generated constructor stub } @Override public void onCreate(SQLiteDatabase db) { // TODO Auto-generated method stub Log.e("smartdbhelper", "before creation"); db.execSQL(NOTIFY_TABLE_CREATE); Log.e("smartdbhelper", "middle creation"); db.execSQL(HR_TABLE_CREATE); Log.e("smartdbhelper", "after creation"); } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { // TODO Auto-generated method stub } public SmartDBHelper open() throws SQLException { dBH = getWritableDatabase(); return this; } public long insertTitle(String isbn, String title, String publisher) { ContentValues initialValues = new ContentValues(); initialValues.put("hr", isbn); initialValues.put("act", title); initialValues.put("timestamp", publisher); Log.e("insertes","i"); dBH.insert(HR_TABLE_NAME, null, initialValues); </code></pre> <p>return 11111111; }</p> <pre><code> public Cursor getAllTitles() { return dBH.query(HR_TABLE_NAME, new String[] { "hr","act","timestamp"},null, null, null, null, null); } //---closes the database--- public void close() { close(); </code></pre> <p>} </p> <p>}</p> <p>/* the above code works and has been tested */</p>
    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.
    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