title: retrieving data from sqlite database and displaying it in another class through "OnItemClick"
body: <p>I want that as I click on list item the application should load another class and then display the required data on textview by retrieving the data from sqlite database </p>
  
  <pre><code>@Override
  public void onItemClick(AdapterView&lt;?&gt; parent, View view,
          int position, long id) {
      // TODO Auto-generated method stub
      Intent intent = new Intent(DictionaryActivity.this,
              WordDetails.class);
      // Cursor cursor = (Cursor) adapter.getItem(position);
      id = wordList.getItemIdAtPosition(position);
      intent.putExtra("Word_ID", id);
      // cursor.getInt(cursor.getColumnIndex("_id"));
      startActivity(intent);
  }
  </code></pre>
  
  <p>this code is in WordDetails class </p>
  
  <pre><code>wordId = getIntent().getIntExtra("WORD_ID", -1);
  if (wordId == -1) {
      mean = (TextView) findViewById(R.id.mean);
      mean.setText("Error");
  } else {
      SQLiteDatabase db = (new DatabaseHelper(this))
              .getReadableDatabase();
      Cursor cursor = db.rawQuery(
              "SELECT _id ,word, mean FROM Meanings WHERE _id = ?",
              new String[] { "" + wordId });
      if (cursor.getCount() == 1) {
          cursor.moveToFirst();
          mean = (TextView) findViewById(R.id.mean);
          mean.setText(cursor.getString(cursor.getColumnIndex("mean")));
      }
  }
  </code></pre>
  
  <p>When I click on an item "Error" word is being displayed which is supposed to show, but <code>wordTd</code> equals -1. Why this <code>wordId</code> is not getting correct value? Thanks for your help.</p>