Set ID item listview from database

I need to display a list of events in a listview, I want to do is that the ID of an item of listview is the ID that is registered in my DB. It is posible?

Answers


I would recommend you create a custom list adapter that takes in a custom object modeled around your database.

Do some research on BaseAdapter.

Once you've created your custom list adapter you can store all your database rows into something like

ArrayList<CustomObject> co = new ArrayList<CustomObject>();

Then when an OnClickListener is fired you can use the position like so:

int id = co.get(position).getId();

Assuming of course your CustomObject has a method called getId().


Need Your Help

Jquery animation of height width not working

jquery jquery-animate

I've created this simple animation using jQuery. But event doesn't trigger the animation where I expand the div height and width.

Using asp C# issue with text-decoration:none;

c# asp.net html visual-studio-2010

I have this problem where my navigational links has an underline on hover. I tried to place text-decoration:none. I looked at my entire css but I can't find the cause for the underline.