[android-developers] Listview items focus change event

2013-03-12 Thread Shashidhar
Hi,
 I have an application which has a custom listview. I run it on a smart tv
android device and the whole navigation is based on the standard keyboard
arrow buttons. I am able to scroll up and down through the list items using
up and down arrow keys. When I scroll using keys, the list selector moves
appropriately. I need to do somethings based on the item being focused.
But, I could not find a way to get the list item focus changed event.
Essentially, I need to know whenever a list item takes the focus.

I tried to set the focuschangelistener for the view that I am returning in
getView() method. But its not working.


Any help is appreciated.

thanks,
Shashidhar

-- 
-- 
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+unsubscr...@googlegroups.com
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 unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [android-developers] ListView items

2012-05-10 Thread Narendra Singh Rathore

 On Wed, May 9, 2012 at 5:49 PM, nageswara rao rajana 
 nagu.raj...@gmail.com wrote:

 Hi,

 How to generate xml file form list view items.
 Please help me...


Did you want this or something else?

-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] ListView items

2012-05-10 Thread asheesh arya
just go through this link
http://appfulcrum.com/2010/09/05/listview-example-2-using-xml-resource-file/

-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] ListView items

2012-05-10 Thread Narendra Singh Rathore
On Thu, May 10, 2012 at 11:59 AM, Narendra Singh Rathore 
nsr.curi...@gmail.com wrote:



 On Wed, May 9, 2012 at 5:49 PM, nageswara rao rajana 
 nagu.raj...@gmail.com wrote:

 Hi,

 How to generate xml file form list view items.
 Please help me...


 Did you want this or something else?



sry for this incomplete thread.
Well, I was suggesting this.

 lv.setOnItemClickListener(new OnItemClickListener() {

public void onItemClick(AdapterView? arg0, View arg1, int arg2, long
arg3) {
// TODO Auto-generated method stub
if(arg2==0)
{
setContentView(R.layout.one);

}
else
{
setContentView(R.layout.two);

}

}
});

-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] ListView items

2012-05-09 Thread nageswara rao rajana
Hi,

How to generate xml file form list view items.
Please help me...

Thanking you.
nagu.

-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] ListView items

2012-05-09 Thread arun kumar
http://danroundhill.com/2009/12/18/working-with-the-android-listview/

On Wed, May 9, 2012 at 5:49 PM, nageswara rao rajana
nagu.raj...@gmail.comwrote:

 Hi,

 How to generate xml file form list view items.
 Please help me...

 Thanking you.
 nagu.

 --
 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+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en




-- 
WITH REGARDS
ARUN KUMAR P D
+91-9994794759

-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] ListView items

2011-08-20 Thread Goutom
Hi Treking
This is not the answer.


On Fri, Aug 19, 2011 at 5:45 PM, TreKing treking...@gmail.com wrote:

 On Fri, Aug 19, 2011 at 7:41 PM, Goutom goutom.sust@gmail.com wrote:

 Any help?


 Use the adapter that backs the listview.


 -
 TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
 transit tracking app for Android-powered devices

  --
 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+unsubscr...@googlegroups.com
 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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] ListView items

2011-08-20 Thread Mark Murphy
On Fri, Aug 19, 2011 at 8:41 PM, Goutom goutom.sust@gmail.com wrote:
 I want to get all child of a listview.

Why?

                 int count = listview.getAdapter().getCount();

This is not the number of children of the ListView. getChildCount() on
ListView is the number of children of the ListView.

 for (int i = 0; i  count; ++i) {
 View row = (View) listview.getChildAt(i); // this line return null when
 the view is not in focus is listview.
 CheckBox check = (CheckBox) row.findViewById(R.id.AppCheckBox);
 if (check.isChecked()) {
 // some code
 } else
 // some code
 }
 I have 10 row in listview, 8 in focus.

No, you have 8 rows in your ListView. Your adapter might have 10
items, but you only have 8 rows in the ListView.

 After looping 8 times it gives null for View row.

Of course. That's what you wrote.

If you didn't want it to crash, do not compare apples (number of items
in the adapter) to oranges (number of children of the ListView).

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_The Busy Coder's Guide to Android Development_ Version 3.6 Available!

-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] ListView items

2011-08-20 Thread TreKing
On Sat, Aug 20, 2011 at 6:57 AM, Goutom goutom.sust@gmail.com wrote:

 Hi Treking
 This is not the answer.


I respectfully disagree. But hey, it's your app. Good luck.

-
TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
transit tracking app for Android-powered devices

-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] ListView items

2011-08-19 Thread Goutom
Hi All,
I want to get all child of a listview.

int count = listview.getAdapter().getCount();
for (int i = 0; i  count; ++i) {
View row = (View) listview.getChildAt(i); // this line return null when
the view is not in focus is listview.
CheckBox check = (CheckBox) row.findViewById(R.id.AppCheckBox);
if (check.isChecked()) {
// some code
} else
// some code
}
I have 10 row in listview, 8 in focus.After looping 8 times it gives null
for View row.

Any help?

Thanks in advance.
Regards
Goutom

-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] ListView items

2011-08-19 Thread TreKing
On Fri, Aug 19, 2011 at 7:41 PM, Goutom goutom.sust@gmail.com wrote:

 Any help?


Use the adapter that backs the listview.

-
TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
transit tracking app for Android-powered devices

-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] ListView items height

2011-07-08 Thread omar0226
Hi!

I have to build a functionality that would allow the user to browse
the tweets from a twitter account. My problem is how to know the
appropriate height for the items in the list, since each tweet has a
variable number of characters, how do I know the height for each item
in the list (as a function of its content lenght)?

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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] ListView items appear 2 or 3 times

2011-02-06 Thread Dirk Vranckaert
Hi all,

I'm having an issue with the ListView in Android.

So I have an activity extending the ListActivity, in the activity I
have an innerclass for my adapater.
Now both on my device and the emulator some entries appear 2 or 3
times in the list (not always the same items) although the size of my
ListLabel is always the same!

On the emulator I noticed that it's mostly related to the scrolling in
the list... If I scroll down some entries are duplicate, if I scroll
up and down again the entries have changed all over the list...

Is there anything in my code that you guys can see that is wrong?

Here's my code:


this.labels = labelService.findAll();
Collections.sort(this.labels, new LabelByNameComparator());
Log.d(LOG_TAG, labels.size() +  labels loaded!);
ManageLabelsListAdapter adapter = new
ManageLabelsListAdapter(labels);
adapter.notifyDataSetChanged();
setListAdapter(adapter);

/**
 * The list adapater private inner-class used to display the
manage labels list.
 */
private class ManageLabelsListAdapter extends ArrayAdapterLabel
{
private final String LOG_TAG =
ManageLabelsListAdapter.class.getSimpleName();
/**
 * {@inheritDoc}
 */
public ManageLabelsListAdapter(ListLabel labels) {
super(ManageLabelsActivity.this,
R.layout.list_item_labels, labels);
Log.d(LOG_TAG, Creating the manage labels list
adapater);
}

@Override
public View getView(int position, View convertView, ViewGroup
parent) {
Log.d(LOG_TAG, Getting view...);
View row = convertView;
ManageLabelsListWrapper wrapper;

if(row == null) {
Log.d(LOG_TAG, Row needs to be created!);
final Label label = labels.get(position);
Log.d(LOG_TAG, Label at list position  + position +
 retrieved from DB list:  + label);

LayoutInflater inflater = getLayoutInflater();
row = inflater.inflate(R.layout.list_item_labels,
parent, false);
Log.d(LOG_TAG, Label row inflated into layout!);
wrapper = new ManageLabelsListWrapper(row);
Log.d(LOG_TAG, Row wrapped!);

TextView labelName = wrapper.getLabelname_listitem();
Log.d(LOG_TAG, About to update the name of the label
in the view for TextView  + labelName +  with the value:  +
label.getName());
labelName.setText(label.getName());

ImageView deleteButton = wrapper.getBtn_delete();
deleteButton.setOnClickListener(new
View.OnClickListener() {
public void onClick(View view) {
deleteLabel(label, true);
}
});
}

return row;
}
}

-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] ListView items appear 2 or 3 times

2011-02-06 Thread Mark Murphy
You are not handling row recycling properly. You have the if
(row==null) case, but you do nothing in the other case. You need to
bind your row widgets with the proper data in either case -- the only
difference between the two is that if (row==null), you have to create
a row, either directly via inflation or via chaining to the
superclass.

On Sun, Feb 6, 2011 at 11:39 AM, Dirk Vranckaert
dirkvrancka...@gmail.com wrote:
 Hi all,

 I'm having an issue with the ListView in Android.

 So I have an activity extending the ListActivity, in the activity I
 have an innerclass for my adapater.
 Now both on my device and the emulator some entries appear 2 or 3
 times in the list (not always the same items) although the size of my
 ListLabel is always the same!

 On the emulator I noticed that it's mostly related to the scrolling in
 the list... If I scroll down some entries are duplicate, if I scroll
 up and down again the entries have changed all over the list...

 Is there anything in my code that you guys can see that is wrong?

 Here's my code:

        
        this.labels = labelService.findAll();
        Collections.sort(this.labels, new LabelByNameComparator());
        Log.d(LOG_TAG, labels.size() +  labels loaded!);
        ManageLabelsListAdapter adapter = new
 ManageLabelsListAdapter(labels);
        adapter.notifyDataSetChanged();
        setListAdapter(adapter);

    /**
     * The list adapater private inner-class used to display the
 manage labels list.
     */
    private class ManageLabelsListAdapter extends ArrayAdapterLabel
 {
        private final String LOG_TAG =
 ManageLabelsListAdapter.class.getSimpleName();
        /**
         * {@inheritDoc}
         */
        public ManageLabelsListAdapter(ListLabel labels) {
            super(ManageLabelsActivity.this,
 R.layout.list_item_labels, labels);
            Log.d(LOG_TAG, Creating the manage labels list
 adapater);
        }

        @Override
        public View getView(int position, View convertView, ViewGroup
 parent) {
            Log.d(LOG_TAG, Getting view...);
            View row = convertView;
            ManageLabelsListWrapper wrapper;

            if(row == null) {
                Log.d(LOG_TAG, Row needs to be created!);
                final Label label = labels.get(position);
                Log.d(LOG_TAG, Label at list position  + position +
  retrieved from DB list:  + label);

                LayoutInflater inflater = getLayoutInflater();
                row = inflater.inflate(R.layout.list_item_labels,
 parent, false);
                Log.d(LOG_TAG, Label row inflated into layout!);
                wrapper = new ManageLabelsListWrapper(row);
                Log.d(LOG_TAG, Row wrapped!);

                TextView labelName = wrapper.getLabelname_listitem();
                Log.d(LOG_TAG, About to update the name of the label
 in the view for TextView  + labelName +  with the value:  +
 label.getName());
                labelName.setText(label.getName());

                ImageView deleteButton = wrapper.getBtn_delete();
                deleteButton.setOnClickListener(new
 View.OnClickListener() {
                    public void onClick(View view) {
                        deleteLabel(label, true);
                    }
                });
            }

            return row;
        }
    }

 --
 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+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en




-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Warescription: Three Android Books, Plus Updates, One Low Price!

-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] ListView items appear 2 or 3 times

2011-02-06 Thread Kostya Vasilyev

Dirk,

You have a bug in your getView() method.

When a list item layout gets recycled (convertView != null), your code 
correctly avoids re-inflating a new layout. However, since the item 
layout is being recycled, it's also necessary to update its views with 
values for the current item.


Pseudo-code:

getView() {

if (convertView == null) {
inflate a view
}

/* Always execute below code, for both new and recycled item layouts */

YourDataItem item = get data item specified by position

TextView view1.setText(item.name);
TextView view2.setText(item.address);
// etc
}

-- Kostya

06.02.2011 19:39, Dirk Vranckaert пишет:

Hi all,

I'm having an issue with the ListView in Android.

So I have an activity extending the ListActivity, in the activity I
have an innerclass for my adapater.
Now both on my device and the emulator some entries appear 2 or 3
times in the list (not always the same items) although the size of my
ListLabel  is always the same!

On the emulator I noticed that it's mostly related to the scrolling in
the list... If I scroll down some entries are duplicate, if I scroll
up and down again the entries have changed all over the list...

Is there anything in my code that you guys can see that is wrong?

Here's my code:

 
 this.labels = labelService.findAll();
 Collections.sort(this.labels, new LabelByNameComparator());
 Log.d(LOG_TAG, labels.size() +  labels loaded!);
 ManageLabelsListAdapter adapter = new
ManageLabelsListAdapter(labels);
 adapter.notifyDataSetChanged();
 setListAdapter(adapter);

 /**
  * The list adapater private inner-class used to display the
manage labels list.
  */
 private class ManageLabelsListAdapter extends ArrayAdapterLabel
{
 private final String LOG_TAG =
ManageLabelsListAdapter.class.getSimpleName();
 /**
  * {@inheritDoc}
  */
 public ManageLabelsListAdapter(ListLabel  labels) {
 super(ManageLabelsActivity.this,
R.layout.list_item_labels, labels);
 Log.d(LOG_TAG, Creating the manage labels list
adapater);
 }

 @Override
 public View getView(int position, View convertView, ViewGroup
parent) {
 Log.d(LOG_TAG, Getting view...);
 View row = convertView;
 ManageLabelsListWrapper wrapper;

 if(row == null) {
 Log.d(LOG_TAG, Row needs to be created!);
 final Label label = labels.get(position);
 Log.d(LOG_TAG, Label at list position  + position +
 retrieved from DB list:  + label);

 LayoutInflater inflater = getLayoutInflater();
 row = inflater.inflate(R.layout.list_item_labels,
parent, false);
 Log.d(LOG_TAG, Label row inflated into layout!);
 wrapper = new ManageLabelsListWrapper(row);
 Log.d(LOG_TAG, Row wrapped!);

 TextView labelName = wrapper.getLabelname_listitem();
 Log.d(LOG_TAG, About to update the name of the label
in the view for TextView  + labelName +  with the value:  +
label.getName());
 labelName.setText(label.getName());

 ImageView deleteButton = wrapper.getBtn_delete();
 deleteButton.setOnClickListener(new
View.OnClickListener() {
 public void onClick(View view) {
 deleteLabel(label, true);
 }
 });
 }

 return row;
 }
 }




--
Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com

--
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] ListView items in Activity Persist on G1 keyboard slideout, but not Dialog list items

2009-06-08 Thread pawpaw17

Guys,

When your intent kicks knocked on the head by the OS and then restored/
recreated
(for example when you slide out the keyboard on the G1) if you have a
ListView
populated with items in an activity they appear after the recreate.

However, if you have a dialog box full of list items and do the same
steps, the
ListView comes back up empty when the window is redrawn after the
slide.

Is this an Android bug? My list is a pain in the neck to pack into a
bundle, it consists
of Address objects, and there might be ten of them. Am I doing
something
un-android?

I'm thinking of just dimissing the dialog when this happens. But
calling
dismiss in onRestore (for the dialog) doesn't seem to work.

Any ideas? Thanks so much!

best,

pawpaw17
--~--~-~--~~~---~--~~
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-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---