Select chapter



basics (6.papers)
activities (5.papers)
services (2.papers)
threads (2.papers)
receivers (1.papers)
advanced android (2.papers)
SQLite database (1.papers)
adapters (1.papers)
adb and ddms (1.papers)
widgets (1.papers)
fragments (1.papers)
UI (1.papers)
Hide

Sponsored Links


  

android interview questions and answers

Show Answer
Share Facebook gmail Twitter
2
What is base adapter?what are the functions available in it?
  1. Base Adapter is a common base class of common implementation for an Adapter that can be used in both ListView and Spinner.
    
    Functions available in Base Adapter:
    1. getCount()
    2. getItem()
    3. getItemId()
    4. getConvertView()
  2. Base Adapter is a common base class for any adapter that can be used in both ListView and Spinner. Base adapter is an abstract class which implements both ListAdapter and SpinnerAdapter interfaces.
    While creating custom adapters, mostly programmers will extend this class.
    Functions available in Base Adapter:
    1. getCount()
    2. getItem()
    3. getList()
    4. getView()
  3. Base Adapter is a common base class of common implementation for an Adapter that can be used in both ListView and Spinner.
    
    Functions available in Base Adapter:
    1. onCreateView()
    2. getItem()
    3. getItemId()
    4. getConvertView()
  4. None are correct
Show Answer
Share Facebook gmail Twitter
3
How to generate alternate colours for child views in list view?
  1. It is not possible. We can give only one color to the views because we have only one xml file for the views in the listview.
  2. Take two layout xml files with a view. First xml file will contain a view with red color, and second xml file will contain a view with gree color. In custom adapter of the listview, go to getView() method and check the current position, if it is divisible by 2 apply first xml else apply second xml.
  3. take one xml file with a view. Go to custom adapter of the listview and go to getView() method. In that method check the current position, if it is divisible by 2 set one background color for the view else set a different background color for the same view.
  4. both option 2 or option 3 can be used. Both will give the same effect.
Show Answer
Share Facebook gmail Twitter
4
In custom adapter what is converView parameter in getView() function?

public View getView(int position, 
                    View convertView, ViewGroup parent)
{
 ....
}
  1. It contains information about which view user has clicked in the adapterview.
  2. it will be null if android is returning previous view which was created and went out of scope for reuse.
  3. it will be not null if android is returning previous view which was created and went out of scope, for reuse.
  4. it is for backward compatibility, it will be always null.
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
6
Android listview with custom row with a radio button, focus problem:
If row.xml is having a radio button, and a text view, then will onItemClickListener work for this adapter view (assume listview) on which we are setting this custom adapter?
Note: below function is a customAdapters function.

public View getView(int position, 
                        View convertView, ViewGroup parent) {

RelativeLayout rl = (RelativeLayout) getLayoutInflater().
                        inflate(R.layout.row, parent, false);
....

}
  1. If user clicks on any item on each row, it will call onItemClickListener of the adapterView.
  2. It will not call onItemClickListener if there are any focus able items like radio button available in each row. to solve this make onFocusable="false" in the xml file of Row.
  3. it will never call onItemClickListener, whether we make focus able of radio true or false.
  4. it depends, if user clicks on radio button, then it will not call onItemClickListener of adapterview, if user clicks on textview then it will call that function.
Show Answer
Share Facebook gmail Twitter
Read more papers :