Note that there are some explanatory texts on larger screens.

plurals
  1. POreading a single contact from the SQLite database to new class
    primarykey
    data
    text
    <p>Oke so I have the next code in my DataBaseHandler</p> <pre><code> // Getting single contact Database getContact(int id) { SQLiteDatabase db = this.getReadableDatabase(); Cursor cursor = db.query(TABLE_MOVIES, new String[] { KEY_ID, ,KEY_SUM,KEY_ACT,KEY_TRAILER,KEY_PREVIEW,KEY_DIR,KEY_WRI }, KEY_ID + "=?", new String[] { String.valueOf(id) }, null, null, null); if (cursor != null) cursor.moveToFirst(); Database contact = new Database(Integer.parseInt(cursor.getString(0)), cursor.getString(1),cursor.getString(2),cursor.getString(3),cursor.getString(4),cursor.getString(5), cursor.getString(6),cursor.getString(7)); return contact; } </code></pre> <p>I need to get all the information from a certain ID. The ID depends on the number I send back. But when I try to call for the database in my class, it doesn't seem to work.</p> <pre><code> protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.info); DatabaseHandler db = new DatabaseHandler(this); // for this example i want to read out ID 15 in my database db.getContact(15); } </code></pre> <p>When I read the content of <code>db.getContact(15);</code> I get back be.artesis.findmymovie.Database@436884e0, so it's not empty</p> <pre><code>// getting movie_director public String getMD(){ return this._movie_director; } // setting movie_director public void setMD(String movie_director){ this._movie_director = movie_director; } </code></pre> <p>My Question is, now that I got this Contact, how can I use the information inside the ID? I tried using the next methods and call for <code>db.getMD()</code>, but it doesn't work</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.
 

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