[android-developers] listView get child items in a loop

2016-02-19 Thread NIWEWE David
Hi! I have been working on something for more than 2 days, but only met 
roadblocks all around. 
I have a listView that is updated by a JSON array from the server, Each 
item is composed by 
3 TextViews where one is not visible to the user and a EditText that is to 
be updated by the user. 
What I want to do is when the user has finished inputting data in all 
EditText in that list, loop through
all Items of the listviews getting their values, put them into a Hashmap 
array, change the hashmap 
into JSON and send the JSON to PHP. All works very fine for the visible 
Items on the screen. But 
I have failed to get item visible when you scroll. Any help? 

-- 
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.
To post to this group, send email to android-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/ad6c6c92-1b16-4013-804a-0ef6a1cbfe2a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[android-developers] ListView Switch

2016-01-10 Thread Javier Delgado
Hi! I´m working on an activity which shows all the apps installed on the 
phone, with its photo, name, and a switch.
For showing the apps, photo and name I´ve used this example: 
http://javatechig.com/android/how-to-get-list-of-installed-apps-in-android 
For the switch I added


to the snippet_list_row.xml .

I need the switch status to be changed and saves(using SharedPreferences) when 
an item of the ListView is clicked, so in AllAppsActivity.java, inside 
onListItemClick, I´ve put:

Switch appSwitch = (Switch) findViewById(R.id.app_switch);
if (appSwitch.isChecked()){
 appSwitch.setChecked(false);
}else{
 appSwitch.setChecked(true);
}
PreferenceManager.getDefaultSharedPreferences(AppsNotificationsActivity.this
).edit().putString(app.packageName , String.valueOf(appSwitch.isChecked())).
commit();

but it doesn´t work, and I don´t know why. Could somebody help me??
Thanks a lot

-- 
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.
To post to this group, send email to android-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/fbf1d02d-0a63-47ee-ba7f-6a448b1c80c1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [android-developers] ListView won't show up with Retrofit 2.0

2015-12-01 Thread AbdulMajeed Mohammad
Could you please tell me how to do it in right way because I'm beginner ?

On Tuesday, December 1, 2015 at 6:15:32 PM UTC+3, richarth wrote:
>
> You create the adapter with TelAdapter adapter = new  TelAdapter 
> (MainActivity.this, R.layout.list_item, data);
>
> Data is empty so you aren't seeing anything.  You need to get the data out 
> of response instead.
>
> On 1 December 2015 at 12:16, AbdulMajeed Mohammad  > wrote:
>
>> Any reply please??
>>
>> --
>> 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 .
>> To post to this group, send email to android-d...@googlegroups.com 
>> .
>> Visit this group at http://groups.google.com/group/android-developers.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/android-developers/00629e60-862e-4ccd-82ad-3bd3f7fc6829%40googlegroups.com
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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.
To post to this group, send email to android-developers@googlegroups.com.
Visit this group at http://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/270572f2-dc91-484a-9797-cbc0b39e5962%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [android-developers] ListView won't show up with Retrofit 2.0

2015-12-01 Thread Richard Thompson
You create the adapter with TelAdapter adapter = new  TelAdapter
(MainActivity.this, R.layout.list_item, data);

Data is empty so you aren't seeing anything.  You need to get the data out
of response instead.

On 1 December 2015 at 12:16, AbdulMajeed Mohammad 
wrote:

> Any reply please??
>
> --
> 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.
> To post to this group, send email to android-developers@googlegroups.com.
> Visit this group at http://groups.google.com/group/android-developers.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/android-developers/00629e60-862e-4ccd-82ad-3bd3f7fc6829%40googlegroups.com
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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.
To post to this group, send email to android-developers@googlegroups.com.
Visit this group at http://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/CAPhephWmn%3DnhqcsRANRGL5HyWmaQxJmVbRXO0qoeNkADqKkmoA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[android-developers] ListView won't show up with Retrofit 2.0

2015-12-01 Thread AbdulMajeed Mohammad
Any reply please??

-- 
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.
To post to this group, send email to android-developers@googlegroups.com.
Visit this group at http://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/00629e60-862e-4ccd-82ad-3bd3f7fc6829%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[android-developers] ListView won't show up with Retrofit 2.0

2015-11-30 Thread AbdulMajeed Mohammad
Hi,

I have json file in my localhost and I want to load it in ListView with 
custom adapter by retrofit 2.0 , but nothing show up 

and I don't know if the problem from an adapter or the json file or 
retrofit call, here the classes 

MainActivity.java

public class MainActivity extends AppCompatActivity {


 ListView listView;


@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

listView = (ListView) findViewById(R.id.listView);


 final ArrayList data = new ArrayList();


Retrofit retrofit = new 
Retrofit.Builder().baseUrl("http://10.0.2.2;).addConverterFactory(GsonConverterFactory.create()).build();

TelService service = retrofit.create(TelService.class);
retrofit.Call calls = service.getphones("telephones");
calls.enqueue(new Callback() {
@Override
public void onResponse(Response response, Retrofit 
retrofit) {


TelAdapter adapter = new  TelAdapter (MainActivity.this, 
R.layout.list_item, data);
listView.setAdapter(adapter);

}

@Override
public void onFailure(Throwable t) {

}
});


}
}


TelAdapter.java

public class TelAdapter extends ArrayAdapter {

static Context context;
static int layoutResourceId;
private List data = null;


public TelAdapter(Context context,int layoutResourceId, List 
data) {
super(context, layoutResourceId, data);
this.layoutResourceId = layoutResourceId;
this.context = context;
this.data = data;

}



public long getItemId(int position) {
return position;
}

@Override
public View getView(int position, View convertView, ViewGroup parent) {
View row = convertView;
TelHolder holder;

if (row == null) {
LayoutInflater inflater = ((Activity) context).getLayoutInflater();
row = inflater.inflate(layoutResourceId, parent, false);

holder = new TelHolder();

holder.names = (TextView) row.findViewById(R.id.names);
holder.numbers = (TextView) row.findViewById(R.id.numbers);

row.setTag(holder);
} else {
holder = (TelHolder) row.getTag();
}

tel_list telephnoes = data.get(position);
holder.names.setText(telephnoes.getName());
holder.numbers.setText(telephnoes.getName());
return row;

}

static class TelHolder {
TextView names;
TextView numbers;

}
}


tel_list.java

public class tel_list {

private String name;
private String number;

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public String getNumber() {
return number;
}

public void setNumber(String number) {
this.number = number;
}
}



TelService.java


public interface TelService {
@GET("/alruthea/{getphones}.php")
retrofit.Call getphones(@Path("getphones")String 
telephones);


}




in addition I couldn't add the file name extensions inside @Path


please help,

-- 
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/d/optout.


[android-developers] ListView getCount is wrong - how do I reset it?

2014-05-16 Thread plnelson
I have a listView in an android app which works fine when I first populate 
it - it displays and scrolls with no problem. But if I load in a new, 
smaller dataset and call notifyDataSetChanged() the app crashes because 
getView() gets called with a position value that's bigger than the dataset, 
i.e., if listItems.size==6, valid values for position should be [0]-[5] but 
getView() is called with 6, so I'm getting index out of bounds when I try 
to access an item in my list. While investigating this I noticed that* 
ListView's getCount() is still returning the old value of 12.*

Details:

...In MyListActivity, which is a ListActivity . . .

public static ListView lv;   // my ListView in the code

... during onCreate() . . .

   setContentView(R.layout.mylist);
   lv = getListView();

create the adapter and bind it . . .

mylistadapter = new MyListAdapter(MyListActivity.this);
setListAdapter(mylistadapter);   // bind the adapter

...the data source is an ArrayList called listItems. The first time around 
it has 12 items in it; later I clear it and add in 6 items. (see below)

public static ArrayListStringlistItems=new ArrayListString();

... in my adapter, which is a BaseAdapter, my override of getCount() looks 
like this. After shrinking listItems to 6 it correctly returns 6.

@Override
public int getCount() {
return listItems.size();
}

... To shrink my dataset to 6 I first do a

listItems.clear();
lv.invalidate();   // my (failed) attempt to get lv to reset its count

... and then add in the 6 new items. After adding each item to listItems I 
do a notifyDataSetChanged() on the adapter. What I've noticed is that if* I 
do an lv.getCount it returns 12, i.e., the value it was before doing the 
listItems.clear()* and invalidate(). Why does the ListView still think it's 
12? How do I reset it? Is that why the adapter thinks it's too big?


-- 
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/d/optout.


[android-developers] listview item layout change in SDK 18?

2014-01-30 Thread Jay Howard
The layout of ListView items seems to have changed in SDK 18.  I've created 
an example project that highlights the different behavior when 
targetSdkVersio = 17 vs. 18:

https://drive.google.com/file/d/0B6DvDY2BvxUTZHUxTHkzNUZvVDg

Additionally I've started a thread on StackOverflow (with screen shots) 
here:

http://stackoverflow.com/questions/21442381/how-to-work-around-change-in-list-item-layout-behavior-change-between-sdk-17-and

Previously another StackOverflow user posted a similar question but got no 
response:

http://stackoverflow.com/questions/17993415/listview-item-layout-differs-between-targetsdkversion-17-and-targetsdkversion

My question:  is there a workaround that would allow me to target SDK 18+ 
but keep the layout behavior from 17?  Maybe manually calling 
layout-related methods on the views in question?

-- 
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 with selected state does not work when list item view has a background

2013-05-21 Thread Miha Valencic
On Tue, May 21, 2013 at 12:11 AM, Miha Valencic miha.valen...@gmail.com wrote:
 In this case, which is the correct state? I now see that
 state_activated works as expected, though as Kostya mentions, it is
 API Level 11 and beyond. Is there an alternatvive for API level 10?

So... I've implemented a couple of verisions (I pushed to github,
previously mentioned): using selector with state_activated, using
custom view for selected item via getView and using custom
Checkable layout, which uses state_checked approach. The
state_activated is what I would go for if it would be at least API
level 10, so between two other options, Checkable layout seems like a
good way to go.

Kostya, how do you handle checked states then? I see two possible solutions:

1) in OnItemClickListener, call adapter.setChecked(position), which
sets the checked item position and then calls notifyDataSetChanged()
2) in OnItemClickListener call setChecked on the view itself plus call
adapter.setChecked(position) and define the checked state in the
getView()

I see option 2 as a minor performance improvement over option1. How
did you handle it?

@Romain, is there a way to use state_activated in API level 10 via
some sort of compatibility package? Could I create such a
compatibility lib myself perhaps?

Regards,
 Miha.

-- 
-- 
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 with selected state does not work when list item view has a background

2013-05-21 Thread Kostya Vasilyev
Miha,

On Tuesday, May 21, 2013 12:57:38 PM UTC+4, Miha wrote:

 Kostya, how do you handle checked states then? I see two possible 
 solutions: 

 1) in OnItemClickListener, call adapter.setChecked(position), which 
 sets the checked item position and then calls notifyDataSetChanged() 
 2) in OnItemClickListener call setChecked on the view itself plus call 
 adapter.setChecked(position) and define the checked state in the 
 getView() 


I call setChecked directly, because my checkbox tracking is in the same 
layout (although it's not a checkbox)

To track selected items (for getView to do the right thing during 
scrolling, and to know what items user actions apply to), I'm using a 
LongSparseArray... Don't think it matters much (except ListView tracks 
checked items by position, whereas I prefer stable database IDs).

I'm not using any choice modes inside ListView, because I also have an 
ActionMode UI implementation for Android 2.*, and it's abstracted away from 
the actual list... I guess the usefulness of sharing this is starting to 
rapidly diminish :)

 


 I see option 2 as a minor performance improvement over option1. How 
 did you handle it? 

 @Romain, is there a way to use state_activated in API level 10 via 
 some sort of compatibility package? Could I create such a 
 compatibility lib myself perhaps? 


In my experience the resource system will filter out attributes that aren't 
present in the actual runtime platform... So for example, you can use 
android:actionBarStyle=... when running on 2.*... and I expect 
android:attr_activated is the same way.

-- K

 


 Regards, 
  Miha. 


-- 
-- 
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 with selected state does not work when list item view has a background

2013-05-21 Thread Miha Valencic
Hi Kostya!

On Tue, May 21, 2013 at 8:37 PM, Kostya Vasilyev kmans...@gmail.com wrote:
 I call setChecked directly, because my checkbox tracking is in the same
 layout (although it's not a checkbox)

 To track selected items (for getView to do the right thing during scrolling,
 and to know what items user actions apply to), I'm using a
 LongSparseArray... Don't think it matters much (except ListView tracks
 checked items by position, whereas I prefer stable database IDs).

In the end, I went with CheckableLinearLayout, implemented
state_checked for it and wired it with an adapter. It works well so
far.

Regards,
 Miha.

-- 
-- 
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 with selected state does not work when list item view has a background

2013-05-20 Thread Justin Anderson
On Thu, May 16, 2013 at 3:14 AM, Miha miha.valen...@gmail.com wrote:

 One possible solution I see is modifying the backing adapter
 implementation and providing a different view based on the state of the
 item, but that seems like wrong approach -- I would have to update the
 adapter with information on the selected item and call
 notifyDataSetChanged, which would (I suppose) result in an unnecessary
 re-drawing of the whole list.


Note though, that it doesn't redraw the ENTIRE list... just the items that
are visible on the screen.  So, even if you have 500 items in your list,
you are only going to be redrawing the 10-20 items that are actually
visible to the user.  I've used this approach before and it works quite
well.

Thanks,
Justin Anderson
MagouyaWare Developer
http://sites.google.com/site/magouyaware

-- 
-- 
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 with selected state does not work when list item view has a background

2013-05-20 Thread Kostya Vasilyev
Maybe it's just me, but...

On Monday, May 20, 2013 6:39:14 PM UTC+4, MagouyaWare wrote:


 On Thu, May 16, 2013 at 3:14 AM, Miha miha.v...@gmail.com 
 javascript:wrote:

 One possible solution I see is modifying the backing adapter 
 implementation and providing a different view based on the state of the 
 item, but that seems like wrong approach -- I would have to update the 
 adapter with information on the selected item and call 
 notifyDataSetChanged, which would (I suppose) result in an unnecessary 
 re-drawing of the whole list.


 Note though, that it doesn't redraw the ENTIRE list... just the items that 
 are visible on the screen.  So, even if you have 500 items in your list, 
 you are only going to be redrawing the 10-20 items that are actually 
 visible to the user.  I've used this approach before and it works quite 
 well.


Implementing highlight through getView, and with a separate view type seems 
awfully backwards, since the framework already has mechanisms for doing 
almost all of it.

A custom list item background should let the standard ListView item 
background show in certain states, e.g. first two states here:

?xml version=1.0 encoding=utf-8?
selector xmlns:android=http://schemas.android.com/apk/res/android;

item android:drawable=@android:color/transparent 
android:state_pressed=true/
item android:drawable=@android:color/transparent 
android:state_selected=true/
item android:drawable=@color/theme_light_message_list_checked 
android:state_checked=true/
item 
android:drawable=@color/theme_light_message_list_read_background/

/selector

Using ListView.drawSelectorOnTop=true would be even easier, but it can have 
some visual side effects (or not... depends on list item view... mine don't 
like this).

The third state is what I use to implement currently selected items 
highlight on Android 2.1 - 4.2, by using setChecked on my item layouts. I 
chose this rather than state_activated, because the latter is API 11 and 
higher.

public class AbsMessageListItemLayout extends RelativeLayout {

  public void setChecked(boolean isChecked) {
 if (mIsChecked != isChecked) {
mIsChecked = isChecked;
refreshDrawableState();
}
  }
 
private static final int[] STATE_CHECKED = new int[] { 
android.R.attr.state_checked };

@Override
protected int[] onCreateDrawableState(int extraSpace) {
int[] baseState = super.onCreateDrawableState(extraSpace + 1);
if (mIsChecked) {
mergeDrawableStates(baseState, STATE_CHECKED);
}
return baseState;
}
}

The final state in the above drawable is application specific (read/unread 
message indication), can be ignored...

-- K



 Thanks,
 Justin Anderson
 MagouyaWare Developer
 http://sites.google.com/site/magouyaware
  

-- 
-- 
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 with selected state does not work when list item view has a background

2013-05-20 Thread Justin Anderson
That is actually more along the lines of what I was talking about, now that
I think about it...  Changing the background color or drawable for a
selected item rather than inflating a completely different view.

I didn't use a selector to do that, but I like that approach better.  I was
simply storing the selected position in the adapter, and then when getView
gets called I would either set the background color or set the background
drawable to what I wanted in the case of the position matching the selected
position.


Thanks,
Justin Anderson
MagouyaWare Developer
http://sites.google.com/site/magouyaware


On Mon, May 20, 2013 at 9:01 AM, Kostya Vasilyev kmans...@gmail.com wrote:

 Maybe it's just me, but...

 On Monday, May 20, 2013 6:39:14 PM UTC+4, MagouyaWare wrote:


 On Thu, May 16, 2013 at 3:14 AM, Miha miha.v...@gmail.com wrote:

 One possible solution I see is modifying the backing adapter
 implementation and providing a different view based on the state of the
 item, but that seems like wrong approach -- I would have to update the
 adapter with information on the selected item and call
 notifyDataSetChanged, which would (I suppose) result in an unnecessary
 re-drawing of the whole list.


 Note though, that it doesn't redraw the ENTIRE list... just the items
 that are visible on the screen.  So, even if you have 500 items in your
 list, you are only going to be redrawing the 10-20 items that are actually
 visible to the user.  I've used this approach before and it works quite
 well.


 Implementing highlight through getView, and with a separate view type
 seems awfully backwards, since the framework already has mechanisms for
 doing almost all of it.

 A custom list item background should let the standard ListView item
 background show in certain states, e.g. first two states here:

 ?xml version=1.0 encoding=utf-8?
 selector xmlns:android=http://schemas.android.com/apk/res/android;

 item android:drawable=@android:color/transparent
 android:state_pressed=true/
 item android:drawable=@android:color/transparent
 android:state_selected=true/
 item android:drawable=@color/theme_light_message_list_checked
 android:state_checked=true/
 item
 android:drawable=@color/theme_light_message_list_read_background/

 /selector

 Using ListView.drawSelectorOnTop=true would be even easier, but it can
 have some visual side effects (or not... depends on list item view... mine
 don't like this).

 The third state is what I use to implement currently selected items
 highlight on Android 2.1 - 4.2, by using setChecked on my item layouts. I
 chose this rather than state_activated, because the latter is API 11 and
 higher.

 public class AbsMessageListItemLayout extends RelativeLayout {

   public void setChecked(boolean isChecked) {
  if (mIsChecked != isChecked) {
  mIsChecked = isChecked;
 refreshDrawableState();
 }
   }

 private static final int[] STATE_CHECKED = new int[] {
 android.R.attr.state_checked };

 @Override
 protected int[] onCreateDrawableState(int extraSpace) {
 int[] baseState = super.onCreateDrawableState(extraSpace + 1);
  if (mIsChecked) {
 mergeDrawableStates(baseState, STATE_CHECKED);
 }
  return baseState;
 }
 }

 The final state in the above drawable is application specific (read/unread
 message indication), can be ignored...

 -- K



 Thanks,
 Justin Anderson
 MagouyaWare Developer
 http://sites.google.com/site/**magouyawarehttp://sites.google.com/site/magouyaware

  --
 --
 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.




-- 
-- 
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 with selected state does not work when list item view has a background

2013-05-20 Thread Miha Valencic
Hi Kostja et al!

On Mon, May 20, 2013 at 5:01 PM, Kostya Vasilyev kmans...@gmail.com wrote:

 Maybe it's just me, but...


No, it's not just you. I also expect that framework should handle this. And
it does, as long as list item layout does not have a background set.

Let me prepare a demo, and I'll post it.

Regards,
 Miha.

-- 
-- 
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 with selected state does not work when list item view has a background

2013-05-20 Thread Romain Guy
The list selector is drawn by default under list items. You can either
change it to draw on top (but you'll have to use custom drawables so the
items are visible underneath) or use a background on your list items with a
selected state.


On Mon, May 20, 2013 at 11:19 AM, Miha Valencic miha.valen...@gmail.comwrote:

 Hi Kostja et al!

 On Mon, May 20, 2013 at 5:01 PM, Kostya Vasilyev kmans...@gmail.comwrote:

 Maybe it's just me, but...


 No, it's not just you. I also expect that framework should handle this.
 And it does, as long as list item layout does not have a background set.

 Let me prepare a demo, and I'll post it.

 Regards,
  Miha.

 --
 --
 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.






-- 
Romain Guy
Android framework engineer
romain...@android.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
--- 
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 with selected state does not work when list item view has a background

2013-05-20 Thread Miha Valencic
Hi everybody!

On Mon, May 20, 2013 at 8:46 PM, Romain Guy romain...@android.com wrote:

 The list selector is drawn by default under list items. You can either change 
 it to draw on top (but you'll have to use custom drawables so the items are 
 visible underneath) or use a background on your list items with a selected 
 state.

I've read that before, only I seem to be doing something wrong. I've
create an ugly sample project
(https://github.com/skyflyer/android_list_selection), where I
demonstrate that when there is no background, list selector is
working, but when there is, list selector is not working, even though
the list item background is set to a drawable which is a selector.

To be more clear, item layout (row.xml) has:

LinearLayout xmlns:android=http://schemas.android.com/apk/res/android;
xmlns:tools=http://schemas.android.com/tools;
android:layout_width=match_parent
android:layout_height=40dp
android:orientation=horizontal
android:background=@drawable/row_background

where row_background is defined like this:

?xml version=1.0 encoding=utf-8?
selector xmlns:android=http://schemas.android.com/apk/res/android; 
item android:state_pressed=true android:drawable=@color/blue /
item android:state_focused=true android:drawable=@color/green /
item android:state_selected=true android:drawable=@color/red /
item android:drawable=@color/white /
/selector

The way I understand this is: row should be white by default. When
pressed, it should be blue (and it is!), and when selected, it should
be red (when list choiceMode is set appropriately). But that is not
the case. The row background stays the same.

Am I misunderstanding this statement: ...or use a background on your
list items with a selected state.?

Romain, if I understand correctly: list selector is drawn under the
item view. So when there is no background (it is transparent), the
list selector shows through. But when list item has a background,
this selector is not visible. Correct? But if I set the background of
the list item to a selector, this selector should match
state_selected that should come into effect, when list item is
selected? (it does not in my case).

Regards,
 Miha.

-- 
-- 
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 with selected state does not work when list item view has a background

2013-05-20 Thread Miha Valencic
On Mon, May 20, 2013 at 9:23 PM, Miha Valencic miha.valen...@gmail.com wrote:
 Am I misunderstanding this statement: ...or use a background on your
 list items with a selected state.?

Also, one more thing: does it even makes sense to use listselector
(setSelector) if the background is a state drawable already?

Miha

-- 
-- 
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 with selected state does not work when list item view has a background

2013-05-20 Thread Romain Guy
The selected state is used when the item is focused using a keyboard. It
has nothing to do with the choice mode.
On May 20, 2013 12:32 PM, Miha Valencic miha.valen...@gmail.com wrote:

 On Mon, May 20, 2013 at 9:23 PM, Miha Valencic miha.valen...@gmail.com
 wrote:
  Am I misunderstanding this statement: ...or use a background on your
  list items with a selected state.?

 Also, one more thing: does it even makes sense to use listselector
 (setSelector) if the background is a state drawable already?

 Miha

 --
 --
 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.




-- 
-- 
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 with selected state does not work when list item view has a background

2013-05-20 Thread Miha Valencic
On Mon, May 20, 2013 at 10:15 PM, Romain Guy romain...@android.com wrote:
 The selected state is used when the item is focused using a keyboard. It
 has nothing to do with the choice mode.

In this case, which is the correct state? I now see that
state_activated works as expected, though as Kostya mentions, it is
API Level 11 and beyond. Is there an alternatvive for API level 10?

Regards,
 Miha.

-- 
-- 
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.




[android-developers] ListView with selected state does not work when list item view has a background

2013-05-16 Thread Miha
Hi!

I'm trying to understand the mechanics behind highlighting the selected 
list item. I have a list fragment, which might display with a secondary 
details fragment if the screen width allows it. In that case, I want to 
highlight the selected list item. In order to do so, the listview has 
defined choice mode of single, and also a defined selector:

listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
listView.setSelector(R.drawable.listitem_selector);

The list uses a custom view for layout, and when the view does not set the 
android:background, the listitem_selector works -- it shows on the 
screen. When the row layout has a background set to a drawable (in my case, 
it is selector, consisting of colors), the listitem_selector does not work. 
I tried the methods explained in the stackoverflow 
posthttp://stackoverflow.com/questions/2562051/listview-item-background-via-custom-selector,
 
but the approach does not work, at least not in my case.

I'm obviously missing a part of the puzzle and I would appreciate any 
insight into this matter.

One possible solution I see is modifying the backing adapter implementation 
and providing a different view based on the state of the item, but that 
seems like wrong approach -- I would have to update the adapter with 
information on the selected item and call notifyDataSetChanged, which would 
(I suppose) result in an unnecessary re-drawing of the whole list.

Regards,
 Miha.

-- 
-- 
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.




[android-developers] ListView selection remained after exit from action mode

2013-04-24 Thread yccheok
The following scenario is not uncommon under activity with list view.

1) Long pressed an item to enter multi-selection mode.
2) Select the desired item, then press an action button. For example, 
delete button.
3) Exit from multi-selection mode (CHOICE_MODE_MULTIPLE) to none-selection 
mode (CHOICE_MODE_NONE).

I tested the following situation under Android 4.1.

1) Scroll the list view to the end till Item 1023 is seen.
2) Long press on Item 1023 to enter action mode.
3) Select Item 1019 till Item 1022. Now, total 5 items is selected 
including Item 1023
4) Scroll up the list, till only the last visible item is Item 1019
5) Pressed delete button on the top right.
6) Scroll up to the top most. 

You will realize along the way, certain rows are being selected. It seems 
that the recycle views's state_activated stage is not being cleared off, 
when we exit from multi-selection mode.

Even though I have the following code

@Override
public void onDestroyActionMode(ActionMode mode) {
// 
http://stackoverflow.com/questions/9754170/listview-selection-remains-persistent-after-exiting-choice-mode
// Using View.post is the key to solve the problem.
final ListView listView = MainActivity.this.getListView();
listView.clearChoices();
for (int i = 0, ei = listView.getChildCount(); i  ei; i++) {
listView.setItemChecked(i, false);
}
listView.post(new Runnable() {
@Override
public void run() {
listView.setChoiceMode(ListView.CHOICE_MODE_NONE);
}
});
actionMode = null;
}


It doesn't help much.

Any workaround on this long standing bug? 


   - 
   
http://stackoverflow.com/questions/9754170/listview-selection-remains-persistent-after-exiting-choice-mode
   - 
   
https://groups.google.com/forum/?fromgroups=#!topic/android-developers/TDG9-yP5ddg

Is this being reported in Android bug ticketing? 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
--- 
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.




[android-developers] ListView selection remained after exit from action mode

2013-04-24 Thread yccheok
The following scenario is not uncommon under activity with list view.

1) Long pressed an item to enter multi-selection mode.
2) Select the desired item, then press an action button. For example, 
delete button.
3) Exit from multi-selection mode (CHOICE_MODE_MULTIPLE) to none-selection 
mode (CHOICE_MODE_NONE).

I tested the following situation under Android 4.1.

1) Scroll the list view to the end till Item 1023 is seen.
2) Long press on Item 1023 to enter action mode.
3) Select Item 1019 till Item 1022. Now, total 5 items is selected 
including Item 1023
4) Scroll up the list, till only the last visible item is Item 1019
5) Pressed delete button on the top right.
6) Scroll up to the top most. 

You will realize along the way, certain rows are being selected. It seems 
that the recycle views's state_activated stage is not being cleared off, 
when we exit from multi-selection mode.

Even though I have the following code

@Override
public void onDestroyActionMode(ActionMode mode) {
// 
http://stackoverflow.com/questions/9754170/listview-selection-remains-persistent-after-exiting-choice-mode
// Using View.post is the key to solve the problem.
final ListView listView = MainActivity.this.getListView();
listView.clearChoices();
for (int i = 0, ei = listView.getChildCount(); i  ei; i++) {
listView.setItemChecked(i, false);
}
listView.post(new Runnable() {
@Override
public void run() {
listView.setChoiceMode(ListView.CHOICE_MODE_NONE);
}
});
actionMode = null;
}


It doesn't help much.

Any workaround on this long standing bug? 


   - 
   
http://stackoverflow.com/questions/9754170/listview-selection-remains-persistent-after-exiting-choice-mode
   - 
   
https://groups.google.com/forum/?fromgroups=#!topic/android-developers/TDG9-yP5ddg

Is this being reported in Android bug ticketing? Thanks.

I include a complete workable code to demonstrate this 
bug. https://www.dropbox.com/s/t5zgadtz9q61j00/multimode_bug.zip



-- 
-- 
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.




[android-developers] ListView Navigation

2013-03-12 Thread arazlam101
I have a basic question. On my main screen there is a listview which should 
navigates to another listview. It is like a category and then subcategory 
choice screen. For each subcategory view, should I create new activity or 
can I pass the position value from first listview to create second 
appropriate list ? 

-- 
-- 
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.




[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 Navigation

2013-03-12 Thread Nirav Parmar
In my opinion creating new activity or fragment will be better choice.
If you will just change the content in list.I am afraid how you will return
back from that subcategory to category as back will end that activity.


On Sun, Mar 10, 2013 at 12:19 AM, arazlam...@gmail.com wrote:

 I have a basic question. On my main screen there is a listview which
 should navigates to another listview. It is like a category and then
 subcategory choice screen. For each subcategory view, should I create new
 activity or can I pass the position value from first listview to create
 second appropriate list ?

 --
 --
 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.




-- 
-- 
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.




[android-developers] ListView background

2013-02-28 Thread bob
 

When I'm scrolling my white ListView, for some reason, the background turns 
black.


Any ideas what could cause this?


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
--- 
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 background

2013-02-28 Thread Romain Guy
Hey bob,

Here's a blog post I wrote on the topic a while back:
http://android-developers.blogspot.com/2009/01/why-is-my-list-black-android.html


On Thu, Feb 28, 2013 at 12:18 PM, bob b...@coolfone.comze.com wrote:

 When I'm scrolling my white ListView, for some reason, the background
 turns black.


 Any ideas what could cause this?


 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
 ---
 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.






-- 
Romain Guy
Android framework engineer
romain...@android.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
--- 
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.




[android-developers] ListView and SimpleAdapter: how to set different background image.

2013-02-11 Thread Summer
Here is the part of the code:
I am trying to set different background image based on another text view 
field. How to access another text view content in *setViewValue*?
Many thanks!

protected void onPostExecute(Voucher result) {
 final ListAdapter adapter = new SimpleAdapter(list.getContext(), 
displaylist,
  R.layout.list_item,
   new String[] {text1, text2, button1}, new int[] {
  R.id.text1, R.id.text2, R.id.button1});
  ((SimpleAdapter) adapter).setViewBinder(new 
SimpleAdapter.ViewBinder() {

public boolean setViewValue(final View view, Object data, 
String textRepresentation) {
if(view.getId() == R.id.text1) {
   //do something here
  TextView x 
=(TextView) view;
  
 x.setText(data.toString());
return true;
}
if(view.getId() == R.id.button1)
{
 
*  //???How to set image background 
based on Text field text1's value?*
* * ImageButton ib = (ImageButton) 
view.findViewById(R.id.button1);
  *  //How to access the text 
content of text1 here?*
 
}

-- 
-- 
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.




[android-developers] ListView content thread sync cases

2013-01-25 Thread Bill Michaelson
I have a Service that runs a distinct Thread to update a list based on 
external events.  This list is simultaneously used to back ListViews in 
associated Activities.  The Activities may also update the list based on UI 
events.

I need to provide appropriate synchronization.  I have coded a provision to 
send update events from the Service to the Activity(ies) via Message thru 
Handler.  Thus, I believe I can assure that the actual updates to the data 
in the list occur in the UI thread which should work properly when the 
Activity is running.

But when the Activity is not running for whatever reason (not started, 
destroyed, etc.), I need to have the Service update the list directly.  
This is not a problem either; the Activity can find the revised list 
content to create the ListView when it (re)starts.

But my problem is that I want to find a reasonable mechanism for all 
dynamic states, especially during transition, or in other words:

   - signal to the Service that the Activity is running and should be used 
   to process an update
  - in such case assure that the update completes (i.e. that the 
  Activity is not destroyed after the Message is passed, but before it is 
  processed)
   - otherwise signal that the Service must process the update in the 
   absence of the Activity
  - in such case assure that the Activity does not start and attempt to 
  build a ListView prior to list content update completion by the Service
   
I suspect this pattern of synchronization has been accomplished by others.  
Advice appreciated.


-- 
-- 
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 select a row

2013-01-25 Thread dashman
I have a ListView with a ListAdapter.

When the user clicks on a row - i'd like to show that row as selected
(i.e. hilighted).

actually make it a toggle.

how do i do that.

-- 
-- 
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 select a row

2013-01-25 Thread TreKing
On Fri, Jan 25, 2013 at 11:53 AM, dashman erjdri...@gmail.com wrote:

 I have a ListView with a ListAdapter.

 When the user clicks on a row - i'd like to show that row as selected
 (i.e. hilighted).

 actually make it a toggle.

 how do i do that.


Keep the selection state as part of your data model. Your getView for the
adapter then changes the highlight depending on whether the item is
selected or not.

-
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




Re: [android-developers] ListView select a row

2013-01-25 Thread dashman
Thanks I will do that.

There seems to be api for selectedIndex etc - but not sure what they're 
for??

How can I find the hi-light color (based on the current active theme).




On Friday, January 25, 2013 1:46:06 PM UTC-5, TreKing wrote:


 On Fri, Jan 25, 2013 at 11:53 AM, dashman erjd...@gmail.com javascript:
  wrote:

 I have a ListView with a ListAdapter.

 When the user clicks on a row - i'd like to show that row as selected
 (i.e. hilighted).

 actually make it a toggle.

 how do i do that.


 Keep the selection state as part of your data model. Your getView for 
 the adapter then changes the highlight depending on whether the item is 
 selected or not.


 -
 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




Re: [android-developers] ListView select a row

2013-01-25 Thread Kostya Vasilyev


On Friday, January 25, 2013 11:57:17 PM UTC+4, dashman wrote:

 Thanks I will do that.

 There seems to be api for selectedIndex etc - but not sure what they're 
 for??


They're for keeping track of user selected items.

For example, listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE) will 
maintain at most one item as selected.

The selection state is propagated into your item layouts as 
android:state_checked (all Android versions, requires that the item layout 
implements Checkable) or android:state_activated (Android 3.0 and above). 
You can provide visual indication of those states by using a state list 
drawable.

http://developer.android.com/reference/android/graphics/drawable/StateListDrawable.html
 


 How can I find the hi-light color (based on the current active theme).


Theme attributes: activatedBackgroundIndicator (3.0 and 
above), colorActivatedHighlight (4.0 and above).

-- K
 





 On Friday, January 25, 2013 1:46:06 PM UTC-5, TreKing wrote:


 On Fri, Jan 25, 2013 at 11:53 AM, dashman erjd...@gmail.com wrote:

 I have a ListView with a ListAdapter.

 When the user clicks on a row - i'd like to show that row as selected
 (i.e. hilighted).

 actually make it a toggle.

 how do i do that.


 Keep the selection state as part of your data model. Your getView for 
 the adapter then changes the highlight depending on whether the item is 
 selected or not.


 -
 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




Re: [android-developers] ListView select a row

2013-01-25 Thread dashman
having trouble setting it.

ListView
android:id=@+id/listView

android:listSelector=@android:drawable/activatedBackgroundIndicator
android:layout_width=match_parent
android:layout_height=match_parent 
/ListView

not working - what am i doign wrong

-- 
-- 
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 select a row

2013-01-25 Thread Kostya Vasilyev
You need to set this on list items as the background, not on the list
view. And the syntax is ?android:attr/blahblah, you want to
reference a theme attribute.

-- K

2013/1/26 dashman erjdri...@gmail.com:
 having trouble setting it.

 ListView
 android:id=@+id/listView

 android:listSelector=@android:drawable/activatedBackgroundIndicator
 android:layout_width=match_parent
 android:layout_height=match_parent 
 /ListView

 not working - what am i doign wrong


 --
 --
 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 select a row

2013-01-25 Thread dashman
here's what i'm trying now - in my theme file

style name=AppBaseTheme parent=android:Theme.Holo.Light
!-- API 11 theme customizations can go here. --

item name=my_color?android:attr/selectableItemBackground/item
/style

where my_color is defined in attrs.xml as

 attr name=my_color format=reference /


can i retrieve the color in my code - if so how?


-- 
-- 
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 layout shows huge gap in space between each items

2013-01-23 Thread John Merlino
I have an xml layout with a listview item in it that looks like this:

LinearLayout xmlns:android=http://schemas.android.com/apk/res/
android
android:layout_width=fill_parent
android:layout_height=fill_parent
android:background=#F7681D
android:clickable=false
android:orientation=vertical
android:paddingLeft=10dp
android:paddingRight=10dp
android:paddingTop=10dp
android:scrollbars=vertical
android:weightSum=1 

RelativeLayout
android:id=@+id/relativeLayout1
android:layout_width=fill_parent
android:layout_height=0dp
android:layout_above=@+id/linearLayout1_ref
android:layout_alignLeft=@+id/linearLayout1
android:layout_below=@+id/linearLayout1
android:layout_weight=0.93
android:background=@drawable/bg
android:paddingBottom=10dp 

LinearLayout
android:id=@+id/title_layout
android:layout_width=fill_parent
android:layout_height=wrap_content
android:layout_alignParentTop=true
android:background=@drawable/topbox 
/LinearLayout



 TextView
android:layout_width=fill_parent
android:layout_height=wrap_content
android:text=
android:id=@+id/time
/
 TextView
android:layout_width=fill_parent
android:layout_height=wrap_content
android:text=
android:id=@+id/alert/

 ListView
 android:id=@+id/SCHEDULE
 android:layout_width=fill_parent
 android:layout_height=fill_parent
 android:layout_below=@+id/title_layout
 android:layout_margin=0dp
 android:background=@android:color/white
 android:cacheColorHint=#
 android:divider=@android:color/transparent
 android:fadeScrollbars=false
   android:paddingLeft=5dp
android:paddingRight=5dp
android:paddingBottom=2dp
android:paddingTop=2dp
 android:scrollbarSize=2dp
 android:scrollbarStyle=insideOverlay
 android:scrollbarThumbHorizontal=@drawable/
scrollingbar_thumbb
 android:scrollbarTrackVertical=@drawable/
scrollingbar_trackk 

 /ListView
 /RelativeLayout

For some reason each of the items contain a huge space vertically
between them. And I am not sure how I can bring the items closer
together to look like a proper list.

-- 
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 layout shows huge gap in space between each items

2013-01-23 Thread Boyd Speer
Try removing the paddingTop=10 lines

On 2013-01-23, at 7:03 PM, John Merlino stoici...@aol.com wrote:

 I have an xml layout with a listview item in it that looks like this:
 
 LinearLayout xmlns:android=http://schemas.android.com/apk/res/
 android
android:layout_width=fill_parent
android:layout_height=fill_parent
android:background=#F7681D
android:clickable=false
android:orientation=vertical
android:paddingLeft=10dp
android:paddingRight=10dp
android:paddingTop=10dp
android:scrollbars=vertical
android:weightSum=1 
 
RelativeLayout
android:id=@+id/relativeLayout1
android:layout_width=fill_parent
android:layout_height=0dp
android:layout_above=@+id/linearLayout1_ref
android:layout_alignLeft=@+id/linearLayout1
android:layout_below=@+id/linearLayout1
android:layout_weight=0.93
android:background=@drawable/bg
android:paddingBottom=10dp 
 
LinearLayout
android:id=@+id/title_layout
android:layout_width=fill_parent
android:layout_height=wrap_content
android:layout_alignParentTop=true
android:background=@drawable/topbox 
/LinearLayout
 
 
 
  TextView
 android:layout_width=fill_parent
 android:layout_height=wrap_content
 android:text=
 android:id=@+id/time
 /
 TextView
 android:layout_width=fill_parent
 android:layout_height=wrap_content
 android:text=
 android:id=@+id/alert/
 
 ListView
 android:id=@+id/SCHEDULE
 android:layout_width=fill_parent
 android:layout_height=fill_parent
 android:layout_below=@+id/title_layout
 android:layout_margin=0dp
 android:background=@android:color/white
 android:cacheColorHint=#
 android:divider=@android:color/transparent
 android:fadeScrollbars=false
   android:paddingLeft=5dp
android:paddingRight=5dp
android:paddingBottom=2dp
android:paddingTop=2dp
 android:scrollbarSize=2dp
 android:scrollbarStyle=insideOverlay
 android:scrollbarThumbHorizontal=@drawable/
 scrollingbar_thumbb
 android:scrollbarTrackVertical=@drawable/
 scrollingbar_trackk 
 
 /ListView
 /RelativeLayout
 
 For some reason each of the items contain a huge space vertically
 between them. And I am not sure how I can bring the items closer
 together to look like a proper list.
 
 -- 
 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


[android-developers] [ListView] How can I animate one single ListView item (entry) dynamically ?

2013-01-07 Thread Maruen
Hi dear Engineers,

Here's the issue: I have this main ListView (retrieved using 
this.getListView() ) in a ListActivity properly populated from a SQLite 
database. A click on one of its items (entries) calls another activity A2 
using startActivityForResult(). I would like to animate that SINGLE entry 
WHEN the user gets back to the ListActivity. (So I suppose I need to 
override the onActivityResult() method)

How can I animate a single entry after the list is already updated using 
notifyDataSetChanged() ? I managed to animate the whole ListView using 
getListView().setAnimation(anim) and worked fine. However, when I 
do: getListView().getChildAt(position).setAnimation(anim) nothing happens.

Please help.

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 inside gridview

2013-01-07 Thread louis


這是一個樣品的日曆使用 GridView控件 ,現在我想在日曆的“天”添加新的東西,所以我想我可以使用 ListView的 
佈局,在一個月的一天,現在我有一個問題,我的listview 
not scrolling !

-- 
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 with Editable components

2012-12-11 Thread Leonardo Aramaki
Hi,
I read on the wild some people saying that it's not a good thing to have
EditTexts inside a ListView. Something related to focus issues.

That being said, what I would like to know is if it's a design issue of the
engineers not to do things this way, or just some devs personal opinions?

Leonardo

-- 
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 one item per screen

2012-12-11 Thread Dmitriy F


Since 
DirectionalViewPagerhttps://github.com/JakeWharton/Android-DirectionalViewPager
 is 
deprecated now, I need some way to mimic its' vertical paging functionlity.

First thing that comes to my mind is ListView, but I'd like some tips for 
implementing row per screen funcitonality - where do I start ?

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: row content independent clickable areas

2012-10-29 Thread Marcin Orlowski
Hi,

I am trying to achieve listview row layout that would let me use click
areas (views i could bind OnClickListener to) no matter on real row
content. I do not want to use OnTouchListener, so my attempt is based on
using RelativeLayout and overlay real row content with click areas. But
for some odd reasons I am unable to make it work, desipie recent beta of
ADT shows the layout as expected. When deployed on device it does not work.

Any notes, ideas or hints highly appreciated.

I asked that question on StackOveflow:
http://stackoverflow.com/questions/13108968/listview-row-content-independent-clickable-areasso
here's copy of that question:


--


I got listview's row layout like this (this is stripped down version of my
real layout so do not comment of things like single elements wrapped in
LinearLayout etc. - it just to illustrate the issue - final version got
more elements there):

[image: Inline images 1]


XML file is below for reference, but I shortly describe what I want to
achieve:

   - blue box (icon) and usually long text here TextView are row real
   content (item_main_container). It can be anything - it shall be
   irrelevant. This layer content is not clickable.
   - the red and green boxes are views I bind row's OnCliclListeners to
   (wrapped in item_click_area_container)- I just want user to be able to
   tap on the row, no matter what's item_main_container's content really is
   (so these red/green are transparent in the app). These are set transparent
   on the image so you can see item_main_content thru it). Please note red
   and green represent *separate* actions. I need to be able to have more
   elements on that layers (i.e. 4 or 5) to handle separate actions depending
   on where user tapped.
   - the yellow area (button_bar_container) holds buttons user may want to
   tap.

So basically item_click_area_container overlays item_main_container, but
not button_bar_container, which is above
item_click_area_containerotherwise user would not be able to tap on
any of its button.

Layout outline looks like this:

[image: Inline images 2]


*QUESTIONS*

   1. Why this is not working as expected and/or how to fix that?
   2. Is there any better way of having content independent click areas
   than using approach like mine item_click_area_container without using
   OnTouchListener?


--

*Layout XML*

?xml version=1.0 encoding=utf-8?LinearLayout
xmlns:android=http://schemas.android.com/apk/res/android;
android:id=@+id/item_container
android:layout_width=fill_parent
android:layout_height=fill_parent
android:orientation=vertical

RelativeLayout
android:layout_width=fill_parent
  android:layout_height=wrap_content

LinearLayout
android:id=@+id/item_main_container
android:layout_width=fill_parent
android:layout_height=wrap_content

ImageView
   android:id=@+id/item_avatar
   android:layout_width=40dp
   android:layout_height=40dp
   android:background=#ff
   android:src=@drawable/icon_help/

LinearLayout
   android:layout_width=fill_parent
   android:layout_height=wrap_content
   android:orientation=vertical

   TextView android:id=@+id/item_body
 android:layout_width=fill_parent
 android:layout_height=fill_parent
 android:text=Usually long text here...
 android:textColor=#ff/
/LinearLayout

/LinearLayout

LinearLayout
   android:id=@+id/item_click_area_container
   android:layout_width=fill_parent
   android:layout_height=100dp
LinearLayout
   android:id=@+id/green_click
   android:layout_width=fill_parent
   android:layout_height=fill_parent
   android:layout_weight=1
   android:background=#7700ff00
/LinearLayout
LinearLayout
   android:id=@+id/red_click
   android:layout_width=fill_parent
   android:layout_height=fill_parent
   android:layout_weight=2
   android:background=#77ff
/LinearLayout
/LinearLayout

/RelativeLayout

LinearLayout
   android:id=@+id/button_bar_container
   android:layout_width=fill_parent
   android:layout_height=50dp
   android:layout_marginTop=3dp
   android:background=#00
/LinearLayout
/LinearLayout

-- 
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

[android-developers] ListView doesn't refresh when last item is deleted

2012-10-19 Thread Jacek Jabłoński
Hi,

I have problem in my app. I have CursorLoader in conjcution with
CursorAdapter. Everything works as expected, except one condition: when I
have some items on ListView and I swap cursor in adapter for cursor that is
empty, visible items aren't deleted (only dividers between rows disappear).
When I touch ListView it disappears instantly.

Here is the situation. I have some non empty cursor:

http://i.stack.imgur.com/VhvEb.png

Then I swap for cursor that has no results:

http://i.stack.imgur.com/uT6pP.png





As you can see only dividers disappeard. After touching the screen both
items disappear.

Source of my fragment class: http://pastebin.com/N2YGzgRj

Please help me to solve this problem, because I have no idea what is
causing it.

Greetings,

Jacek Jabłoński

-- 
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 doesn't refresh when last item is deleted

2012-10-19 Thread Justin Anderson
I've never used a cursor with an adapter, but in general, when your adapter
changes you need to call notifyDataSetChanged() on your adapter to let it
know that the data needs to be refreshed... The adapter will then tell the
listview it needs to update itself.

Also, you shouldn't have to set the adapter on the listview when you swap
out the data... just call notifyDataSetChanged().

Thanks,
Justin Anderson
MagouyaWare Developer
http://sites.google.com/site/magouyaware


On Fri, Oct 19, 2012 at 10:43 AM, Jacek Jabłoński andr...@hydroid.plwrote:

 Hi,

 I have problem in my app. I have CursorLoader in conjcution with
 CursorAdapter. Everything works as expected, except one condition: when I
 have some items on ListView and I swap cursor in adapter for cursor that is
 empty, visible items aren't deleted (only dividers between rows disappear).
 When I touch ListView it disappears instantly.

 Here is the situation. I have some non empty cursor:

 http://i.stack.imgur.com/VhvEb.png

 Then I swap for cursor that has no results:

 http://i.stack.imgur.com/uT6pP.png





 As you can see only dividers disappeard. After touching the screen both
 items disappear.

 Source of my fragment class: http://pastebin.com/N2YGzgRj

 Please help me to solve this problem, because I have no idea what is
 causing it.

 Greetings,

 Jacek Jabłoński

 --
 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 doesn't refresh when last item is deleted

2012-10-19 Thread Jacek Jabłoński
Thanks for your reply. I've tried notifyDataSetChanged() previously, but it
doesn't do the work. The only situation with refreshing ListView problem is
only when I swap cursor for cursor that doesn't contain any elements.
I think, I need toswap out the data because I am using CursorLoader.

Thanks,
Jacek

2012/10/19 Justin Anderson magouyaw...@gmail.com

 I've never used a cursor with an adapter, but in general, when your
 adapter changes you need to call notifyDataSetChanged() on your adapter to
 let it know that the data needs to be refreshed... The adapter will then
 tell the listview it needs to update itself.

 Also, you shouldn't have to set the adapter on the listview when you swap
 out the data... just call notifyDataSetChanged().

 Thanks,
 Justin Anderson
 MagouyaWare Developer
 http://sites.google.com/site/magouyaware


 On Fri, Oct 19, 2012 at 10:43 AM, Jacek Jabłoński andr...@hydroid.plwrote:

 Hi,

 I have problem in my app. I have CursorLoader in conjcution with
 CursorAdapter. Everything works as expected, except one condition: when I
 have some items on ListView and I swap cursor in adapter for cursor that is
 empty, visible items aren't deleted (only dividers between rows disappear).
 When I touch ListView it disappears instantly.

 Here is the situation. I have some non empty cursor:

 http://i.stack.imgur.com/VhvEb.png

 Then I swap for cursor that has no results:

 http://i.stack.imgur.com/uT6pP.png





 As you can see only dividers disappeard. After touching the screen both
 items disappear.

 Source of my fragment class: http://pastebin.com/N2YGzgRj

 Please help me to solve this problem, because I have no idea what is
 causing it.

 Greetings,

 Jacek Jabłoński

 --
 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

-- 
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 with Scrollbar

2012-10-17 Thread gd
I have an activity containig an imageview and a listview below imageview 
within a scrollbar. The problem is when i scroll up to see the listview 
items and just after that when i go to back or home screen and returns 
again to that screen the listview has seen in the front of the screen 
instead of the imageview..  
what should i do so that whenever i go to this activity imageview always 
should be first to view in front of the screen

-- 
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 - Header , footer issue

2012-10-09 Thread Jovish P
In one of screen  we want to come up with a desing like this

Textview
Listview
Textview
Listview

First we thought of putting everything inside a linear layout with vertical
orientation and put that layout inside
a scroll view. Then we come to know that it is not a good idea. So right
now what we are trying to do is
add header and footer for listview. Header view will be a text view and
footer view will be a layout which conatins
a texview and listview. The problem what we are facing now is ,  we are not
able to scroll the second listview which is in
footerview layout. Is it a good solution ? If not wht is the best way to do
this ? Share your thoughts about this.

-- 
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 row button click

2012-10-05 Thread vani reddy
HI,

I have a listview which has a button in each row  of listview,What I am
doing is on click of  2 nd row button I am disabling it, after scrolling
the listview  whe i come back to 2nd row of listview , even  buttons in the
3rd and 4th row are  also disabled, though i did not disable them.

How to overcome this problem??
-- 
Regards,
Vani Reddy

-- 
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 row button click

2012-10-05 Thread rambabu mareedu
 Here the problem is you inflating only one xml file in each view , so if
your disabling button in one view it will effect in all views.

-- 
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 row button click

2012-10-05 Thread Justin Anderson

 Here the problem is you inflating only one xml file in each view , so if
 your disabling button in one view it will effect in all views.

This is not the reason for the problem...

I have a listview which has a button in each row  of listview,What I am
 doing is on click of  2 nd row button I am disabling it, after scrolling
 the listview  whe i come back to 2nd row of listview , even  buttons in the
 3rd and 4th row are  also disabled, though i did not disable them.


This is very likely due to view recycling, which is used to help the
listview scoll efficiently when there is a large amount of data.

Fixing this problem is a multi-step process:

   1. Keep track of the button state (enabled/disabled) in the adapter
   2. When a button is clicked, set the state in the adapter and call
   notifyDataSetChanged()
   3. In the getView() method of your adapter, set the state of the button
   based on the adapter data


It would also be beneficial to implement the ViewHolder pattern... You can
find many examples online by searching for something like Android
ViewHolder Pattern

Thanks,
Justin Anderson
MagouyaWare Developer
http://sites.google.com/site/magouyaware


On Fri, Oct 5, 2012 at 2:39 AM, rambabu mareedu
rambabu.mare...@gmail.comwrote:

 Here the problem is you inflating only one xml file in each view , so if
 your disabling button in one view it will effect in all views.

-- 
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 | Full Code | Cannot capture item click!

2012-09-20 Thread Chance Sanders
Guys, I'm having one hell of a time here trying to listen for the 'on 
click' for this ListView. Every single thing I've seen when searching 
Google, I've tried (or at least think I've tried). I've even set the 
TextView and ImageView in the XML to not be clickable or focusable, but 
that didn't work either.

I'm not at all opposed to completely rewriting the code, or the XML. What 
I'm looking for is a scrolling list with a thumbnail picture and a piece of 
text. I will be using a JSON response to fill the ImageView and some way to 
reference what was clicked so that I can open a new activity to display the 
larger sized photo and whatnot. But, since I'm incredibly new on the scene 
of Android app development, I finally caved to ask. 

Any help would be greatly appreciated.

MyGames.java


package com.lifeofchance.bpt;


import android.app.Activity;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;

public class MyGames extends Activity {

TextView btnDashboard;


String[] text = {
One, Two, Three, Four, Five, Six, Seven, Eight, 
Nine, Ten
};

int[] image = {
R.drawable.color_line,
R.drawable.color_line,
R.drawable.color_line,
R.drawable.color_line,
R.drawable.color_line,
R.drawable.color_line,
R.drawable.color_line,
R.drawable.color_line,
R.drawable.color_line,
R.drawable.color_line
};

String[] gameId = {
12345, 32165, 65498, 98732, 14789, 36987
};

public void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);
setContentView(R.layout.mygames);

ListView l1 = (ListView) findViewById(R.id.listV);
l1.setAdapter(new MyCustomAdapter(text, image, gameId));


btnDashboard = (TextView) findViewById(R.id.btnDashboard);
btnDashboard.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
Intent i = new Intent(getApplicationContext(), 
DashboardActivity.class);
startActivity(i);
finish();
}
});

}


class MyCustomAdapter extends BaseAdapter {

String[] data_text;
int[] data_image;
String[] data_id;

MyCustomAdapter() {
data_text = null;
data_image = null;
data_id = null;
}

MyCustomAdapter(String[] text, int[] image, String[] gameId) {
data_text = text;
data_image = image;
data_id = gameId;
}


public int getCount() {
return data_text.length;
}

public String getItem(int position) {
return null;
}

public long getItemId(int position) {
return position;
}

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

LayoutInflater inflater = getLayoutInflater();
View row;

row = inflater.inflate(R.layout.mygames_listview, parent, 
false);
row.setLongClickable(true);
row.setClickable(true);
row.setFocusable(true);

TextView textview = (TextView) 
row.findViewById(R.id.TextView01);
ImageView imageview = (ImageView) 
row.findViewById(R.id.ImageView01);

textview.setText(data_text[position]);
imageview.setImageResource(data_image[position]);


return (row);

}

}

}

mygames_listview.xml
___

?xml version=1.0 encoding=utf-8?

LinearLayout xmlns:android=http://schemas.android.com/apk/res/android;
android:layout_height=68dp
android:gravity=left|center
android:layout_width=fill_parent
android:paddingBottom=5dp
android:background=#9CCF31
android:paddingTop=5dp
android:paddingLeft=5dp

ImageView android:id=@+id/ImageView01
android:layout_width=64dp
android:layout_height=wrap_content
/ImageView

TextView android:id=@+id/TextView01
android:layout_width=wrap_content
android:layout_height=wrap_content
android:textSize=20dp
android:textStyle=bold
android:layout_marginLeft=10dp
android:textColor=#0099CC
/TextView

/LinearLayout


And finally, mygames.xml
_

?xml version=1.0 encoding=utf-8?
RelativeLayout android:id=@+id/RelativeLayout1
android:layout_width=fill_parent
android:layout_height=fill_parent
android:fillViewport=true 
xmlns:android=http://schemas.android.com/apk/res/android;

RelativeLayout
android:id=@+id/RelativeLayout2
android:layout_width=fill_parent

Re: [android-developers] ListView | Full Code | Cannot capture item click!

2012-09-20 Thread Justin Anderson
Maybe I missed it, but I don't see anywhere in your code that you are even
trying to capture a click event for the items in the listview...

https://developer.android.com/reference/android/widget/AdapterView.html#setOnItemClickListener%28android.widget.AdapterView.OnItemClickListener%29

Thanks,
Justin Anderson
MagouyaWare Developer
http://sites.google.com/site/magouyaware


On Thu, Sep 20, 2012 at 4:13 AM, Chance Sanders chance.sand...@gmail.comwrote:

 Guys, I'm having one hell of a time here trying to listen for the 'on
 click' for this ListView. Every single thing I've seen when searching
 Google, I've tried (or at least think I've tried). I've even set the
 TextView and ImageView in the XML to not be clickable or focusable, but
 that didn't work either.

 I'm not at all opposed to completely rewriting the code, or the XML. What
 I'm looking for is a scrolling list with a thumbnail picture and a piece of
 text. I will be using a JSON response to fill the ImageView and some way to
 reference what was clicked so that I can open a new activity to display the
 larger sized photo and whatnot. But, since I'm incredibly new on the scene
 of Android app development, I finally caved to ask.

 Any help would be greatly appreciated.

 MyGames.java
 

 package com.lifeofchance.bpt;


 import android.app.Activity;
 import android.content.DialogInterface;
 import android.content.DialogInterface.OnClickListener;
 import android.content.Intent;
 import android.os.Bundle;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
 import android.widget.AdapterView;
 import android.widget.AdapterView.OnItemClickListener;
 import android.widget.BaseAdapter;
 import android.widget.ImageView;
 import android.widget.ListView;
 import android.widget.TextView;
 import android.widget.Toast;

 public class MyGames extends Activity {

 TextView btnDashboard;


 String[] text = {
 One, Two, Three, Four, Five, Six, Seven, Eight,
 Nine, Ten
 };

 int[] image = {
 R.drawable.color_line,
 R.drawable.color_line,
 R.drawable.color_line,
 R.drawable.color_line,
 R.drawable.color_line,
 R.drawable.color_line,
 R.drawable.color_line,
 R.drawable.color_line,
 R.drawable.color_line,
 R.drawable.color_line
 };

 String[] gameId = {
 12345, 32165, 65498, 98732, 14789, 36987
 };

 public void onCreate(Bundle savedInstanceState) {

 super.onCreate(savedInstanceState);
 setContentView(R.layout.mygames);

 ListView l1 = (ListView) findViewById(R.id.listV);
 l1.setAdapter(new MyCustomAdapter(text, image, gameId));


 btnDashboard = (TextView) findViewById(R.id.btnDashboard);
 btnDashboard.setOnClickListener(new View.OnClickListener() {
 public void onClick(View view) {
 Intent i = new Intent(getApplicationContext(),
 DashboardActivity.class);
 startActivity(i);
 finish();
 }
 });

 }


 class MyCustomAdapter extends BaseAdapter {

 String[] data_text;
 int[] data_image;
 String[] data_id;

 MyCustomAdapter() {
 data_text = null;
 data_image = null;
 data_id = null;
 }

 MyCustomAdapter(String[] text, int[] image, String[] gameId) {
 data_text = text;
 data_image = image;
 data_id = gameId;
 }


 public int getCount() {
 return data_text.length;
 }

 public String getItem(int position) {
 return null;
 }

 public long getItemId(int position) {
 return position;
 }

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

 LayoutInflater inflater = getLayoutInflater();
 View row;

 row = inflater.inflate(R.layout.mygames_listview, parent,
 false);
 row.setLongClickable(true);
 row.setClickable(true);
 row.setFocusable(true);

 TextView textview = (TextView)
 row.findViewById(R.id.TextView01);
 ImageView imageview = (ImageView)
 row.findViewById(R.id.ImageView01);

 textview.setText(data_text[position]);
 imageview.setImageResource(data_image[position]);


 return (row);

 }

 }

 }

 mygames_listview.xml
 ___

 ?xml version=1.0 encoding=utf-8?

 LinearLayout xmlns:android=http://schemas.android.com/apk/res/android;
  android:layout_height=68dp
 android:gravity=left|center
 android:layout_width=fill_parent
  android:paddingBottom=5dp
 android:background=#9CCF31
 android:paddingTop=5dp
  android:paddingLeft=5dp

 ImageView android:id=@+id/ImageView01
  android:layout_width=64dp
 android:layout_height=wrap_content
 /ImageView

 TextView 

[android-developers] Listview Selector

2012-09-12 Thread Lars
Hi i got a problem with a listview,
how can i get to change the state when my listview item is selected (in the 
use of multipane view)
i only need to change that state the other states like pressed and things i 
like to keep default

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

Re: [android-developers] Listview Selector

2012-09-12 Thread Kostya Vasilyev
Here is how I do it:


?xml version=1.0 encoding=utf-8?
selector xmlns:android=http://schemas.android.com/apk/res/android;

item android:drawable=@android:color/transparent
android:state_pressed=true/
item android:drawable=@android:color/transparent
android:state_selected=true/
item android:drawable=@color/message_list_read_background_light/

/selector

-- K

2012/9/12 Lars werkman.l...@gmail.com

 Hi i got a problem with a listview,
 how can i get to change the state when my listview item is selected (in
 the use of multipane view)
 i only need to change that state the other states like pressed and things
 i like to keep default

 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

-- 
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 simple_list_item_activated_1 behaviour

2012-09-05 Thread Pankaj Chawla
Hi 

So ListView has a item layout 'simple_list_item_activated_1' which when used 
with 
ListView.CHOICE_MODE_SINGLE causes the item to stay activated causing a 
background 
highlight. ApiDemos has a sample under Lists/List17. 

The same item layout when used with ListView.CHOICE_MODE_MULTIPLE_MODAL 
causes the item to highlighted when multiselect mode gets activated on 
longitemclick. ApiDemos
again has a sample under Lists/List16. The problem here is that now on short 
press the item
is not highlighted like in List17 but highlight only works when multiselect 
mode gets enabled
on long press.

So what I am trying to achieve is that item stays activated/hightlighted on 
short press/itemClick
and also highlights when mutilselect mode gets enabled on long press. I tried 
playing around
with List16 and List17 code to see if I can get the functionality to work but 
havent got it
working. Any clues will be helpful. The Gmail app on tablet (Nexus 7) has this 
working where
itemclick highlights the message row and longitemclick goes into mutliselect 
mode with selected
rows highlighted. 

---
Take care,
Pankaj


-- 
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 problem while scrolling

2012-09-01 Thread LiTTle
Hi everyone,

I am trying 4 days to solve this problem. I am trying to create the 
following feature:
I have a ListView that the user can select an item. When the user selects 
the item the text will turn to pink. The ListView shows 6 items at once. 
You have to scroll to see other 6 and go on.
But there is a problem:
When i scroll the ListView the item No8, No15,... are pink too! 
Any help, ideas (even if you think you are wrong) are welcomed. I am 
freaking out more and more every day.
Thanks a lot for your time spent reading my issue!

Here is the code inside for my adapter:

public class MyListAdapter extends ArrayAdapterString {

private Context ctx;
private String[] values;
private ArrayListString mData =new ArrayListString();
private ViewHolder holder=null;
private LayoutInflater inflater;
 public MyListAdapter(Context context, int textViewResourceId, String[] 
values) {
super(context, textViewResourceId, values);

ctx = context;
inflater = (LayoutInflater) ctx
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
this.values = values;
for (int i = 0; i  values.length; i++) {
addItem(values[i]);
}
}
 public void addItem(final String item) {
mData.add(item);
notifyDataSetChanged();
}
 @Override
public String getItem(int position) {
return mData.get(position);
}

@Override
public long getItemId(int position) {
return position;
}

@Override
public int getCount() {
// TODO Auto-generated method stub
return mData.size();
}

/* (non-Javadoc)
 * @see android.widget.ArrayAdapter#getView(int, android.view.View, 
android.view.ViewGroup)
 */
@Override
public View getView(int position, View convertView, ViewGroup parent) {
 
if(convertView==null){
convertView = inflater.inflate(R.layout.list_item, parent, false);
holder = new ViewHolder();
holder.textView = 
(TextView)convertView.findViewById(R.id.item_textView);
convertView.setTag(holder);
 }
else{
holder = (ViewHolder)convertView.getTag();
}
holder.textView.setText(mData.get(position));
holder.textView.setOnClickListener(new OnClickListener() {

@Override
public void onClick(View view) {
for(int i=0; igetCount(); i++){
 }
((ViewHolder)view.getTag()).textView.setTextColor(ctx.getResources().
getColor(R.color.pink));
}
});
return convertView;
}
 public static class ViewHolder {
public TextView textView;
}

}
///

-- 
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 problem while scrolling

2012-09-01 Thread Mark Murphy
You only ever setting the color to be pink. You need to set the color
to be not-pink as well, for cases where the row is recycled, was pink,
and now no longer is supposed to be pink.

On Sat, Sep 1, 2012 at 7:10 AM, LiTTle littlep...@gmail.com wrote:
 Hi everyone,

 I am trying 4 days to solve this problem. I am trying to create the
 following feature:
 I have a ListView that the user can select an item. When the user selects
 the item the text will turn to pink. The ListView shows 6 items at once. You
 have to scroll to see other 6 and go on.
 But there is a problem:
 When i scroll the ListView the item No8, No15,... are pink too!
 Any help, ideas (even if you think you are wrong) are welcomed. I am
 freaking out more and more every day.
 Thanks a lot for your time spent reading my issue!

 Here is the code inside for my adapter:
 
 public class MyListAdapter extends ArrayAdapterString {

 private Context ctx;
 private String[] values;
 private ArrayListString mData =new ArrayListString();
 private ViewHolder holder=null;
 private LayoutInflater inflater;
 public MyListAdapter(Context context, int textViewResourceId, String[]
 values) {
 super(context, textViewResourceId, values);

 ctx = context;
 inflater = (LayoutInflater) ctx
 .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
 this.values = values;
 for (int i = 0; i  values.length; i++) {
 addItem(values[i]);
 }
 }
 public void addItem(final String item) {
 mData.add(item);
 notifyDataSetChanged();
 }
 @Override
 public String getItem(int position) {
 return mData.get(position);
 }

 @Override
 public long getItemId(int position) {
 return position;
 }

 @Override
 public int getCount() {
 // TODO Auto-generated method stub
 return mData.size();
 }

 /* (non-Javadoc)
 * @see android.widget.ArrayAdapter#getView(int, android.view.View,
 android.view.ViewGroup)
 */
 @Override
 public View getView(int position, View convertView, ViewGroup parent) {

 if(convertView==null){
 convertView = inflater.inflate(R.layout.list_item, parent, false);
 holder = new ViewHolder();
 holder.textView =
 (TextView)convertView.findViewById(R.id.item_textView);
 convertView.setTag(holder);
 }
 else{
 holder = (ViewHolder)convertView.getTag();
 }
 holder.textView.setText(mData.get(position));
 holder.textView.setOnClickListener(new OnClickListener() {

 @Override
 public void onClick(View view) {
 for(int i=0; igetCount(); i++){
 }
 ((ViewHolder)view.getTag()).textView.setTextColor(ctx.getResources().
 getColor(R.color.pink));
 }
 });
 return convertView;
 }
 public static class ViewHolder {
 public TextView textView;
 }

 }
 ///

 --
 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

_The Busy Coder's Guide to Android Development_ Version 4.1 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 problem while scrolling

2012-09-01 Thread LiTTle
I cannot believe it that is was a simple line! Thank you very much. I feel 
much more relaxed now.

-- 
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 text size

2012-08-28 Thread RAM
how to resize the font size of a listview/gridview text

-- 
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 text size

2012-08-28 Thread Justin Anderson
Use your own layout...

Thanks,
Justin Anderson
MagouyaWare Developer
http://sites.google.com/site/magouyaware


On Mon, Aug 27, 2012 at 9:39 PM, RAM ramon26c...@gmail.com wrote:

 how to resize the font size of a listview/gridview text

 --
 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 text size

2012-08-28 Thread Felipe Silveira
Just complementing... use your own layout for the list itens.

On Tue, Aug 28, 2012 at 7:15 PM, Justin Anderson magouyaw...@gmail.comwrote:

 Use your own layout...

 Thanks,
 Justin Anderson
 MagouyaWare Developer
 http://sites.google.com/site/magouyaware



 On Mon, Aug 27, 2012 at 9:39 PM, RAM ramon26c...@gmail.com wrote:

 how to resize the font size of a listview/gridview text

 --
 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




-- 
Felipe Silveira
http://www.felipesilveira.com.br
-

-- 
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 hashmap checkbox

2012-08-24 Thread Justin Anderson

 im working on a customized listview(hashmap)

I can't think of a scenario where you would want to use a hashmap for a
ListView.  ListView requires index positions for everything and a hashmap
doesn't provide that functionality.

the isue is that i can't use the values of some textviews when the checkbox
 is checked

What do you mean you can't use the values textviews when a checkbox is
checked?  That doesn't make any sense...

if anyone'zs familliar with this i can post the code

Only post the code that is relevant to the problem.

plzz help

Please learn to spell...

Thanks,
Justin Anderson
MagouyaWare Developer
http://sites.google.com/site/magouyaware


On Wed, Aug 15, 2012 at 7:40 AM, anasKun anas.kerro...@gmail.com wrote:

 hello everyone im a beginner at android and im working on a customized
 listview(hashmap) with images, textviews and checkboxes the isue is that i
 can't use the values of some textviews when the checkbox is checked if
 anyone'zs familliar with this i can post the code plzz help

 --
 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

[android-developers] listview hashmap checkbox

2012-08-16 Thread anasKun
hello everyone im a beginner at android and im working on a customized 
listview(hashmap) with images, textviews and checkboxes the isue is that i 
can't use the values of some textviews when the checkbox is checked if 
anyone'zs familliar with this i can post the code plzz help

-- 
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 in home screen widget (ICS) shows old (cached?) data sometimes

2012-08-16 Thread qkx
 

I've home screen widget with ListView inside (Android 4.x - ICS), and after 
some change the listed items are not correctly displayed - I mean, the 
old data are displayed. Its always in this way:

   1. visible part of listview has ALWAYS good (= new) data displayed
   2. invisible part of list (scroll up or down) ALWAYS shows some of items 
   old (and some not)

It looks, like the not visible part of list is cached, and when I scroll up 
or down, only few items are refreshed, and other not. And it looks funny, 
because when I'm scrolling up and down, some items are showing old, some 
new, and always different items, like absolutely randomly. It's simple 
strange...

What's the problem? Here is my ListView:

ListView
android:id=@+id/panelNews
android:layout_width=fill_parent
android:layout_height=0dp
android:layout_marginLeft=@dimen/padding
android:layout_marginRight=@dimen/padding
android:layout_weight=1
android:gravity=top
android:paddingTop=@dimen/padding
android:scrollingCache=false
android:animationCache=false
/ListView

And here is code of my ForexWidgetServiceFactory method (this method is 
fired on each data change):

public void onDataSetChanged() {
MyLogger.log(TAG, onDataSetChanged);
listItems = dbHandler.getRecords();
}

-- 
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 in Wifi

2012-08-10 Thread Meena Rengarajan
Here, this is my code, How do i wanna put all the strings which is 
scanned and how do i wanna use Array adapter then how do i wanna get all 
the values from list ?
Can anyone help me here please ?

wifi.startScan();
 int length = 10;
 
String[] str1 =new String[length];
 ListScanResult results = wifi.getScanResults();
 for(int i=0;iresults.size();i++){
 ScanResult result = (ScanResult)results[i];
 str1[i] = result.SSID;
 }
 ArrayAdapterStringadapter=new 
ArrayAdapterString(this,android.R.layout.simple_list_item_1,android.R.id.text1,str1);
 lv.setAdapter(adapter);
// for (ScanResult result : results) {
 
//Toast.makeText(this, result.SSID +   + 
result.level,Toast.LENGTH_SHORT).show();

-- 
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 sorting

2012-08-10 Thread Wolfgang
Thanks for the reply. I figured it out. I sorted in the ArrayAdapter.

-- 
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 in Wifi

2012-08-10 Thread TreKing
On Fri, Aug 10, 2012 at 6:39 AM, Meena Rengarajan meenasoft...@gmail.comwrote:

 How do i wanna put all the strings which is scanned and how do i wanna use
 Array adapter then how do i wanna get all the values from list ?


How you wanna do anything is really up to you.

-
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 sorting

2012-08-09 Thread Wolfgang
Hey guys,
 
I'm using a ListView that displays a list of ChartInfo. ChartInfo is a 
class I wrote that contains two strings: name, type; and a boolean: 
notification. The ListView is sorting the charts based on name. I would 
prefer that it sorts first based on the boolean, notification, and then 
sorts by the string, name. Can someone point me to a good resource to 
accomplish this or give me some guidance. Here is an example of what I 
would like to accomplish:
https://lh3.googleusercontent.com/-fV_JkTnTw_Q/UCQFm2NfFlI/AAM/rpH5Nv05NLA/s1600/exampleSorting.png
 
https://lh3.googleusercontent.com/-fV_JkTnTw_Q/UCQFm2NfFlI/AAM/rpH5Nv05NLA/s1600/exampleSorting.png
Thanks,
-W

-- 
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 sorting

2012-08-09 Thread Mark Murphy
You need to either sort the data before you hand it to the adapter, or
teach the adapter how to do the sorting.

On Thu, Aug 9, 2012 at 2:48 PM, Wolfgang wolfgangemm...@yahoo.com wrote:

 Hey guys,

 I'm using a ListView that displays a list of ChartInfo. ChartInfo is a
 class I wrote that contains two strings: name, type; and a boolean:
 notification. The ListView is sorting the charts based on name. I would
 prefer that it sorts first based on the boolean, notification, and then
 sorts by the string, name. Can someone point me to a good resource to
 accomplish this or give me some guidance. Here is an example of what I
 would like to accomplish:
 https://lh3.googleusercontent.com/-fV_JkTnTw_Q/UCQFm2NfFlI/AAM/rpH5Nv05NLA/s1600/exampleSorting.png


 https://lh3.googleusercontent.com/-fV_JkTnTw_Q/UCQFm2NfFlI/AAM/rpH5Nv05NLA/s1600/exampleSorting.png
 Thanks,
 -W

 --
 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

Android Training in NYC: http://marakana.com/training/android/

-- 
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 with custom view item refresh issue

2012-07-27 Thread Sergio Panico
Hi all,
I need your help to understand the refresh behaviour of a ListView where 
I've defined a my custom view for the ListView's items.

I think It's better explain it with an example:
my adapter contains 7 items: A, B, C, D, E, F, G correctly initialized, 
filled and working. The associated ListView shows 5 (out of 7) items: A, B, 
C, D, E.
The problem is that, when I scroll down the ListView's content instead of 
showing me items F and G, I've got A and B items again. I understood that 
this is only a viewing issue becouse the model elements associated with 
the last two items, correctly belong to F and G items. :|

Following the ovveride of getView(...) method of my adapter (extending 
BaseAdapter):

@Override
public View getView(int position, View convertView, ViewGroup parent) {
MyItemView miv = (( MyItemView  ) convertView);

if (context == null) return null;

if (convertView == null) {
miv = new MyItemView ();
.
} else {
miv.refreshView(); //refresh the view content
}

return miv;
}

and the refreshView() method of MyItemView (extending LinearLayout):

@Override
public void refreshView() {
label1.setText(..);
label2.setText(..);
label2.setText(..);

invalidate();
}

Thanks a lot to all!
Bye
Sergio

-- 
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 with custom view item refresh issue

2012-07-27 Thread Justin Anderson
Look at and implement these methods:

http://developer.android.com/reference/android/widget/Adapter.html#getItemViewType(int)
http://developer.android.com/reference/android/widget/Adapter.html#getViewTypeCount()

Thanks,
Justin Anderson
MagouyaWare Developer
http://sites.google.com/site/magouyaware


On Thu, Jul 26, 2012 at 4:59 AM, Sergio Panico sergio.pan...@gmail.comwrote:

 Hi all,
 I need your help to understand the refresh behaviour of a ListView where
 I've defined a my custom view for the ListView's items.

 I think It's better explain it with an example:
 my adapter contains 7 items: A, B, C, D, E, F, G correctly initialized,
 filled and working. The associated ListView shows 5 (out of 7) items: A, B,
 C, D, E.
 The problem is that, when I scroll down the ListView's content instead of
 showing me items F and G, I've got A and B items again. I understood that
 this is only a viewing issue becouse the model elements associated with
 the last two items, correctly belong to F and G items. :|

 Following the ovveride of getView(...) method of my adapter (extending
 BaseAdapter):

 @Override
 public View getView(int position, View convertView, ViewGroup parent) {
 MyItemView miv = (( MyItemView  ) convertView);

 if (context == null) return null;

 if (convertView == null) {
 miv = new MyItemView ();
 .
 } else {
 miv.refreshView(); //refresh the view content
 }

 return miv;
 }

 and the refreshView() method of MyItemView (extending LinearLayout):

 @Override
 public void refreshView() {
 label1.setText(..);
 label2.setText(..);
 label2.setText(..);

 invalidate();
 }

 Thanks a lot to all!
 Bye
 Sergio

 --
 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 with custom view item refresh issue

2012-07-27 Thread Kostya Vasilyev
I'm not seeing any evidence why getViewTypeCount() or getItemViewType()
would be needed. Based on the description, the items views appear to
be homogeneous.

It looks weird to me that public void refreshView does not take an int
position parameter. How does it know that it needs to set the views with
the data for the position'th item?

And that's probably what the issue is - the original MyItemView created for
item A is reused for item F, and B for G, so it updates the views with the
wrong data.

Another point - it's not necessary to call invalidate() like you're doing.

-- K

2012/7/27 Justin Anderson magouyaw...@gmail.com

 Look at and implement these methods:


 http://developer.android.com/reference/android/widget/Adapter.html#getItemViewType(int)

 http://developer.android.com/reference/android/widget/Adapter.html#getViewTypeCount()

 Thanks,
 Justin Anderson
 MagouyaWare Developer
 http://sites.google.com/site/magouyaware



 On Thu, Jul 26, 2012 at 4:59 AM, Sergio Panico sergio.pan...@gmail.comwrote:

 Hi all,
 I need your help to understand the refresh behaviour of a ListView where
 I've defined a my custom view for the ListView's items.

 I think It's better explain it with an example:
 my adapter contains 7 items: A, B, C, D, E, F, G correctly initialized,
 filled and working. The associated ListView shows 5 (out of 7) items: A, B,
 C, D, E.
 The problem is that, when I scroll down the ListView's content instead of
 showing me items F and G, I've got A and B items again. I understood that
 this is only a viewing issue becouse the model elements associated with
 the last two items, correctly belong to F and G items. :|

 Following the ovveride of getView(...) method of my adapter (extending
 BaseAdapter):

 @Override
 public View getView(int position, View convertView, ViewGroup parent)
 {
 MyItemView miv = (( MyItemView  ) convertView);

 if (context == null) return null;

 if (convertView == null) {
 miv = new MyItemView ();
 .
 } else {
 miv.refreshView(); //refresh the view content
 }

 return miv;
 }

 and the refreshView() method of MyItemView (extending LinearLayout):

 @Override
 public void refreshView() {
 label1.setText(..);
 label2.setText(..);
 label2.setText(..);

 invalidate();
 }

 Thanks a lot to all!
 Bye
 Sergio

 --
 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


-- 
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 with custom view item refresh issue

2012-07-27 Thread Justin Anderson

 I'm not seeing any evidence why getViewTypeCount() or getItemViewType()
 would be needed. Based on the description, the items views appear to
 be homogeneous.

I misunderstood his post... I thought A,B,C,D,E,F, and G were each
different custom view types...

Thanks,
Justin Anderson
MagouyaWare Developer
http://sites.google.com/site/magouyaware


On Fri, Jul 27, 2012 at 12:54 PM, Kostya Vasilyev kmans...@gmail.comwrote:

 I'm not seeing any evidence why getViewTypeCount() or getItemViewType()
 would be needed. Based on the description, the items views appear to
 be homogeneous.

 It looks weird to me that public void refreshView does not take an int
 position parameter. How does it know that it needs to set the views with
 the data for the position'th item?

 And that's probably what the issue is - the original MyItemView created
 for item A is reused for item F, and B for G, so it updates the views with
 the wrong data.

 Another point - it's not necessary to call invalidate() like you're doing.

 -- K


 2012/7/27 Justin Anderson magouyaw...@gmail.com

 Look at and implement these methods:


 http://developer.android.com/reference/android/widget/Adapter.html#getItemViewType(int)

 http://developer.android.com/reference/android/widget/Adapter.html#getViewTypeCount()

 Thanks,
 Justin Anderson
 MagouyaWare Developer
 http://sites.google.com/site/magouyaware



 On Thu, Jul 26, 2012 at 4:59 AM, Sergio Panico 
 sergio.pan...@gmail.comwrote:

 Hi all,
 I need your help to understand the refresh behaviour of a ListView where
 I've defined a my custom view for the ListView's items.

 I think It's better explain it with an example:
 my adapter contains 7 items: A, B, C, D, E, F, G correctly initialized,
 filled and working. The associated ListView shows 5 (out of 7) items: A, B,
 C, D, E.
 The problem is that, when I scroll down the ListView's content instead
 of showing me items F and G, I've got A and B items again. I understood
 that this is only a viewing issue becouse the model elements associated
 with the last two items, correctly belong to F and G items. :|

 Following the ovveride of getView(...) method of my adapter (extending
 BaseAdapter):

 @Override
 public View getView(int position, View convertView, ViewGroup
 parent) {
 MyItemView miv = (( MyItemView  ) convertView);

 if (context == null) return null;

 if (convertView == null) {
 miv = new MyItemView ();
 .
 } else {
 miv.refreshView(); //refresh the view content
 }

 return miv;
 }

 and the refreshView() method of MyItemView (extending LinearLayout):

 @Override
 public void refreshView() {
 label1.setText(..);
 label2.setText(..);
 label2.setText(..);

 invalidate();
 }

 Thanks a lot to all!
 Bye
 Sergio

 --
 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


  --
 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 and check box.

2012-07-26 Thread Justin Anderson
You might also want to set focusableInTouchMode to false as well...

Thanks,
Justin Anderson
MagouyaWare Developer
http://sites.google.com/site/magouyaware


On Wed, Jul 25, 2012 at 11:11 PM, TreKing treking...@gmail.com wrote:

 On Wed, Jul 25, 2012 at 10:59 PM, Put_tiMe putt...@gmail.com wrote:

 But I couldn't figure out any way of getting the visual feedback to work.
 Is there anyway I can get the visual feedback to work?


 The Checkbox is stealing focus. Set focusable=false on it.


 -
 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

[android-developers] ListView and check box.

2012-07-25 Thread Put_tiMe
I'm using a list view with a custom adapter. And the row contains a check 
box.

Without the check box, everything works fine.
If I use a check box inside a list-view row, then I basically don't get a 
on-item-click callback.
The other side effect is, the click or press visual feedback is also 
not shown.


For the callback, in the getView of the adapter, I can register for a 
callback for the row. Like this:
row.setOnClickListener(mOnItemClickListener);

But I couldn't figure out any way of getting the visual feedback to work.
Is there anyway I can get the visual feedback to work?

-- 
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 and check box.

2012-07-25 Thread TreKing
On Wed, Jul 25, 2012 at 10:59 PM, Put_tiMe putt...@gmail.com wrote:

 But I couldn't figure out any way of getting the visual feedback to work.
 Is there anyway I can get the visual feedback to work?


The Checkbox is stealing focus. Set focusable=false on it.

-
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

Re: [android-developers] Listview or Table Layout- For Items with a Header and display some dynamic data rows with style

2012-07-12 Thread maccoy
Thanks for pointing to that.

On Wednesday, July 11, 2012 10:55:57 AM UTC+5:30, TreKing wrote:

 On Wed, Jul 11, 2012 at 12:03 AM, maccoy maccoy2...@gmail.com wrote:

 What would be the best case: Considering we have the formatting in XML 
 and the data rows are just dynamic display of content.


 Probably ListView.

 http://developer.android.com/reference/android/widget/ListView.html#addHeaderView%28android.view.View,%20java.lang.Object,%20boolean%29


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


On Wednesday, July 11, 2012 10:55:57 AM UTC+5:30, TreKing wrote:

 On Wed, Jul 11, 2012 at 12:03 AM, maccoy maccoy2...@gmail.com wrote:

 What would be the best case: Considering we have the formatting in XML 
 and the data rows are just dynamic display of content.


 Probably ListView.

 http://developer.android.com/reference/android/widget/ListView.html#addHeaderView%28android.view.View,%20java.lang.Object,%20boolean%29


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


On Wednesday, July 11, 2012 10:55:57 AM UTC+5:30, TreKing wrote:

 On Wed, Jul 11, 2012 at 12:03 AM, maccoy maccoy2...@gmail.com wrote:

 What would be the best case: Considering we have the formatting in XML 
 and the data rows are just dynamic display of content.


 Probably ListView.

 http://developer.android.com/reference/android/widget/ListView.html#addHeaderView%28android.view.View,%20java.lang.Object,%20boolean%29


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


On Wednesday, July 11, 2012 10:55:57 AM UTC+5:30, TreKing wrote:

 On Wed, Jul 11, 2012 at 12:03 AM, maccoy maccoy2...@gmail.com wrote:

 What would be the best case: Considering we have the formatting in XML 
 and the data rows are just dynamic display of content.


 Probably ListView.

 http://developer.android.com/reference/android/widget/ListView.html#addHeaderView%28android.view.View,%20java.lang.Object,%20boolean%29


 -
 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 - Expandable items and scrolling

2012-07-11 Thread Tolriq
Hello,

I'm currently facing a problem and the solution I use does not satisfy me.
I'm pretty sure there's a correct way to handle this case so I ask here :)

My problem is simple I have a listview with items that have a gone part 
that I show on the last clicked item.
This part works well, I also want the clicked item to be fully visible and 
here's comes trouble.

With non expanding item it's easy to do with requestChildRectangleOnScreen 
but in my case I can't find a way for the list to be aware of the new size 
of the item so it will only scroll the item to show the expanded part.
The solution I use is if the requestChildRectangleOnScreen was in effect or 
if item is last or before last item then scroll by the size of the expanded 
item (that i get via measure).

This works but not perfect since sometimes I scroll the list (when i before 
last item) when it would not have been needed :(

The code used : 

public void onItemClick(AdapterView? arg0, View arg1, int i, 
 long l) {
 // TODO Auto-generated method stub
 if (curView != null) {
 try {
 curView.setVisibility(View.GONE);
 } catch (Exception e) {
 }
 }

 ListView listView = (ListView) 
 findViewById(R.id.mediaslist_list);

 curView = ((RelativeLayout) 
 arg1.getTag(R.id.movieslist_item_details));
 curView.setVisibility(View.VISIBLE);
 int widthMeasureSpec = MeasureSpec.makeMeasureSpec(0, 
 MeasureSpec.UNSPECIFIED);
 int heightMeasureSpec = MeasureSpec.makeMeasureSpec(0, 
 MeasureSpec.UNSPECIFIED);
 curView.measure(widthMeasureSpec, heightMeasureSpec);

 if (listView.requestChildRectangleOnScreen(arg1, new 
 Rect(0, 0, arg1.getRight(),
 arg1.getHeight()), false)
 || listView.getLastVisiblePosition() = (i + 1)) {
 listView.smoothScrollBy(curView.getMeasuredHeight(), 
 150);
 }
 }


If someone have the correct way to handle this case thanks for answering :)
 
Regards,
Tolriq.

-- 
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 - Expandable items and scrolling

2012-07-11 Thread Justin Anderson
I'm not sure I understand exactly what you are trying to do...  But from
the code you posted, it looks like you are wanting to change the view of
the last clicked item somehow.  This should really be handled by the
getView() method of your adapter.  You would need to write a custom adapter
to do this but that is the correct way to handle something like this.

Here are some high level steps to help you get started:

   1. Subclass an adapter class of your choosing (I usually like to use
   BaseAdapter, but I have also subclassed ArrayAdapter before)
   2. Have the adapter keep track of the position of the last clicked
   item.  I would probably do this by having a member variable on the adapter,
   and a getter and setter to change it.  That way, in your onItemClick()
   method you can set that value on your adapter
   3. When you implement getView() on your adapter, check if the current
   position is the position of the last clicked item and handle it
   appropriately.
   4. If you do this right, you most likely won't have to deal with all of
   the code to manually resize an item in the list...

Hope that helps...

Thanks,
Justin Anderson
MagouyaWare Developer
http://sites.google.com/site/magouyaware


On Wed, Jul 11, 2012 at 6:42 AM, Tolriq tol...@gmail.com wrote:

 Hello,

 I'm currently facing a problem and the solution I use does not satisfy me.
 I'm pretty sure there's a correct way to handle this case so I ask here :)

 My problem is simple I have a listview with items that have a gone part
 that I show on the last clicked item.
 This part works well, I also want the clicked item to be fully visible and
 here's comes trouble.

 With non expanding item it's easy to do with requestChildRectangleOnScreen
 but in my case I can't find a way for the list to be aware of the new size
 of the item so it will only scroll the item to show the expanded part.
 The solution I use is if the requestChildRectangleOnScreen was in effect
 or if item is last or before last item then scroll by the size of the
 expanded item (that i get via measure).

 This works but not perfect since sometimes I scroll the list (when i
 before last item) when it would not have been needed :(

 The code used :

 public void onItemClick(AdapterView? arg0, View arg1, int i,
 long l) {
 // TODO Auto-generated method stub
 if (curView != null) {
 try {
 curView.setVisibility(View.GONE);
 } catch (Exception e) {
 }
 }

 ListView listView = (ListView)
 findViewById(R.id.mediaslist_list);

 curView = ((RelativeLayout)
 arg1.getTag(R.id.movieslist_item_details));
 curView.setVisibility(View.VISIBLE);
 int widthMeasureSpec = MeasureSpec.makeMeasureSpec(0,
 MeasureSpec.UNSPECIFIED);
 int heightMeasureSpec = MeasureSpec.makeMeasureSpec(0,
 MeasureSpec.UNSPECIFIED);
 curView.measure(widthMeasureSpec, heightMeasureSpec);

 if (listView.requestChildRectangleOnScreen(arg1, new
 Rect(0, 0, arg1.getRight(),
 arg1.getHeight()), false)
 || listView.getLastVisiblePosition() = (i + 1)) {
 listView.smoothScrollBy(curView.getMeasuredHeight(),
 150);
 }
 }


 If someone have the correct way to handle this case thanks for answering :)

 Regards,
 Tolriq.

  --
 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 - Expandable items and scrolling

2012-07-11 Thread Tolriq
Thanks for answer.

Changing the view is not the problem it's more telling the listview that 
the item have changed.

I already have a custom Cursor adapter but the getview is not called for 
click only for select.

The need is to get sure that the listview scroll enough for the entire row 
to be visible.

Whatever way I'll do the listview would not have the correct information at 
the moment i send therequestChildRectangleOnScreen to assure visiblity of 
row :(

Tolriq.


Le mercredi 11 juillet 2012 17:27:21 UTC+2, MagouyaWare a écrit :

 I'm not sure I understand exactly what you are trying to do...  But from 
 the code you posted, it looks like you are wanting to change the view of 
 the last clicked item somehow.  This should really be handled by the 
 getView() method of your adapter.  You would need to write a custom adapter 
 to do this but that is the correct way to handle something like this.

 Here are some high level steps to help you get started:

1. Subclass an adapter class of your choosing (I usually like to use 
BaseAdapter, but I have also subclassed ArrayAdapter before)
2. Have the adapter keep track of the position of the last clicked 
item.  I would probably do this by having a member variable on the 
 adapter, 
and a getter and setter to change it.  That way, in your onItemClick() 
method you can set that value on your adapter 
3. When you implement getView() on your adapter, check if the current 
position is the position of the last clicked item and handle it 
appropriately.
4. If you do this right, you most likely won't have to deal with all 
of the code to manually resize an item in the list...

 Hope that helps...

 Thanks,
 Justin Anderson
 MagouyaWare Developer
 http://sites.google.com/site/magouyaware


 On Wed, Jul 11, 2012 at 6:42 AM, Tolriq tol...@gmail.com wrote:

 Hello,

 I'm currently facing a problem and the solution I use does not satisfy me.
 I'm pretty sure there's a correct way to handle this case so I ask here :)

 My problem is simple I have a listview with items that have a gone part 
 that I show on the last clicked item.
 This part works well, I also want the clicked item to be fully visible 
 and here's comes trouble.

 With non expanding item it's easy to do with 
 requestChildRectangleOnScreen but in my case I can't find a way for the 
 list to be aware of the new size of the item so it will only scroll the 
 item to show the expanded part.
 The solution I use is if the requestChildRectangleOnScreen was in effect 
 or if item is last or before last item then scroll by the size of the 
 expanded item (that i get via measure).

 This works but not perfect since sometimes I scroll the list (when i 
 before last item) when it would not have been needed :(

 The code used : 

 public void onItemClick(AdapterView? arg0, View arg1, int 
 i, long l) {
 // TODO Auto-generated method stub
 if (curView != null) {
 try {
 curView.setVisibility(View.GONE);
 } catch (Exception e) {
 }
 }

 ListView listView = (ListView) 
 findViewById(R.id.mediaslist_list);

 curView = ((RelativeLayout) 
 arg1.getTag(R.id.movieslist_item_details));
 curView.setVisibility(View.VISIBLE);
 int widthMeasureSpec = MeasureSpec.makeMeasureSpec(0, 
 MeasureSpec.UNSPECIFIED);
 int heightMeasureSpec = MeasureSpec.makeMeasureSpec(0, 
 MeasureSpec.UNSPECIFIED);
 curView.measure(widthMeasureSpec, heightMeasureSpec);

 if (listView.requestChildRectangleOnScreen(arg1, new 
 Rect(0, 0, arg1.getRight(),
 arg1.getHeight()), false)
 || listView.getLastVisiblePosition() = (i + 1)) 
 {
 listView.smoothScrollBy(curView.getMeasuredHeight(), 
 150);
 }
 }


 If someone have the correct way to handle this case thanks for answering 
 :)
  
 Regards,
 Tolriq.

  -- 
 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 - Expandable items and scrolling

2012-07-11 Thread Justin Anderson
You are not looking at it from the right perspective...  I promise that if
you do it the way that I explained it will work.

The listview is nothing more than a visual representation of your data
model.  The fact that one item in this list needs to be displayed
differently from the rest is something that should be part of the data
model.

The adapter's job is to take your data and adapt it to a visual
representation.  The getView() method is not called for selection.  The
getView() method on the adapter is called by the listview every single time
it needs to get that visual representation of your data.

So, again, here are the steps to take to get this working... I have added a
few things for clarity:

   1. Subclass an adapter class of your choosing (I usually like to use
   BaseAdapter, but I have also subclassed ArrayAdapter before).
   2. Have the adapter keep track of the position of the last clicked
   item.  I would probably do this by having a member variable on the adapter,
   and a getter and setter to change it.  That way, in your onItemClick()
   method you can set that value on your adapter, *and then call
   notifyDataSetChanged() on your adapter.  This will cause the listview to
   refresh itself and call getView() for all the items it needs to display.*
   3. When you implement getView() on your adapter, check if the current
   position is the position of the last clicked item and handle it
   appropriately.  *The way I would do what you are trying to accomplish is
   as follows:*
  1. *If the position passed in to getView() is the same as the member
  variable that keeps track of the last clicked item, then set the gone
  part of your view to View.VISIBLE*
  2. *If the position passed in to getView() is NOT the same as the
  member variable, then set the gone part of your view to View.GONE
  *
   4. If you do this right, you most likely won't have to deal with all of
   the code to manually resize an item in the list...


Thanks,
Justin Anderson
MagouyaWare Developer
http://sites.google.com/site/magouyaware


On Wed, Jul 11, 2012 at 10:10 AM, Tolriq tol...@gmail.com wrote:

 Thanks for answer.

 Changing the view is not the problem it's more telling the listview that
 the item have changed.

 I already have a custom Cursor adapter but the getview is not called for
 click only for select.

 The need is to get sure that the listview scroll enough for the entire row
 to be visible.

 Whatever way I'll do the listview would not have the correct information
 at the moment i send therequestChildRectangleOnScreen to assure visiblity
 of row :(

 Tolriq.


 Le mercredi 11 juillet 2012 17:27:21 UTC+2, MagouyaWare a écrit :

 I'm not sure I understand exactly what you are trying to do...  But from
 the code you posted, it looks like you are wanting to change the view of
 the last clicked item somehow.  This should really be handled by the
 getView() method of your adapter.  You would need to write a custom adapter
 to do this but that is the correct way to handle something like this.

 Here are some high level steps to help you get started:

1. Subclass an adapter class of your choosing (I usually like to use
BaseAdapter, but I have also subclassed ArrayAdapter before)
2. Have the adapter keep track of the position of the last clicked
item.  I would probably do this by having a member variable on the 
 adapter,
and a getter and setter to change it.  That way, in your onItemClick()
method you can set that value on your adapter
3. When you implement getView() on your adapter, check if the current
position is the position of the last clicked item and handle it
appropriately.
4. If you do this right, you most likely won't have to deal with all
of the code to manually resize an item in the list...

 Hope that helps...

 Thanks,
 Justin Anderson
 MagouyaWare Developer
 http://sites.google.com/site/**magouyawarehttp://sites.google.com/site/magouyaware


 On Wed, Jul 11, 2012 at 6:42 AM, Tolriq tol...@gmail.com wrote:

 Hello,

 I'm currently facing a problem and the solution I use does not satisfy
 me.
 I'm pretty sure there's a correct way to handle this case so I ask here
 :)

 My problem is simple I have a listview with items that have a gone part
 that I show on the last clicked item.
 This part works well, I also want the clicked item to be fully visible
 and here's comes trouble.

 With non expanding item it's easy to do with
 requestChildRectangleOnScreen but in my case I can't find a way for the
 list to be aware of the new size of the item so it will only scroll the
 item to show the expanded part.
 The solution I use is if the requestChildRectangleOnScreen was in effect
 or if item is last or before last item then scroll by the size of the
 expanded item (that i get via measure).

 This works but not perfect since sometimes I scroll the list (when i
 before last item) when it would not have been needed :(

 The code used :

 

Re: [android-developers] ListView - Expandable items and scrolling

2012-07-11 Thread Tolriq
Well must I admit this is the correct way to handle the item row change.  
(Never thought of using *notifyDataSetChanged *on a non changed data to 
force refresh :p)

This will cause 10 or more lines to redraw instead of just a change of 
visibility of one view but since only happening on item click this should 
not hurt too much.

I'll still have the scrolling problem due to async listview refresh but 
since I got the solution for this I'll go on the correct road for adapter 
at least :)

Thanks,
Tolriq.

Le mercredi 11 juillet 2012 18:29:29 UTC+2, MagouyaWare a écrit :

 You are not looking at it from the right perspective...  I promise that if 
 you do it the way that I explained it will work.

 The listview is nothing more than a visual representation of your data 
 model.  The fact that one item in this list needs to be displayed 
 differently from the rest is something that should be part of the data 
 model.

 The adapter's job is to take your data and adapt it to a visual 
 representation.  The getView() method is not called for selection.  The 
 getView() method on the adapter is called by the listview every single time 
 it needs to get that visual representation of your data.

 So, again, here are the steps to take to get this working... I have added 
 a few things for clarity:

1. Subclass an adapter class of your choosing (I usually like to use 
BaseAdapter, but I have also subclassed ArrayAdapter before). 
2. Have the adapter keep track of the position of the last clicked 
item.  I would probably do this by having a member variable on the 
 adapter, 
and a getter and setter to change it.  That way, in your onItemClick() 
method you can set that value on your adapter, *and then call 
notifyDataSetChanged() on your adapter.  This will cause the listview to 
refresh itself and call getView() for all the items it needs to display.
*
3. When you implement getView() on your adapter, check if the current 
position is the position of the last clicked item and handle it 
appropriately.  *The way I would do what you are trying to accomplish 
is as follows:*
   1. *If the position passed in to getView() is the same as the 
   member variable that keeps track of the last clicked item, then set the 
   gone part of your view to View.VISIBLE* 
   2. *If the position passed in to getView() is NOT the same as the 
   member variable, then set the gone part of your view to View.GONE
   *
4. If you do this right, you most likely won't have to deal with all 
of the code to manually resize an item in the list...


 Thanks,
 Justin Anderson
 MagouyaWare Developer
 http://sites.google.com/site/magouyaware


 On Wed, Jul 11, 2012 at 10:10 AM, Tolriq tol...@gmail.com wrote:

 Thanks for answer.

 Changing the view is not the problem it's more telling the listview that 
 the item have changed.

 I already have a custom Cursor adapter but the getview is not called for 
 click only for select.

 The need is to get sure that the listview scroll enough for the entire 
 row to be visible.

 Whatever way I'll do the listview would not have the correct information 
 at the moment i send therequestChildRectangleOnScreen to assure visiblity 
 of row :(

 Tolriq.


 Le mercredi 11 juillet 2012 17:27:21 UTC+2, MagouyaWare a écrit :

 I'm not sure I understand exactly what you are trying to do...  But from 
 the code you posted, it looks like you are wanting to change the view of 
 the last clicked item somehow.  This should really be handled by the 
 getView() method of your adapter.  You would need to write a custom adapter 
 to do this but that is the correct way to handle something like this.

 Here are some high level steps to help you get started:

1. Subclass an adapter class of your choosing (I usually like to use 
BaseAdapter, but I have also subclassed ArrayAdapter before)
2. Have the adapter keep track of the position of the last clicked 
item.  I would probably do this by having a member variable on the 
 adapter, 
and a getter and setter to change it.  That way, in your onItemClick() 
method you can set that value on your adapter 
3. When you implement getView() on your adapter, check if the 
current position is the position of the last clicked item and handle it 
appropriately.
4. If you do this right, you most likely won't have to deal with all 
of the code to manually resize an item in the list...

 Hope that helps...

 Thanks,
 Justin Anderson
 MagouyaWare Developer
 http://sites.google.com/site/**magouyawarehttp://sites.google.com/site/magouyaware


 On Wed, Jul 11, 2012 at 6:42 AM, Tolriq tol...@gmail.com wrote:

 Hello,

 I'm currently facing a problem and the solution I use does not satisfy 
 me.
 I'm pretty sure there's a correct way to handle this case so I ask here 
 :)

 My problem is simple I have a listview with items that have a gone part 
 that I show on the last 

Re: [android-developers] ListView - Expandable items and scrolling

2012-07-11 Thread Justin Anderson

 (Never thought of using *notifyDataSetChanged *on a non changed data to
 force refresh :p)

Except that the data is changed... remember, you are now keeping track of
the last clicked position as part of your data model.

Thanks,
Justin Anderson
MagouyaWare Developer
http://sites.google.com/site/magouyaware


On Wed, Jul 11, 2012 at 10:49 AM, Tolriq tol...@gmail.com wrote:

 (Never thought of using *notifyDataSetChanged *on a non changed data to
 force refresh :p)


-- 
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 - Expandable items and scrolling

2012-07-11 Thread Justin Anderson

 (Never thought of using *notifyDataSetChanged *on a non changed data to
 force refresh :p)

 Except that the data is changed... remember, you are now keeping track of
 the last clicked position as part of your data model.


And you not only have to change the view for the last clicked item, but you
also have to change the view of the previous last clicked item back to its
normal state...


Thanks,
Justin Anderson
MagouyaWare Developer
http://sites.google.com/site/magouyaware


On Wed, Jul 11, 2012 at 11:06 AM, Justin Anderson magouyaw...@gmail.comwrote:

 (Never thought of using *notifyDataSetChanged *on a non changed data to
 force refresh :p)

 Except that the data is changed... remember, you are now keeping track of
 the last clicked position as part of your data model.


 Thanks,
 Justin Anderson
 MagouyaWare Developer
 http://sites.google.com/site/magouyaware


 On Wed, Jul 11, 2012 at 10:49 AM, Tolriq tol...@gmail.com wrote:

 (Never thought of using *notifyDataSetChanged *on a non changed data to
 force refresh :p)




-- 
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 with data from webservice

2012-07-11 Thread Jorge Padilla
Hi, I'm a new android developer. How I can create a listview that will be 
loaded with data from a webservice as I scroll through the list?

-- 
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 with data from webservice

2012-07-11 Thread Justin Anderson
So what are you needing help with? Creating a list view? Getting data from
a Web server?
On Jul 11, 2012 5:46 PM, Jorge Padilla jorge.esteban.padi...@gmail.com
wrote:

 Hi, I'm a new android developer. How I can create a listview that will be
 loaded with data from a webservice as I scroll through the list?

 --
 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

[android-developers] Listview or Table Layout- For Items with a Header and display some dynamic data rows with style

2012-07-10 Thread maccoy
The formatting of the header and detail row is defined in layout.XML.
In this case, is it good to use 

   1. Table Layout and create details views by inflating the layout.xml(so 
   that formatting is available)
   2. Or Create a Listview for the details and a Linear layout representing 
   the Header.
   
What would be the best case: Considering we have the formatting in XML and 
the data rows are just dynamic display of content.
I assume we need to write a adapetor for the TableLayout.

-- 
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 or Table Layout- For Items with a Header and display some dynamic data rows with style

2012-07-10 Thread TreKing
On Wed, Jul 11, 2012 at 12:03 AM, maccoy maccoy2...@gmail.com wrote:

 What would be the best case: Considering we have the formatting in XML and
 the data rows are just dynamic display of content.


Probably ListView.
http://developer.android.com/reference/android/widget/ListView.html#addHeaderView%28android.view.View,%20java.lang.Object,%20boolean%29

-
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 inside a tabhost not displaying content initially

2012-06-20 Thread Simon Giddings
I have a TabActivity containing a series of four tabs and a listview.
Each of the tabs reference the same listview.
When the activity is initially displayed, the listview is not displayed.
However, clicking on another tab will display it correctly and clicking 
back on the first tab will also display it correctly.
The content of the listview is changed depending on the selected tab.

Here is my XML layout :
?xml version=1.0 encoding=utf-8?
TabHost xmlns:android=http://schemas.android.com/apk/res/android;
android:id=@android:id/tabhost
android:layout_width=match_parent
android:layout_height=match_parent 

LinearLayout
android:layout_width=fill_parent
android:layout_height=fill_parent
android:orientation=vertical 

TabWidget
android:id=@android:id/tabs
android:layout_width=fill_parent
android:layout_height=wrap_content /

FrameLayout
android:id=@android:id/tabcontent
android:layout_width=fill_parent
android:layout_height=fill_parent 

ListView
android:id=@+id/listPoisFound
android:layout_width=match_parent
android:layout_height=wrap_content 
/ListView

/FrameLayout
/LinearLayout

/TabHost

The tabs are initialised like this :
TabHost tabhost = null;
TabHost.TabSpec spec = null;
// get the tabhost
tabhost = getTabHost();

// create the individual tabs
spec = tabhost.newTabSpec(first);
spec.setIndicator(First);
spec.setContent(R.id.list);
tabhost.addTab(spec);

spec = tabhost.newTabSpec(second);
spec.setIndicator(Second);
spec.setContent(R.id.list);
tabhost.addTab(spec);

spec = tabhost.newTabSpec(third);
spec.setIndicator(Third);
spec.setContent(R.id.list);
tabhost.addTab(spec);

spec = tabhost.newTabSpec(fourth);
spec.setIndicator(Fourth);
spec.setContent(R.id.list);
tabhost.addTab(spec);

tabhost.setCurrentTab(0);

tabhost.setOnTabChangedListener(this);

Has anyone come across this problem ?
What is the solution ?

-- 
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 inside a tabhost not displaying content initially

2012-06-20 Thread Mark Murphy
On Wed, Jun 20, 2012 at 11:41 AM, Simon Giddings
mr.s.giddi...@gmail.com wrote:
 I have a TabActivity containing a series of four tabs and a listview.
 Each of the tabs reference the same listview.

I have no idea if this is supported.

 What is the solution ?

Try using separate ListViews, one per tab.

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

Android Training in DC: http://marakana.com/training/android/

-- 
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 inside a tabhost not displaying content initially

2012-06-20 Thread Justin Anderson
Just out of curiosity, try doing this:

*tabhost.setCurrentTab(1);
tabhost.setCurrentTab(0);
*
Does your list show up at that point?

Thanks,
Justin Anderson
MagouyaWare Developer
http://sites.google.com/site/magouyaware


On Wed, Jun 20, 2012 at 9:41 AM, Simon Giddings mr.s.giddi...@gmail.comwrote:

 I have a TabActivity containing a series of four tabs and a listview.
 Each of the tabs reference the same listview.
 When the activity is initially displayed, the listview is not displayed.
 However, clicking on another tab will display it correctly and clicking
 back on the first tab will also display it correctly.
 The content of the listview is changed depending on the selected tab.

 Here is my XML layout :
 ?xml version=1.0 encoding=utf-8?
 TabHost xmlns:android=http://schemas.android.com/apk/res/android;
 android:id=@android:id/tabhost
 android:layout_width=match_parent
 android:layout_height=match_parent 

 LinearLayout
 android:layout_width=fill_parent
 android:layout_height=fill_parent
 android:orientation=vertical 

 TabWidget
 android:id=@android:id/tabs
 android:layout_width=fill_parent
 android:layout_height=wrap_content /

 FrameLayout
 android:id=@android:id/tabcontent
 android:layout_width=fill_parent
 android:layout_height=fill_parent 

 ListView
 android:id=@+id/listPoisFound
 android:layout_width=match_parent
 android:layout_height=wrap_content 
 /ListView

 /FrameLayout
 /LinearLayout

 /TabHost

 The tabs are initialised like this :
 TabHost tabhost = null;
 TabHost.TabSpec spec = null;
 // get the tabhost
 tabhost = getTabHost();

 // create the individual tabs
 spec = tabhost.newTabSpec(first);
 spec.setIndicator(First);
 spec.setContent(R.id.list);
 tabhost.addTab(spec);

 spec = tabhost.newTabSpec(second);
 spec.setIndicator(Second);
 spec.setContent(R.id.list);
 tabhost.addTab(spec);

 spec = tabhost.newTabSpec(third);
 spec.setIndicator(Third);
 spec.setContent(R.id.list);
 tabhost.addTab(spec);

 spec = tabhost.newTabSpec(fourth);
 spec.setIndicator(Fourth);
 spec.setContent(R.id.list);
 tabhost.addTab(spec);

 tabhost.setCurrentTab(0);

 tabhost.setOnTabChangedListener(this);

 Has anyone come across this problem ?
 What is the solution ?

 --
 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 inside a tabhost not displaying content initially

2012-06-20 Thread Justin Anderson
Also, what does your OnTabChangedListener code do?

Thanks,
Justin Anderson
MagouyaWare Developer
http://sites.google.com/site/magouyaware


On Wed, Jun 20, 2012 at 9:46 AM, Justin Anderson magouyaw...@gmail.comwrote:

 Just out of curiosity, try doing this:

 *tabhost.setCurrentTab(1);
 tabhost.setCurrentTab(0);
 *
 Does your list show up at that point?

 Thanks,
 Justin Anderson
 MagouyaWare Developer
 http://sites.google.com/site/magouyaware



 On Wed, Jun 20, 2012 at 9:41 AM, Simon Giddings 
 mr.s.giddi...@gmail.comwrote:

 I have a TabActivity containing a series of four tabs and a listview.
 Each of the tabs reference the same listview.
 When the activity is initially displayed, the listview is not displayed.
 However, clicking on another tab will display it correctly and clicking
 back on the first tab will also display it correctly.
 The content of the listview is changed depending on the selected tab.

 Here is my XML layout :
 ?xml version=1.0 encoding=utf-8?
 TabHost xmlns:android=http://schemas.android.com/apk/res/android;
 android:id=@android:id/tabhost
 android:layout_width=match_parent
 android:layout_height=match_parent 

 LinearLayout
 android:layout_width=fill_parent
 android:layout_height=fill_parent
 android:orientation=vertical 

 TabWidget
 android:id=@android:id/tabs
 android:layout_width=fill_parent
 android:layout_height=wrap_content /

 FrameLayout
 android:id=@android:id/tabcontent
 android:layout_width=fill_parent
 android:layout_height=fill_parent 

 ListView
 android:id=@+id/listPoisFound
 android:layout_width=match_parent
 android:layout_height=wrap_content 
 /ListView

 /FrameLayout
 /LinearLayout

 /TabHost

 The tabs are initialised like this :
 TabHost tabhost = null;
 TabHost.TabSpec spec = null;
 // get the tabhost
 tabhost = getTabHost();

 // create the individual tabs
 spec = tabhost.newTabSpec(first);
 spec.setIndicator(First);
 spec.setContent(R.id.list);
 tabhost.addTab(spec);

 spec = tabhost.newTabSpec(second);
 spec.setIndicator(Second);
 spec.setContent(R.id.list);
 tabhost.addTab(spec);

 spec = tabhost.newTabSpec(third);
 spec.setIndicator(Third);
 spec.setContent(R.id.list);
 tabhost.addTab(spec);

 spec = tabhost.newTabSpec(fourth);
 spec.setIndicator(Fourth);
 spec.setContent(R.id.list);
 tabhost.addTab(spec);

 tabhost.setCurrentTab(0);

 tabhost.setOnTabChangedListener(this);

 Has anyone come across this problem ?
 What is the solution ?

 --
 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 inside a tabhost not displaying content initially

2012-06-20 Thread Simon Giddings
Wow, I hadn't expected replies so quickly !

@MagouyaWare - To answer your question, the OnTabChangedListener code 
rebuilds the listview content.
I have indeed stepped through this to ensure that it does this correctly 
before the first display.

If I call tabhost.setCurrentTab(1) instead of tabhost.setCurrentTab(0), 
then the initial display is correct.

To answer @Mark Murphy (a Commons Guy), when I subsequently click through 
the tabs, the single listview is correctly updated and displayed.
It just doesn't display correctly upon initial display.


On Wednesday, 20 June 2012 17:47:15 UTC+2, MagouyaWare wrote:

 Also, what does your OnTabChangedListener code do?

 Thanks,
 Justin Anderson
 MagouyaWare Developer
 http://sites.google.com/site/magouyaware


 On Wed, Jun 20, 2012 at 9:46 AM, Justin Anderson wrote:

 Just out of curiosity, try doing this:

 *tabhost.setCurrentTab(1);
 tabhost.setCurrentTab(0);
 *
 Does your list show up at that point?

 Thanks,
 Justin Anderson
 MagouyaWare Developer
 http://sites.google.com/site/magouyaware



 On Wed, Jun 20, 2012 at 9:41 AM, Simon Giddings  wrote:

 I have a TabActivity containing a series of four tabs and a listview.
 Each of the tabs reference the same listview.
 When the activity is initially displayed, the listview is not displayed.
 However, clicking on another tab will display it correctly and clicking 
 back on the first tab will also display it correctly.
 The content of the listview is changed depending on the selected tab.

 Here is my XML layout :
 ?xml version=1.0 encoding=utf-8?
 TabHost xmlns:android=http://schemas.android.com/apk/res/android;
 android:id=@android:id/tabhost
 android:layout_width=match_parent
 android:layout_height=match_parent 
 
 LinearLayout
 android:layout_width=fill_parent
 android:layout_height=fill_parent
 android:orientation=vertical 
 
 TabWidget
 android:id=@android:id/tabs
 android:layout_width=fill_parent
 android:layout_height=wrap_content /
 
 FrameLayout
 android:id=@android:id/tabcontent
 android:layout_width=fill_parent
 android:layout_height=fill_parent 

 ListView
 android:id=@+id/listPoisFound
 android:layout_width=match_parent
 android:layout_height=wrap_content 
 /ListView
 
 /FrameLayout
 /LinearLayout

 /TabHost

 The tabs are initialised like this :
 TabHost tabhost = null;
 TabHost.TabSpec spec = null;
 // get the tabhost
 tabhost = getTabHost();
 
 // create the individual tabs
 spec = tabhost.newTabSpec(first);
 spec.setIndicator(First);
 spec.setContent(R.id.list);
 tabhost.addTab(spec);
 
 spec = tabhost.newTabSpec(second);
 spec.setIndicator(Second);
 spec.setContent(R.id.list);
 tabhost.addTab(spec);
 
 spec = tabhost.newTabSpec(third);
 spec.setIndicator(Third);
 spec.setContent(R.id.list);
 tabhost.addTab(spec);
 
 spec = tabhost.newTabSpec(fourth);
 spec.setIndicator(Fourth);
 spec.setContent(R.id.list);
 tabhost.addTab(spec);
 
 tabhost.setCurrentTab(0);
 
 tabhost.setOnTabChangedListener(this);

 Has anyone come across this problem ?
 What is the solution ?

 -- 
 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 inside a tabhost not displaying content initially

2012-06-20 Thread Justin Anderson

 If I call tabhost.setCurrentTab(1) instead of tabhost.setCurrentTab(0),
 then the initial display is correct.


I think you misunderstood me... I wanted you to call both of them... First,
set the current tab to 1 and then to 0...  Does the listview display
correctly on tab 0 if you do this?  My guess is that it would.  This is
probably not the best way to solve the problem though, but would work be a
potential workaround if all else fails.

To answer your question, the OnTabChangedListener code rebuilds the
 listview content.


I noticed you are setting the OnTabChangedListener after setting the
current tab... What happens if you try setting the change listener first?
You may need to verify that this method gets called when you do this... if
the tab host defaults the current tab to 0 and then you set it to 0 it may
decide it doesn't need to do anything... In which case, you would need to
call the method for a tab change manually yourself first.

To answer @Mark Murphy (a Commons Guy), when I subsequently click through
 the tabs, the single listview is correctly updated and displayed.
 It just doesn't display correctly upon initial display.


Just because it seems to work doesn't mean it is actually supported.  If
this is not the intended way to use a tabhost then it may just work as a
side-effect of other things, but you may see weirdness as a result of it...
If this isn't supposed to be supported then the devs likely have not tested
this scenario...

Thanks,
Justin Anderson
MagouyaWare Developer
http://sites.google.com/site/magouyaware


On Wed, Jun 20, 2012 at 10:00 AM, Simon Giddings mr.s.giddi...@gmail.comwrote:

 Wow, I hadn't expected replies so quickly !

 @MagouyaWare - To answer your question, the OnTabChangedListener code
 rebuilds the listview content.
 I have indeed stepped through this to ensure that it does this correctly
 before the first display.

 If I call tabhost.setCurrentTab(1) instead of tabhost.setCurrentTab(0),
 then the initial display is correct.

 To answer @Mark Murphy (a Commons Guy), when I subsequently click through
 the tabs, the single listview is correctly updated and displayed.
 It just doesn't display correctly upon initial display.


 On Wednesday, 20 June 2012 17:47:15 UTC+2, MagouyaWare wrote:

 Also, what does your OnTabChangedListener code do?

 Thanks,
 Justin Anderson
 MagouyaWare Developer
 http://sites.google.com/site/**magouyawarehttp://sites.google.com/site/magouyaware


 On Wed, Jun 20, 2012 at 9:46 AM, Justin Anderson wrote:

  Just out of curiosity, try doing this:

 *tabhost.setCurrentTab(1);
 tabhost.setCurrentTab(0);
 *
 Does your list show up at that point?

 Thanks,
 Justin Anderson
 MagouyaWare Developer
 http://sites.google.com/site/**magouyawarehttp://sites.google.com/site/magouyaware



 On Wed, Jun 20, 2012 at 9:41 AM, Simon Giddings  wrote:

 I have a TabActivity containing a series of four tabs and a listview.
 Each of the tabs reference the same listview.
 When the activity is initially displayed, the listview is not displayed.
 However, clicking on another tab will display it correctly and clicking
 back on the first tab will also display it correctly.
 The content of the listview is changed depending on the selected tab.

 Here is my XML layout :
 ?xml version=1.0 encoding=utf-8?
 TabHost 
 xmlns:android=http://schemas.**android.com/apk/res/androidhttp://schemas.android.com/apk/res/android
 
 android:id=@android:id/**tabhost
 android:layout_width=match_**parent
 android:layout_height=match_**parent 

 LinearLayout
 android:layout_width=fill_**parent
 android:layout_height=fill_**parent
 android:orientation=vertical 

 TabWidget
 android:id=@android:id/tabs
 android:layout_width=fill_**parent
 android:layout_height=wrap_**content /

 FrameLayout
 android:id=@android:id/**tabcontent
 android:layout_width=fill_**parent
 android:layout_height=fill_**parent 

 ListView
 android:id=@+id/**listPoisFound
 android:layout_width=match_**parent
 android:layout_height=wrap_**content 
 /ListView

 /FrameLayout
 /LinearLayout

 /TabHost

 The tabs are initialised like this :
 TabHost tabhost = null;
 TabHost.TabSpec spec = null;
 // get the tabhost
 tabhost = getTabHost();

 // create the individual tabs
 spec = tabhost.newTabSpec(first);
 spec.setIndicator(First);
 spec.setContent(R.id.list);
 tabhost.addTab(spec);

 spec = tabhost.newTabSpec(second);
 spec.setIndicator(Second);
 spec.setContent(R.id.list);
 tabhost.addTab(spec);

 spec = tabhost.newTabSpec(third);
 spec.setIndicator(Third);
 spec.setContent(R.id.list);
 tabhost.addTab(spec);

 spec = tabhost.newTabSpec(fourth);
 

Re: [android-developers] ListView inside a tabhost not displaying content initially

2012-06-20 Thread Simon Giddings
Hi Justin,

Yes, you are right.  I went too fast in my reply.  I did indeed make the 
two calls and it did indeed work.
I was wanting to limit the number of resources needed in this activity - 
where in my use of one unique ListView.

After this short discussion, I think I will try to use a single list view 
per tab and see what the performance hit will be.


On Wednesday, 20 June 2012 18:09:56 UTC+2, MagouyaWare wrote:

 If I call tabhost.setCurrentTab(1) instead of tabhost.setCurrentTab(0), 
 then the initial display is correct.


 I think you misunderstood me... I wanted you to call both of them... 
 First, set the current tab to 1 and then to 0...  Does the listview display 
 correctly on tab 0 if you do this?  My guess is that it would.  This is 
 probably not the best way to solve the problem though, but would work be a 
 potential workaround if all else fails.

 To answer your question, the OnTabChangedListener code rebuilds the 
 listview content.


 I noticed you are setting the OnTabChangedListener after setting the 
 current tab... What happens if you try setting the change listener first?  
 You may need to verify that this method gets called when you do this... if 
 the tab host defaults the current tab to 0 and then you set it to 0 it may 
 decide it doesn't need to do anything... In which case, you would need to 
 call the method for a tab change manually yourself first.

 To answer @Mark Murphy (a Commons Guy), when I subsequently click through 
 the tabs, the single listview is correctly updated and displayed.
 It just doesn't display correctly upon initial display.


 Just because it seems to work doesn't mean it is actually supported.  If 
 this is not the intended way to use a tabhost then it may just work as a 
 side-effect of other things, but you may see weirdness as a result of it... 
 If this isn't supposed to be supported then the devs likely have not tested 
 this scenario...

 Thanks,
 Justin Anderson
 MagouyaWare Developer
 http://sites.google.com/site/magouyaware


 On Wed, Jun 20, 2012 at 10:00 AM, Simon Giddings wrote:

 Wow, I hadn't expected replies so quickly !

 @MagouyaWare - To answer your question, the OnTabChangedListener code 
 rebuilds the listview content.
 I have indeed stepped through this to ensure that it does this correctly 
 before the first display.

 If I call tabhost.setCurrentTab(1) instead of tabhost.setCurrentTab(0), 
 then the initial display is correct.

 To answer @Mark Murphy (a Commons Guy), when I subsequently click 
 through the tabs, the single listview is correctly updated and displayed.
 It just doesn't display correctly upon initial display.


 On Wednesday, 20 June 2012 17:47:15 UTC+2, MagouyaWare wrote:

 Also, what does your OnTabChangedListener code do?

 Thanks,
 Justin Anderson
 MagouyaWare Developer
 http://sites.google.com/site/**magouyawarehttp://sites.google.com/site/magouyaware


 On Wed, Jun 20, 2012 at 9:46 AM, Justin Anderson wrote:

  Just out of curiosity, try doing this:

 *tabhost.setCurrentTab(1);
 tabhost.setCurrentTab(0);
 *
 Does your list show up at that point?

 Thanks,
 Justin Anderson
 MagouyaWare Developer
 http://sites.google.com/site/**magouyawarehttp://sites.google.com/site/magouyaware



 On Wed, Jun 20, 2012 at 9:41 AM, Simon Giddings  wrote:

 I have a TabActivity containing a series of four tabs and a listview.
 Each of the tabs reference the same listview.
 When the activity is initially displayed, the listview is not 
 displayed.
 However, clicking on another tab will display it correctly and 
 clicking back on the first tab will also display it correctly.
 The content of the listview is changed depending on the selected tab.

 Here is my XML layout :
 ?xml version=1.0 encoding=utf-8?
 TabHost 
 xmlns:android=http://schemas.**android.com/apk/res/androidhttp://schemas.android.com/apk/res/android
 
 android:id=@android:id/**tabhost
 android:layout_width=match_**parent
 android:layout_height=match_**parent 
 
 LinearLayout
 android:layout_width=fill_**parent
 android:layout_height=fill_**parent
 android:orientation=vertical 
 
 TabWidget
 android:id=@android:id/tabs
 android:layout_width=fill_**parent
 android:layout_height=wrap_**content /
 
 FrameLayout
 android:id=@android:id/**tabcontent
 android:layout_width=fill_**parent
 android:layout_height=fill_**parent 

 ListView
 android:id=@+id/**listPoisFound
 android:layout_width=match_**parent
 android:layout_height=wrap_**content 
 /ListView
 
 /FrameLayout
 /LinearLayout

 /TabHost

 The tabs are initialised like this :
 TabHost tabhost = null;
 TabHost.TabSpec spec = null;
 // get the tabhost
 tabhost = getTabHost();
 
 // create the individual tabs
 spec = 

[android-developers] ListView not rendering completely in certain animation conditions

2012-06-19 Thread Richard Nelson
When an animation plays on a ListView which is placed on top of a VideoView 
in a RelativeLayout (this happens when the ListView is placed above some 
other view types as well, but not for example, ImageView), the ListView is 
not rendered entirely. If requestLayout() is called on the listview on 
animation completion, it then becomes completely visible. Here are two 
screenshots, the second one with requestLayout() called at animation 
completion:

http://imgur.com/a/b8TVa

Here's paste of code to see this oddness: http://gist.github.com/2934018 . 
If one removes the rotationY objectAnimator, the ListView displays 
correctly. Or if the VideoView is replaced with an ImageView, the animation 
with the rotationY objectAnimator displays correctly.

Another way to see this is to place the listview in the ListFlipper 
(layout/rotation_list.xml) sample in the API demos in a relative layout 
with a VideoView, both with match_parent/match_parent layout params.

I'm unsure if this is a bug or if I'm doing something wrong - if it's a 
bug, is there a workaround? I haven't tested this with any view type other 
than ListView. I get the same behaviour on a 4.0.3 device (Samsung 
GT-N7000) and the emulator.

cheers,
-- Richard

-- 
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 HighLight when clicking the itemView

2012-06-18 Thread Raphael
I just wonder how to cancel the highlighting effects of the sub-item
of the ListView,when pressing mouse down on it.

-- 
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 HighLight when clicking the itemView

2012-06-18 Thread Justin Anderson
If I understand your question correctly, just override the listview's
selector...  You can do this with the the android:listSelector property.

Thanks,
Justin Anderson
MagouyaWare Developer
http://sites.google.com/site/magouyaware


On Mon, Jun 18, 2012 at 4:24 AM, Raphael raphael.li...@gmail.com wrote:

 I just wonder how to cancel the highlighting effects of the sub-item
 of the ListView,when pressing mouse down on it.

 --
 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

  1   2   3   4   5   6   7   8   >