android - Understanding BaseAdapters and how to use them -


i'm trying set image gridview layout, , involves deriving new class baseadapter class. have been using tutorial on website developer.android.com, still don't quite understand means. please explain me baseadapter? don't understand definition provided android developers website.

thanks

an adapter used bind data view. see adapterview:

an adapterview view children determined adapter.

several layout views derive adapterview gridview, listview, , gallery.

of course, don't use adapterview , adapter directly, rather use or derive 1 of subclasses. subclasses of adapter may add additional functionality change how should bind data view.

baseadapter abstract base class adaptor interface simplify implementing adapters. implement own, framework provides pretty flexible adapters already. popular adapters are:

arrayadapter,

  • binds array of data view
  • override getview() inflate, populate, , return custom view given index in array. getview() method includes opportunity reuse views via convertview parameter.

cursoradapter,

  • binds data cursor (like database cursor) view
  • abstract don't use directly, use subclass or derive own
  • implement abstract method newview() inflate, populate, , return desired view current cursor position , implement abstract method bindview populate existing view being reused..

simplecursoradapter,

  • a concrete implementation of cursoradapter
  • it can take row layout , mapping of cursor columns row layout widgets
  • supports text , images, can customize using setviewtext , setviewimage
  • can support other types , can customize bindings through hook: clients implement simplecursoradapter.viewbinder interface setviewvalue() method inflate, populate, , return desired view given row (current cursor state) , data "column". method can define "special" views , bindings, still defer simplecursoradapter's standard behavior "normal" bindings.

Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -