Grid View and Cursor problem

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

Grid View and Cursor problem

Postby vaishumol » Tue Jan 19, 2010 5:56 pm

Hi friends, Im using DB to display the texts in gridview. But im gettin ghte error in cursor. here my code :

public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.image_folder);

GridView gridview = (GridView) findViewById(R.id.gridview);

cursor = SampleApplication.mDb.fetchAllCategory();
startManagingCursor(cursor);
nutritionAapter = new ImageAdapter(this, cursor);
gridview.setAdapter(nutritionAapter);

}

Getting error in this lne : cursor = SampleApplication.mDb.fetchAllCategory();
Cant we use cursoradapter in gridvew?

Pleae help me guys.
vaishumol
Experienced Developer
Experienced Developer
 
Posts: 74
Joined: Sun Jan 03, 2010 6:33 am

Top

Postby vaishumol » Tue Jan 19, 2010 6:40 pm

Solved the above issue. :-)

Coming with another issue...

How to work with OnItemClick event in gridview?

Any idea?

gridview.setOnItemClickListener(new OnItemClickListener(){
@Override
public void onItemClick(AdapterView arg0, View v, int arg2, long arg3) {
//TODO : Would like to move to next screen....
}
});

Please help me to solve the issue friends.

Thanks in advance... :-)
vaishumol
Experienced Developer
Experienced Developer
 
Posts: 74
Joined: Sun Jan 03, 2010 6:33 am

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: Majestic-12 [Bot] and 8 guests