Your this.getSelectedItemId() is not returning what you think. Notice
you have an id passed into onListItemClick. Use that.

On Mar 25, 3:41 pm, MobileBen <[EMAIL PROTECTED]> wrote:
> This is the method which will be called in onCreate of
> Activity1(contains the list) for the intent/bundle:
>
> protected void onListItemClick(ListView l, View v, int position, long
> id) {
>         super.onListItemClick(l, v, position, id);
>         Intent i = new Intent(this, TeaTimer.class);
>         Bundle bundle = new Bundle();
>         bundle.putLong("ID", this.getSelectedItemId());
>         i.putExtras(bundle);
>         startSubActivity(i, ACTIVITY_CREATE);
>     }
>
> This is the call to get the data out of the bundle in Activity2:
>
> myDBHelper = new TeaDB(this);
>         myDBHelper.open();
>         bundle = getIntent().getExtras();
>         minutes = myDBHelper.getMinutes(bundle.getLong("ID"));
>                 min = minutes;
>
> This is the method getMinutes from my Database Activity:
>
>  public long getMinutes(long rowId){
>         long minutes = 0;
>         Cursor result = myDb.query(true, DATABASE_TABLE, new String[] {
>                         KEY_ROWID, KEY_NAME, KEY_BREWTIME}, KEY_ROWID + "=" + 
> rowId,
> null, null,
>                                         null, null);
>          if ((result.count() == 0) || !result.first()) {
>              throw new SQLException("No Tea matching ID: " + rowId);
>          }else{
>                 result.first();
>                 minutes = result.getLong(2);
>          }
>
>         return minutes;
>     }
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to