setItemChecked() actually did'nt work with in case of
onItemSelectedListener.

Do we have some cleaner way, means through xml selector or using
setActivated() for Android 3.0, with screwing getView of List Adapter.

Reg,
Varun

On Tue, Apr 26, 2011 at 1:09 PM, cool rss feed <[email protected]>wrote:

> So I assume your activity is in Touch mode.
>
> If you use setSelection() in Touch mode, there will be no visual
> effect.
>
> if you really think you want to get the first item highlighted,
> I might try using setItemChecked()
>
> see if it works.
>
> Terence
>
>
> On Apr 26, 3:18 pm, Varun Tewari <[email protected]> wrote:
> > Yes you are right that's what i did.
> >
> > You can refer following snippet:
> >
> > ListView mainCategoryList;
> >
> > mainCatrgoryList.setAdapter(mainCategoryAdapter);
> >
> > mainCategoryList.setOnItemSelectedListener(new OnItemSelectedListener()
> >         {
> >
> >             @Override
> >             public void onItemSelected(AdapterView<?> arg0, View view,
> int
> > arg2, long arg3)
> >             {
> >
> > view.setBackgroundResource(R.drawable.category_list_item_focus_bg);
> >
> >             }
> >
> >             @Override
> >             public void onNothingSelected(AdapterView<?> arg0)
> >             {
> >                 // TODO Auto-generated method stub
> >
> >             }
> >         });
> >
> >  mainCategoryList.setSelection(0);
> >
> > Let me know, if you need anything more.
> >
> > I even tried to put these few line of code in ApiDemo but it didn't even
> > work there.
> >
> > Reg,
> > Varun
> >
> > On Tue, Apr 26, 2011 at 12:15 PM, cool rss feed <[email protected]
> >wrote:
> >
> >
> >
> >
> >
> >
> >
> > > Why dont you use the setSelection(0) inside onCreate()?
> >
> > > onItemSelectedListener() will not be triggered by itself.
> >
> > > Terence
> >
> > > On Apr 26, 2:41 pm, Varun Tewari <[email protected]> wrote:
> > > > Hey Guys,
> >
> > > > While working with fragments i am trying to have one list in left
> panel
> > > and
> > > > detail fragment in right side of it.
> > > > I have my first item item already selected as soon as i launch app.
> And
> > > > "SHOULD HOLD ITS SELECTED STATE"
> > > > I tried using onItemSelectedListener with setSelection(0), but it
> didn't
> > > get
> > > > called. Any one knows the reason?
> >
> > > > Reg,
> > > > Varun
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

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

Reply via email to