views:

173

answers:

0

Hello all,

I am new to Android as well as Java programming. I have done some work before I am posting this but if this post sounds rather trivial please do respond. Here is the scenario:

I have a list view. This list view needs to have multiple views( 4 specifically). Initially I thought using tab-widget to get list views may serve the purpose but my group thought that having some other form of label at top to enable 4 different views may be better. So I looked into some methods and I am presently trying to see if add header view method is better to generate multiple views within same window or is it better to have 4 seperate buttons at the top. I saw some documentation for add header view and since I am new to java I would appreciate if you guys could help me understand how I could possibly implement addheader view properly. http://developer.android.com/reference/android/widget/ListView.html#addHeaderView(android.view.View)

Also if by my explanation of my idea if you feel addheader view is not the way to go please suggest something better. Thank you.

package varun.google.list;
import android.app.ListActivity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.ListView;

public class lsitandroid extends ListActivity {

    /** Called when the activity is first created. */
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          String[] countries = getResources().getStringArray(R.array.countries_array);
          setListAdapter(new ArrayAdapter<String>(this, R.layout.list_item, countries));

          ListView lv = getListView();
      }
         @Override
         public void addHeaderView( View v, Object data, true){
    }
}