Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

SimpleCurosrAdaptor problem

 
Hardik Trivedi
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, all genius people

I am new to android and referring examples given with SDK.Currently I am working on NotepadExample.In that there is one method named fillData


I do not understand what is String[] and int[]? why we have taken them?

Please reply..
 
Ankit Garg
Sheriff
Posts: 9580
33
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Cursor c can have different columns for each row of data. From that we only want to display the title of each row in the ListView. This is why only fld_title is taken as the String[] from field. Now we need to decide where this value will go in each row of the ListView, that is decided by the int array i.e. to. Since R.id.text1 is used, so the title of each row will go into a TextView with the id text1. Have a look at the SimpleCursorAdapter documentation, it has all the info you need...
 
Hardik Trivedi
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ankit Garg wrote:From that we only want to display the title of each row in the ListView. This is why only fld_title is taken as the String[] from field.



You mean it is kind of mapping between data from table and column in list
Right?

If it so..how simple it is.

thank you
 
Ankit Garg
Sheriff
Posts: 9580
33
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes its kind of like that. You map the contents of the Cursor to Views in the list. The example here is simple as we are only mapping one column to a TextView in the list...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic