Tuesday, September 28, 2010

[android-developers] Re: separate views list view

If anyone has time please try to help me out. Thanks, I looked into
some examples but really found it hard to see how I can have the
custom adapter runnning. Thanks

On Sep 28, 12:42 pm, Varun Khanduja <varunkhand...@gmail.com> wrote:
> Ohh ok.Thanks. the format is changing in the sense that one of the
> format is having a header to the same list items, another format is
> having check boxes on left and another format is having two lines in
> the same row for every list item. Thanks
>
> On Sep 28, 12:32 pm, Kumar Bibek <coomar....@gmail.com> wrote:
>
>
>
> > > > > > > 4 different formats and when the user clicks on any of the 4 buttons
> > > > > > > they get the formats they had requested.
>
> > On Sep 29, 12:28 am, Varun Khanduja <varunkhand...@gmail.com> wrote:
>
> > > Sorry this may sound silly, but I am not really sure what you mean by
> > > "which format I am trying to use? " Thanks
>
> > > On Sep 28, 11:48 am, Kumar Bibek <coomar....@gmail.com> wrote:
>
> > > > You are using the ArrayAdapter here. You have to use a custom adapter
> > > > which extends the ArrayAdapter or the BaseAdapter. Also, what format
> > > > are you trying to change? If you can give me an example, I can help
> > > > you with that.
>
> > > > -Kumar Bibekhttp://techdroid.kbeanie.com
>
> > > > On Sep 28, 11:39 pm, Varun Khanduja <varunkhand...@gmail.com> wrote:
>
> > > > > Hi Kumar,
>
> > > > > Thanks for the response. I think I am using custom adapter. Do you
> > > > > have an example or some resource where i can see how to define this
> > > > > method? Do you think I need on click event handlers? Was sort of
> > > > > confused when checking google documentation. Thanks for guidance.
>
> > > > > package com.varun.HelloListView;
>
> > > > > import android.app.ListActivity;
> > > > > import android.os.Bundle;
> > > > > import android.view.Menu;
> > > > > import android.widget.ArrayAdapter;
> > > > > import android.widget.TextView;
>
> > > > > public class HelloListView extends ListActivity {
> > > > >         TextView selection;
>
> > > > >         @Override
> > > > >         public void onCreate(Bundle icicle) {
> > > > >                 super.onCreate(icicle);
>
> > > > >                 setContentView(R.layout.main);
> > > > >                 setListAdapter(new ArrayAdapter(this, R.layout.list_item,
> > > > > R.id.label,AndroidPhones));
> > > > >         }
> > > > >         @Override
> > > > >         public boolean onCreateOptionsMenu(Menu menu) {
> > > > >                 super.onCreateOptionsMenu(menu);
>
> > > > >                 menu.add(0, Settings.ENTER_FOOD, 0, "Enter Food");
> > > > >                 menu.add(0, Settings.ANALYZE_FOOD, 0, "Analyze Food");
> > > > >                 menu.add(0, Settings.SETTINGS, 0, "Settings");
>
> > > > >                 return true;
> > > > >         }
>
> > > > >         static final String[] AndroidPhones = new String[] {
> > > > >                 "HTC Evo 4G",  "Google Nexus One", "Motorola Devour",
> > > > >                 "Motorola CLIQ", "Samsung Galaxy S", "Motorola Droid",
> > > > >                 "myTouch 3G Slide", "Droid Eris", "Motorola Backflip",
> > > > >                 "Motorola i1", "HTC Hero", "myTouch 3G Fender",
> > > > >                 "HTC Droid Incredible",  "Samsung Moment", "LG Ally ",
> > > > >         };
> > > > >         }
>
> > > > > On Sep 28, 11:29 am, Kumar Bibek <coomar....@gmail.com> wrote:
>
> > > > > > If you are using a custom adapter, you can have a method wherein you
> > > > > > specify a method to change the format of the ListView. Through this
> > > > > > event, you can change the dataset of the ListView and ask the list
> > > > > > view to reload all these items. Thats should serve the purpose.
>
> > > > > > -Kumar Bibekhttp://kbeanie.com
>
> > > > > > On Sep 28, 11:02 pm, Varun Khanduja <varunkhand...@gmail.com> wrote:
>
> > > > > > > Hello,
>
> > > > > > > I was trying to see if anyone could guide me about some keywords or
> > > > > > > approach I should take to achieve a certain task on Android. I have 4
> > > > > > > buttons, below these buttons is a list view. This list view is having
> > > > > > > 4 different formats and when the user clicks on any of the 4 buttons
> > > > > > > they get the formats they had requested. I am not sure how I can have
> > > > > > > 4 different list views. Should I declare 4 different strings or how
> > > > > > > should one go about it?
>
> > > > > > > Thanks

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment