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

Doubt with ArrayAdapter,ArrayAdapterView

 
vinoth vino
Ranch Hand
Posts: 67
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm new to Android programming....Please anyone explain me in detail...

I don't know some code i'll explain list of things....

1. what is this "spin.setOnItemSelectedListener(this); " ? (I understood that this line will call the AdapterView.OnItemSelectedListener when selecting any country from country strings ) is this right ?
2. What is ArrayAdapter and AdapterView ?
3.AdapterView<?> arg0, View arg1, int position,long id ( please explain it one by one... what is AdapterView<?> arg0 ? , what is View arg1 ? and position,id ? why should i construct onItemSelectedListener with these things) ?
4. what is this <?> ?
5.Shall i change parent instead of arg0 and view instead of arg1 ?



Please anyone explain me this program fully
 
Giovanni Montano
Ranch Hand
Posts: 248
4
Android Open BSD Slackware
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
vinoth vino wrote:I'm new to Android programming....Please anyone explain me in detail...



also java I guess. the question you ask are also java oriented in my opinion, I am junior as well but here are my replies, is good you are curious, but I would buy head first java where all these curiosities are really dealt in detail and in an humorous way, like slowing breaking a toy ..

1)
this is a listener. you can find milions of replies on google, is difficult to understand, because I guess you do not know the observer pattern.
when the button is pressed it trigs onItemSelected. How this happens? Because the class implements
AdapterView.OnItemSelectedListener that is an interface that obliges to implement the methods
2) this can be found on internet! what did you not understand from the documentation?
3)these are parameters..please look for : java parameters. If you learn the basis of java you can understand these concept really easily or you can do a search on java beginner forum in this site, there are ton of post explaining these things, but if you do not get conceptually does not have sense to explain it briefly.
4)<?> means any type, you should deal with generics before to understand how it works in the API like that. in head first java is well explained, also looking in the internet question mark java and wildcard java
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic