Win a copy of Head First Android this week in the Android forum!

Jarrek Smith

Greenhorn
+ Follow
since Oct 18, 2010
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Jarrek Smith

VideoView video = (VideoView) findViewById(R.id.video);
Uri uri = Uri.parse("android.resource://org.yourpackage/"+R.raw.videonamewithoutextension);
MediaController mc = new MediaController(this);
video .setMediaController(mc);
video .setVideoURI(uri);
video .start();
11 years ago
You should use setVisibility

http://developer.android.com/reference/android/view/View.html#setVisibility%28int%29

With the parameter 8 : Gone
Using Gone make the layout invisible and make it taking no space in the parent layout
11 years ago
In get View you bind the layout element to the ViewHolder propertie.

for example : in your viewHolder you have
ImageView img1

in get view you bind the image of the layout to img1

for example : img1= (ImageView) convertView.findViewById(R.id.icon)

then you add an onclick listener in img1

img1.setOnClickListener(new OnClickListener() { ...

that should do the trick.
Setting an on click listener on the gridView isn't precise enought.
You have to set an on click Listener on the view contained in your grid view

11 years ago
Step 1 : in the item (for example itemTwoLine) you use to create a list (for example mList)of item that you are passing to the adapter you add a field of type boolean ( for example cb1 ), in the item you add getter and setter for this property.

code of itemTwoLine :



Step 2 : in the adapter you add an on click listener on the checkbox of your layout :



step 3 : you populate a list of item and pass it to the adapter




and here are the code of the layout

item_two_line.xml :



itinerary.xml



main.xml



this sample code will provide you a list of item which contains an image, two line of text and a checkBox.
To retrieve state of checkboxs you can iterate to mListe in your mainActivity on the field cb1 with getCb1.
Then you will get for each line of mListe the state of the checkBox

hope this help

11 years ago
Have you try requesting a new cursor after the delete?
like myCursor = dbhelper.getContact()
11 years ago