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

2016-02-22 Thread Streets Of Boston
I assume your ListView has a ListAdapter (probably a BaseAdapter?).

In your Adapter's getView(...) method, you have a position parameter. The 
position is the index into your array-list of data that you'd like to show 
in the correct list-item-view. 

You get your data-item from the Adapter given the position 
(getItem(position)).
You create your view, if your convertView is not yet set. In that view you 
have your EditText/TextViews and you assign the data from the data-item to 
these views.
Use the method 'setTag(...)' of your list-item-view and set the data-item 
as the list-item-view's tag.

When you convertView was null, you had to create you list-item-view. When 
creating this, set a TextWatcher to your EditText that allows you to be 
notified when the user changes the text.

In your TextWatcher, get hold of the list-item-view of your EditText. Get 
the tag from the list-item-view (getTag(...) method) and that will be the 
data-item associated with that list-item-view. Update the changed text from 
the EditText in your data-item.

When saving the data to the server, get hold of you Adapter, use getCount() 
and getItem(...) calls to get all the data-items. It should contain the 
updated EditText texts.


On Friday, February 19, 2016 at 5:17:24 AM UTC-5, NIWEWE David wrote:
>
> 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/afa64fb3-d08a-4e5b-8fe6-6eef7823f818%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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

2015-12-04 Thread Mihir Raj


On Tuesday, December 1, 2015 at 2:48:53 AM UTC+5:30, AbdulMajeed Mohammad 
wrote:
>
> 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,
>



Try to print your data using LOG function and try to narrow down problem. 
If your LOG does not print anything it means you are not getting any data 
likewise do this to check functionality that you have implemented and 
figure out where is problem in the code! happy coding !
 

-- 
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/80af1f4e-6487-43ab-99ff-2de850bf4078%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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

2014-05-19 Thread plnelson


*FIXED:*

I fixed the *getCount()* problem.  After updating the listItems I now call 
*setListAdapter()* on the ListActivity.  (@Streets of Boston - there is 
only one ListActivity).   After that, when I call the ListView's 
*getCount()* it returns the correct value.

*N.B.* that this does *not* fix the other bug I have in a parallel thread - 
getView's position parameter value coming back too big 
:https://groups.google.com/forum/#!topic/android-developers/Rc09iKIAd9w




>
 

-- 
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] Re: ListView getCount is wrong - how do I reset it?

2014-05-19 Thread Streets Of Boston
Debug the listItems (ArrayList of Strings). Monitor its add method(s), i.e. 
set breakpoints on them, and figure out which code adds to this static list 
without notifying the ListAdapter(s). 


On Monday, May 19, 2014 9:53:44 AM UTC-4, plnelson wrote:
>
>
> I call if after adding each one mostly for diagnostics -  I wanted to see 
> in the debugger what changed and when.   That's the same reason I'm getting 
> the list items size -  for diagnostics, for debugging this problem.
>
> *It's all for the same question *- How do I get ListView to report its 
> correct size in getCount after the the size of its dataset changes?   When 
> the size of listItems was 12 the listView's getCount returned 12; After 
> I've changed the size of listItems to 6 I expect the ListView's getCount to 
> return 6 - how to I get ListView to correctly return its new count?
>
>
>
>
> On Monday, May 19, 2014 3:39:33 AM UTC-4, Rufatet Babakishiyev wrote:
>>
>> After adding each item to listItems I do a notifyDataSetChanged() on the 
>> adapter.
>>
>> Why you call adter adding each time.
>>
>> public void updateListItems(){
>>// TODO clear list
>>// TODO Add element to list
>>// TODO NOTIFY DATA SET CHANGED
>>// TODO try to get list item size (I do not know why you need it)
>> }
>>
>> P.S Sure you created adapter with this list and adapter set to list.
>>
>>
>> On Friday, May 16, 2014 11:58:17 PM UTC+5, plnelson wrote:
>>>
>>> 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 ArrayListlistItems=new ArrayList();
>>>
>>> ... 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] Re: ListView getCount is wrong - how do I reset it?

2014-05-19 Thread Streets Of Boston
It's bad programming practice, but you inherited it, so you need to deal 
with it.. :-)

Question, though, and if this applies to your problem, you'll see why it is 
bad practices to make it static.

Your ListActivity, does it have more than one instance? In other words, are 
there more than one ListActivities that access/use this static arraylist of 
Strings?
If so, you, that could be your problem. 

It does matter that the arraylist of strings (listItems) is static. You may 
have more than one ListActivity instances around at any given time, sharing 
the same arraylist (through their ListView's adapters) and this opens a big 
can of worms.
If this is the cause of the issue, then you really should change the 
architecture. If you don't have the authority, tell whomever (didn't) give 
you that authority what the problem is and how you would like to properly 
solve it. 

On Monday, May 19, 2014 9:42:47 AM UTC-4, plnelson wrote:
>
>
>
> It's public and static because the method in the ListActivity that calls 
> it is static.   So if it wasn't static it would generate a compile-time 
> error that a static method can't refence a non-static object.   The 
> ListActivity method is static is that way because that's how the original 
> program was architected and I don't have the authority to change the 
> architecture.
>
> But why does it matter?Why can't the size of a ListView be reset if 
> it's static?
>
>
> On Saturday, May 17, 2014 4:11:48 AM UTC-4, Doug wrote:
>>
>>
>>
>> On Friday, May 16, 2014 11:58:17 AM UTC-7, plnelson wrote:
>>>
>>> ...In MyListActivity, which is a ListActivity . . .
>>>
>>> public static ListView lv;   // my ListView in the code
>>>
>>
>> Why is this public and static?
>>  
>>
>>> ...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 ArrayListlistItems=new ArrayList();
>>>
>>>
>> Why is this public and static?
>>  
>>
>>> ... 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
>>>
>>
>> Invalidate doesn't do what you think it does.  That has to do with the 
>> rendering of the view on screen, not the contents of the adapter that the 
>> ListView knows about.
>>  
>>
>>> ... 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?
>>>
>>
>> Try setting a new (non-public, non-static) adapter into the ListView 
>> instead.
>>
>> Never change the contents of the data in an adapter after you've given it 
>> to the ListView.  Make a deep copy of the data before sending it if you 
>> have to.
>>
>> Doug
>>
>>

-- 
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] Re: ListView getCount is wrong - how do I reset it?

2014-05-19 Thread plnelson

I call if after adding each one mostly for diagnostics -  I wanted to see 
in the debugger what changed and when.   That's the same reason I'm getting 
the list items size -  for diagnostics, for debugging this problem.

*It's all for the same question *- How do I get ListView to report its 
correct size in getCount after the the size of its dataset changes?   When 
the size of listItems was 12 the listView's getCount returned 12; After 
I've changed the size of listItems to 6 I expect the ListView's getCount to 
return 6 - how to I get ListView to correctly return its new count?




On Monday, May 19, 2014 3:39:33 AM UTC-4, Rufatet Babakishiyev wrote:
>
> After adding each item to listItems I do a notifyDataSetChanged() on the 
> adapter.
>
> Why you call adter adding each time.
>
> public void updateListItems(){
>// TODO clear list
>// TODO Add element to list
>// TODO NOTIFY DATA SET CHANGED
>// TODO try to get list item size (I do not know why you need it)
> }
>
> P.S Sure you created adapter with this list and adapter set to list.
>
>
> On Friday, May 16, 2014 11:58:17 PM UTC+5, plnelson wrote:
>>
>> 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 ArrayListlistItems=new ArrayList();
>>
>> ... 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] Re: ListView getCount is wrong - how do I reset it?

2014-05-19 Thread plnelson


It's public and static because the method in the ListActivity that calls it 
is static.   So if it wasn't static it would generate a compile-time error 
that a static method can't refence a non-static object.   The ListActivity 
method is static is that way because that's how the original program was 
architected and I don't have the authority to change the architecture.

But why does it matter?Why can't the size of a ListView be reset if 
it's static?


On Saturday, May 17, 2014 4:11:48 AM UTC-4, Doug wrote:
>
>
>
> On Friday, May 16, 2014 11:58:17 AM UTC-7, plnelson wrote:
>>
>> ...In MyListActivity, which is a ListActivity . . .
>>
>> public static ListView lv;   // my ListView in the code
>>
>
> Why is this public and static?
>  
>
>> ...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 ArrayListlistItems=new ArrayList();
>>
>>
> Why is this public and static?
>  
>
>> ... 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
>>
>
> Invalidate doesn't do what you think it does.  That has to do with the 
> rendering of the view on screen, not the contents of the adapter that the 
> ListView knows about.
>  
>
>> ... 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?
>>
>
> Try setting a new (non-public, non-static) adapter into the ListView 
> instead.
>
> Never change the contents of the data in an adapter after you've given it 
> to the ListView.  Make a deep copy of the data before sending it if you 
> have to.
>
> Doug
>
>

-- 
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] Re: ListView getCount is wrong - how do I reset it?

2014-05-19 Thread Rufatet Babakishiyev
After adding each item to listItems I do a notifyDataSetChanged() on the 
adapter.

Why you call adter adding each time.

public void updateListItems(){
   // TODO clear list
   // TODO Add element to list
   // TODO NOTIFY DATA SET CHANGED
   // TODO try to get list item size (I do not know why you need it)
}

P.S Sure you created adapter with this list and adapter set to list.


On Friday, May 16, 2014 11:58:17 PM UTC+5, plnelson wrote:
>
> 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 ArrayListlistItems=new ArrayList();
>
> ... 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.


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

2014-05-17 Thread TreKing
On Sat, May 17, 2014 at 3:11 AM, Doug  wrote:

> Never change the contents of the data in an adapter after you've given it
> to the ListView.
>

Come again? How do you update your UI if not by modifying the adapter data
and notifying it of the change?

-
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 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] Re: ListView getCount is wrong - how do I reset it?

2014-05-17 Thread Doug


On Friday, May 16, 2014 11:58:17 AM UTC-7, plnelson wrote:
>
> ...In MyListActivity, which is a ListActivity . . .
>
> public static ListView lv;   // my ListView in the code
>

Why is this public and static?
 

> ...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 ArrayListlistItems=new ArrayList();
>
>
Why is this public and static?
 

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

Invalidate doesn't do what you think it does.  That has to do with the 
rendering of the view on screen, not the contents of the adapter that the 
ListView knows about.
 

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

Try setting a new (non-public, non-static) adapter into the ListView 
instead.

Never change the contents of the data in an adapter after you've given it 
to the ListView.  Make a deep copy of the data before sending it if you 
have to.

Doug

-- 
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] Re: ListView vs. GridView vs. TableLayout

2013-06-17 Thread ankit the OPIUM
Is your designing is something like onClick of an item on First list should 
change content of rest of the column? If yes,you can try Fragments. It will 
be a nice to have 2 fragments in tablet and one in phone.
Just search for fragment tutorials on google you will get tons.

On Tuesday, 2 March 2010 01:29:01 UTC+5:30, sdphil wrote:
>
> I want to create a list view that looks like this:
>
> +--+--+--+
> |  |  |  |
> +--+--+--+
> |  |  |  |
> +--+--+--+
>
> It looks like a grid in terms of the selection can go to any row and
> column, but I want the left most column to be significantly wider than
> the columns to the right of it.
>
> What kind of control should I use?
>
> tia.
>
>

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

2013-05-20 Thread lbendlin
I would go with the brute force approach. Yes, you're redrawing the 
(visible part of the) list but you're only doing it once, not every five 
milliseconds.

On Thursday, May 16, 2013 5:14:29 AM UTC-4, Miha wrote:
>
> 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 
> post,
>  
> 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] Re: ListView with "selected" state does not work when list item view has a background

2013-05-20 Thread Miha
Hi!

Anybody has a similar experience or ...? How do you otherwise select a 
listview item in a "dual pane" layout? 

Regards,
 Miha.

On Thursday, May 16, 2013 11:14:29 AM UTC+2, Miha wrote:
>
> 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 
> post,
>  
> 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] Re: ListView selection remained after exit from action mode

2013-04-24 Thread yccheok
Side Note

Using MultiChoiceModeListener couple with CHOICE_MODE_MULTIPLE_MODAL will 
make this bug gone. However, for device below API level 11 will not able to 
use this 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 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] Re: Listview items focus change event

2013-03-12 Thread Shashidhar
Found the solution.

OnItemSelectedListener  on list view gets the position of the current
focused list item.|


On Tue, Mar 12, 2013 at 6:17 PM, Shashidhar  wrote:

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




[android-developers] Re: ListView background

2013-03-01 Thread Tamilarasi Sivaraj
Hi bob,

Try this:

Add a attribute on the ** Tag

*android:cacheColorHint="#" *// setting as a transparent color


Regards
Android developer
Trinay Technology Solutions
www.trinaytech.com
5705750475

On Friday, March 1, 2013 1:48:59 AM UTC+5:30, bob 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.




[android-developers] Re: ListView content thread sync cases

2013-01-27 Thread Bill Michaelson
My confusion has been due to the lack of appreciation that in spite of the 
fact that the server-obtained updates run asynchronously in a Thread 
started by the Service, the initial Service logic is part of the main 
thread which is shared with the Activities.

I had coded the Handler in one of the Activities.  I am moving the Handler 
into the Service.  This is the logical place for the code that fields 
asynchronous updates obtained from the remote location that must be 
interwoven into the functioning of the UI.  The placement satisfies two 
criteria:

   - It is started and ready to operate regardless of the state of the UI.
   - It lives in the UI thread so that no synchronization locking needs to 
   occur,
   
I simply need to provide a mechanism that enables the handler to determine 
which data structures are present and ready for update in the Activities at 
any given time.  This is accomplished by setting/resetting pointers to the 
Activies in onCreate/onDestroy. The communications thread simply needs to 
queue work to it.
Make sense?

On Friday, January 25, 2013 9:18:23 AM UTC-5, Bill Michaelson wrote:
>
> 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] Re: ListView with Editable components

2012-12-12 Thread Leossa
Thanks for answering Piren. 
That's the point. Those kind of items cause issues though they can be 
handled in some or other way. So I guess it was a design decision not to 
make things like that.

Em quarta-feira, 12 de dezembro de 2012 06h03min01s UTC-2, Piren escreveu:
>
> any kind of focusable/clickable item causes issues in listviews, but 
> nothing that can't be handled.
>
> On Tuesday, December 11, 2012 9:32:58 PM UTC+2, Leossa wrote:
>>
>> 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] Re: ListView one item per screen

2012-12-12 Thread Piren
I'm not saying that you should use the library (since its obviously isnt 
working and you dont want to revert to an older version of it).

I did say that at least to me, it be easier to either write your own 
ViewPager based on their source or make a ViewFlipper (and the likes) work 
as a pager. Trying to retrofit a ListView looks like the harder path to 
take.


On Wednesday, December 12, 2012 10:24:14 AM UTC+2, Dmitriy F wrote:
>
> I've tried using the library - it crushes when in onPause state. If I knew 
> I would be able to achieve something with rewriting the code, I would go 
> for it, but again - not sure if I can - can't waste time really.
>
> среда, 12 декабря 2012 г., 11:58:30 UTC+4 пользователь Piren написал:
>>
>> I wouldn't go that way...it wont be easy at all to cause the list to 
>> behave properly with moving between pages...
>> As i suggested before, you're much better off trying to replicate the 
>> source of ViewPager... If you dont want that much work (which i believe 
>> will actually be less work than retrofitting a listview), you'll also find 
>> it easier to add gesture control to a ViewFlipper
>>
>> On Wednesday, December 12, 2012 9:29:30 AM UTC+2, Dmitriy F wrote:
>>>
>>> Since 
>>> 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] Re: ListView one item per screen

2012-12-12 Thread Dmitriy F
I've tried using the library - it crushes when in onPause state. If I knew 
I would be able to achieve something with rewriting the code, I would go 
for it, but again - not sure if I can - can't waste time really.

среда, 12 декабря 2012 г., 11:58:30 UTC+4 пользователь Piren написал:
>
> I wouldn't go that way...it wont be easy at all to cause the list to 
> behave properly with moving between pages...
> As i suggested before, you're much better off trying to replicate the 
> source of ViewPager... If you dont want that much work (which i believe 
> will actually be less work than retrofitting a listview), you'll also find 
> it easier to add gesture control to a ViewFlipper
>
> On Wednesday, December 12, 2012 9:29:30 AM UTC+2, Dmitriy F wrote:
>>
>> Since 
>> 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] Re: ListView with Editable components

2012-12-12 Thread Piren
any kind of focusable/clickable item causes issues in listviews, but 
nothing that can't be handled.

On Tuesday, December 11, 2012 9:32:58 PM UTC+2, Leossa wrote:
>
> 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] Re: ListView one item per screen

2012-12-11 Thread Piren
I wouldn't go that way...it wont be easy at all to cause the list to behave 
properly with moving between pages...
As i suggested before, you're much better off trying to replicate the 
source of ViewPager... If you dont want that much work (which i believe 
will actually be less work than retrofitting a listview), you'll also find 
it easier to add gesture control to a ViewFlipper

On Wednesday, December 12, 2012 9:29:30 AM UTC+2, Dmitriy F wrote:
>
> Since 
> 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] Re: ListView checked state wrongly shared between 2 views when reorienting screen

2012-11-21 Thread João Paulo Forny
Sorry for asking it here, but i have the same problem and some points were 
not clear for me. 

What do you mean by views that don't need to save their state? In my case, 
the problem is with custom views that don't have the same ids, but its 
children do, because it is created from a xml file. I thought of many 
workarounds, like using android:configChanges attribute in the manifest or 
commenting the line that calls the super.onRestoreInstanceState(), but I 
really wanna know if there is a solution for this that is not considered a 
workaround.

Thanks in advance, 

Em sábado, 25 de abril de 2009 21h25min04s UTC-3, Toph escreveu:
>
> Hi, 
>
> I have TabActivity that uses 2 other ListActivities for the tabs. 
> Both underlying ListViews are set to CHOICE_MODE_MULTIPLE. 
> When I run the following sequence of events, I get a strange result: 
> 1) Setup one activity (tab) and its ListView using a CursorAdapter, 
> including checking some items on the list 
> 2) Reorient the screen (open the keyboard) 
> 3) Setup the second activity (tab) and its ListView using a 
> CursorAdapter, including checking some items on the list 
> 4) Switch back to the first tab 
>
> At this point, I can see in Eclipse that although (of course) each 
> ListView is a distinct object, the internal variable used to store the 
> checked state of items, called mCheckStates, is the SAME OBJECT 
> REFERENCE in each of the ListViews. 
>
> Clearly this is an issue, since the two views should not share the 
> checked state of items between them. 
>
> If I skip step #2, this does not occur 
>
> Here is a bit more detail: 
> After Step 1: ListView1 is object reference @1, ListView1.mCheckStates 
> is object reference @2 
> After Step 2: ListView1 is object reference @3, ListView1.mCheckStates 
> is object reference @4 (the reorientation recreates the views) 
> After Step 3: ListView2 is object reference @5, ListView1.mCheckStates 
> is object reference @2 <-- note the reuse of this reference from step 
> #1, not sure how/why 
> After Step 4: ListView1 is object reference @3 (unchanged), 
> ListView1.mCheckStates is object reference @2 (changed) <-- same as 
> ListView2.mCheckStates 
>
> 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] Re: ListView and onItemSelected

2012-11-14 Thread Khunshan Shabbir
listitem = m_adapter.getItem(position); can be listitem = 
getListAdapter().getItem(position) :P

On Thursday, 3 September 2009 02:20:31 UTC+5, danny wrote:
>
> Not sure what your issue is...but this is what worked for me. 
>
> In main activity init... 
> final ListView searchResults = (ListView) findViewById 
> (R.id.list_search_results); 
> searchResults.setOnItemClickListener(this); 
>
> and this DOES get called... 
>
> @Override 
> public void onItemClick(AdapterView parent, View view, int 
> position, long id) { 
> listItem = m_adapter.getItem(position); 
> Log.i(null, listItem.getOrderName()); 
> } 
>

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

2012-10-20 Thread Jacek Jabłoński
Okay, so after investigating problem a little bit more, I found that this
problem only applies to Android 4.0.x. This bug doesn't exist in 2.2, 2.3
or 4.1, only 4.0. The only way for me to solve this bug is to add to
onLoadFinished()


getListView().setVisibility(View.GONE);

getListView().setVisibility(View.VISIBLE);

I don't find it elegant way, bu maybe you will have some ideas.

Thanks for all answers,

Jacek


2012/10/20 Jacek Jabłoński 

> For me, even invalidate() doesn't work. It's strange.
>
>
> 2012/10/20 Andrew Mackenzie 
>
>>  I've also had problems getting notify to work, and resorted to using
>> "invalidate()" (I think that's the name, but which from memory maybe
>> deprecated??) and even just detecting that change in my List Activity and
>> doing the query for the cursor again.
>>
>> I'm pretty sure there is a more recommended, elegant, way of doing this
>> (notify()!) but I haven't found one yet that works reliably.
>>
>> --
>> 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] Re: ListView doesn't refresh when last item is deleted

2012-10-20 Thread Jacek Jabłoński
For me, even invalidate() doesn't work. It's strange.

2012/10/20 Andrew Mackenzie 

>  I've also had problems getting notify to work, and resorted to using
> "invalidate()" (I think that's the name, but which from memory maybe
> deprecated??) and even just detecting that change in my List Activity and
> doing the query for the cursor again.
>
> I'm pretty sure there is a more recommended, elegant, way of doing this
> (notify()!) but I haven't found one yet that works reliably.
>
> --
> 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] Re: ListView doesn't refresh when last item is deleted

2012-10-20 Thread Andrew Mackenzie
 I've also had problems getting notify to work, and resorted to using 
"invalidate()" (I think that's the name, but which from memory maybe 
deprecated??) and even just detecting that change in my List Activity and 
doing the query for the cursor again.

I'm pretty sure there is a more recommended, elegant, way of doing this 
(notify()!) but I haven't found one yet that works reliably.

-- 
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] Re: Listview - Header , footer issue

2012-10-11 Thread Jovish P
Thanks for the clarification. Wil give a try this.

Regards,
Jovish

On Wed, Oct 10, 2012 at 6:26 PM, Piren  wrote:

> Maybe i delivered what i meant wrong...
> You can still inflate rows predefined using XML, but your the way to
> create the specific inner layout would have to be created manually.
>
> you want to do something like this:
> 
>
>   
>   
>   
>   
>
> 
>
> You can't do that in android (well, you can, it just wouldn't work as you
> expect it to).
>
> The best option is to just do:
> 
>
> 
>
> and then "inflate" all the information inside that linear layout.
> Practically making your entire page one ListView (a listview is exactly
> that.. a linear layout inside a scrollview with some fancy wrapper code to
> make your life easier)
>
> Your "adapter" would just have to know how to inflate the "rows"
> differently according to their type.
> i.e - the first row is just a regular textview (the header).
> the second to X row would be rows of the first "listview" you wanted.
> X+1 row is again a textview (the footer) and then X+2 to the end are rows
> of the second listview type.
>
>
>
> On Wednesday, October 10, 2012 7:25:20 AM UTC+2, Jovish P wrote:
>
>> Sorry , we are not able to understand you fully. Wht is the difference
>> between the first approach we explained in the mail and the approach u
>> suggested .  Up to our knowledge both are same . Wht difference it is going
>> to make if u inflate every view programmatically instead of using xml ?
>>
>> On Tue, Oct 9, 2012 at 3:25 PM, Piren  wrote:
>>
>>> Android doesn't support putting two scrollable views one inside the
>>> other and i assume you dont want to divide the screen area between the
>>> listviews and make each take a constant size.
>>>
>>> You're best (and probably only) choice is to just do everything
>>> manually. put a linear layout inside a scrollview and inflate everything in
>>> it manually. (the two textviews and the two listviews).
>>> you can actually use the same code you wrote for your listviews to do
>>> that with some modifications.
>>> It sounds like a lot of effort, but after doing it a few times i've
>>> noticed that it isnt. in some instances it even makes stuff easier.
>>>
>>>
>>> On Tuesday, October 9, 2012 9:15:42 AM UTC+2, Jovish P wrote:

 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-d...@**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] Re: Listview - Header , footer issue

2012-10-10 Thread Piren
Maybe i delivered what i meant wrong...
You can still inflate rows predefined using XML, but your the way to create 
the specific inner layout would have to be created manually.

you want to do something like this:

   
  
  
  
  
   


You can't do that in android (well, you can, it just wouldn't work as you 
expect it to).

The best option is to just do:

   


and then "inflate" all the information inside that linear layout. 
Practically making your entire page one ListView (a listview is exactly 
that.. a linear layout inside a scrollview with some fancy wrapper code to 
make your life easier)

Your "adapter" would just have to know how to inflate the "rows" 
differently according to their type.
i.e - the first row is just a regular textview (the header).
the second to X row would be rows of the first "listview" you wanted.
X+1 row is again a textview (the footer) and then X+2 to the end are rows 
of the second listview type.



On Wednesday, October 10, 2012 7:25:20 AM UTC+2, Jovish P wrote:
>
> Sorry , we are not able to understand you fully. Wht is the difference 
> between the first approach we explained in the mail and the approach u 
> suggested .  Up to our knowledge both are same . Wht difference it is going 
> to make if u inflate every view programmatically instead of using xml ? 
>
> On Tue, Oct 9, 2012 at 3:25 PM, Piren >wrote:
>
>> Android doesn't support putting two scrollable views one inside the other 
>> and i assume you dont want to divide the screen area between the listviews 
>> and make each take a constant size.
>>
>> You're best (and probably only) choice is to just do everything manually. 
>> put a linear layout inside a scrollview and inflate everything in it 
>> manually. (the two textviews and the two listviews).
>> you can actually use the same code you wrote for your listviews to do 
>> that with some modifications.
>> It sounds like a lot of effort, but after doing it a few times i've 
>> noticed that it isnt. in some instances it even makes stuff easier.
>>
>>
>> On Tuesday, October 9, 2012 9:15:42 AM UTC+2, Jovish P wrote:
>>>
>>> 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-d...@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] Re: Listview - Header , footer issue

2012-10-09 Thread Jovish P
Sorry , we are not able to understand you fully. Wht is the difference
between the first approach we explained in the mail and the approach u
suggested .  Up to our knowledge both are same . Wht difference it is going
to make if u inflate every view programmatically instead of using xml ?

On Tue, Oct 9, 2012 at 3:25 PM, Piren  wrote:

> Android doesn't support putting two scrollable views one inside the other
> and i assume you dont want to divide the screen area between the listviews
> and make each take a constant size.
>
> You're best (and probably only) choice is to just do everything manually.
> put a linear layout inside a scrollview and inflate everything in it
> manually. (the two textviews and the two listviews).
> you can actually use the same code you wrote for your listviews to do that
> with some modifications.
> It sounds like a lot of effort, but after doing it a few times i've
> noticed that it isnt. in some instances it even makes stuff easier.
>
>
> On Tuesday, October 9, 2012 9:15:42 AM UTC+2, Jovish P wrote:
>>
>> 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

-- 
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] Re: Listview - Header , footer issue

2012-10-09 Thread Piren
Android doesn't support putting two scrollable views one inside the other 
and i assume you dont want to divide the screen area between the listviews 
and make each take a constant size.

You're best (and probably only) choice is to just do everything manually. 
put a linear layout inside a scrollview and inflate everything in it 
manually. (the two textviews and the two listviews).
you can actually use the same code you wrote for your listviews to do that 
with some modifications.
It sounds like a lot of effort, but after doing it a few times i've noticed 
that it isnt. in some instances it even makes stuff easier.

On Tuesday, October 9, 2012 9:15:42 AM UTC+2, Jovish P wrote:
>
> 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] Re: ListView | Full Code | Cannot capture item click!

2012-09-21 Thread kj
Don't set click listeners directly on the items you are creating in 
getView(). Use ListView.setOnItemClickListener() and 
ListView.setOnItemLongClickListener() instead. If you need particular item 
data, the AdapterView given in those callbacks have methods to get items at 
positions from the adapter.

On Thursday, September 20, 2012 6:13:49 AM UTC-4, Chance Sanders wrote:
>
> 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
> ___
>
> 
>
> 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">
>
>  android:layout_width="64dp"
> android:layout_height="wrap_

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

2012-09-20 Thread Chance Sanders
*This officially works. Thanks for the link.*
*
*
*MyGames.java:
*

package com.lifeofchance.bpt;


import org.json.JSONObject;

import com.androidquery.AQuery;

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.ArrayAdapter;
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;
private AQuery listAq;
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));
listAq = new AQuery(this);

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

public void setOnClickListener(
android.view.View.OnClickListener onClickListener) {
// TODO Auto-generated method stub
 }

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]);
  
row.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
Toast.makeText(getApplicationContext(), "clicked",
Toast.LENGTH_LONG).show();
}
});
return (row);

}
}

}

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

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

2012-09-20 Thread Justin Anderson
>
> I reverted to a 'working' build to demonstrate where I was in a working
> state.
>
Demonstrate to who?  Can you please post the "working" code?  Without
seeing something that you attempted, whether it is working or not, you're
not going to be given much help other than what I've already pointed out...

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


On Thu, Sep 20, 2012 at 9:07 AM, Chance Sanders wrote:

> I reverted to a 'working' build to demonstrate where I was in a working
> state.

-- 
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] Re: ListView | Full Code | Cannot capture item click!

2012-09-20 Thread Chance Sanders
I guess I should have left it in there, but I would have only been able to 
leave one attempt at, anyway, I suppose. 

I reverted to a 'working' build to demonstrate where I was in a working 
state.

Sorry about that.

On Thursday, September 20, 2012 5:13:49 AM UTC-5, Chance Sanders wrote:
>
> 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
> ___
>
> 
>
> 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">
>
>  android:layout_width="64dp"
> android:layout_height="wrap_content">
> 
>
>  android:layout_width="wrap_content"
> android:layout_height="wrap_co

[android-developers] Re: ListView elements in Dialogs never expand to full width

2012-09-16 Thread Alexander Mikhnin
Thank you for the solution. Linear Layout works as well.

среда, 1 апреля 2009 г., 13:50:50 UTC+4 пользователь Matthias написал:
>
> Okay, I found (once again), a rather ugly workaround for this: Putting 
> the textview in layout object does the job. Like this: 
>
>  
> http://schemas.android.com/apk/res/ 
> android" 
> android:layout_width="fill_parent" 
> android:layout_height="wrap_content" 
> android:paddingLeft="14dip" 
> android:paddingRight="15dip" 
> > 
>  android:id="@+id/list_dialog_item" 
> android:layout_width="fill_parent" 
> android:layout_height="wrap_content" 
> android:minHeight="?android:attr/listPreferredItemHeight" 
> android:textAppearance="?android:attr/textAppearanceLarge" 
> android:gravity="center_vertical" 
> /> 
>  
>
> But, that layout object is unnecessary overhead of course 
>
> Is this a bug maybe?

-- 
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] Re: ListView simple_list_item_activated_1 behaviour

2012-09-06 Thread Pankaj Chawla
Yes, I did and this causes the Multiselect mode CAB to show up. CAB shows up as 
soon as 
setItemChecked is called programmatically if CHOICE_MODE_MULTIPLE_MODAL is set 
for the
listView.

Anyways I went ahead and created a custom ArrayAdapter which keeps all the 
state information about
selection, multiselect etc and then based on the state it does background color 
changes when getView
is called:

public View getView(int position, View convertView, ViewGroup parent) {
View v = super.getView(position, convertView, parent);

if (!bMultiSelect)
{
if (position == nSelectedPostion)
v.setBackgroundColor(nColor);
else
v.setBackgroundColor(Color.TRANSPARENT);
}
else
{
if (nSelectedPositions[position] == 1)
v.setBackgroundColor(nMultiColor);
else
v.setBackgroundColor(Color.TRANSPARENT);
}
return v;
}




---
Take care,
Pankaj


On Thursday, September 6, 2012 at 1:34 PM, Calin Perebiceanu wrote:

> Did you tried handling the on list item click ?
> @Override
> protected void onListItemClick(ListView l, View v, int position, long id) {
> // Make the newly clicked item the currently selected one.
> getListView().setItemChecked(position, true);
> }
> 
> On Thursday, 6 September 2012 07:52:18 UTC+3, Pankaj Chawla wrote:
> > 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 
> (mailto:android-developers@googlegroups.com)
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com 
> (mailto: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] Re: ListView simple_list_item_activated_1 behaviour

2012-09-06 Thread Calin Perebiceanu
Did you tried handling the on list item click ?
 @Override
protected void onListItemClick(ListView l, View v, int position, long 
id) {
// Make the newly clicked item the currently selected one.
getListView().setItemChecked(position, true);
}

On Thursday, 6 September 2012 07:52:18 UTC+3, Pankaj Chawla wrote:
>
> 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

Re: [android-developers] Re: ListView problem while scrolling

2012-09-01 Thread Mark Murphy
On Sat, Sep 1, 2012 at 7:42 AM, LiTTle  wrote:
> It is me again!!! When I select the first item and then I did everything Mr.
> Mark Murphy said when I scroll down and then come back to the top, the first
> item is black again instead of pink? Is there any way to store this option
> (for example selected=true) and repaint the same object as pink the next
> time I come across with this item?

In getView(), if you are going to manage colors yourself, you need to
*always* set the *right color*. *You* know what the right color is;
Android does not.

That being said, I question the entire approach that you are taking.

If your ListView is being shown in conjunction with other widgets
(e.g., managed by a fragment), where the content of those other
widgets is determined by what the user tapped on in the ListView, then
the notion of maintaining a highlight is appropriate. This UI pattern
-- what Google refers to as the "master-detail pattern", is
particularly useful on landscape large-screen devices. On Android
3.0+, Android has an "activated" style that you can use to manage the
color for you. On older devices (e.g., you want master-detail on a
Kindle Fire), then you might need to manage this more yourself, using
the techniques that you are trying.

In any other circumstance, I counsel you against doing what you are
doing. For example, it may interfere with those using your app with a
D-pad, trackball, arrow keys, or some other pointing device, as they
need to distinguish which row is selected by the pointing device, so
they know which row will be "clicked" when they, say, press down on
the trackball or on the center D-pad button.

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


[android-developers] Re: ListView problem while scrolling

2012-09-01 Thread LiTTle
It is me again!!! When I select the first item and then I did everything 
Mr. Mark Murphy said when I scroll down and then come back to the top, the 
first item is black again instead of pink? Is there any way to store this 
option (for example selected=true) and repaint the same object as pink the 
next time I come across with this item?

-- 
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] Re: Listview text size

2012-08-29 Thread Justin Anderson
>
> Ate you need to change the font size programmatically, you need to use
> your own simplecursoradapter.
>

   1. If you use your own layout you don't need to set the font size
   programmatically
   2. You don't have to use SimpleCursorAdapter... You can use any adapter
   you want, and it doesn't have to be your own... You can use the stock
   adapters if they suit your needs.


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


On Wed, Aug 29, 2012 at 8:06 AM, Deep  wrote:

> Use Custom adapter.
> Implement a class extends BaseAdapter.
>
>
> On Tuesday, August 28, 2012 9:09:37 AM UTC+5:30, RAM 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

[android-developers] Re: Listview text size

2012-08-29 Thread Deep
Use Custom adapter.
Implement a class extends BaseAdapter.


On Tuesday, August 28, 2012 9:09:37 AM UTC+5:30, RAM 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

[android-developers] Re: Listview text size

2012-08-29 Thread Дмитрий Прилуцкий
Ate you need to change the font size programmatically, you need to use your 
own simplecursoradapter.


scAdapter = new simplecursoradapter_textsize(this,
> com.dim.list_orders.R.layout.row_list, cursor, new String[] {
> "name", "count(*)" }, new int[] { R.id.text1,
> R.id.text2 }, 1);
> public class simplecursoradapter_textsize extends SimpleCursorAdapter {
> private int layout;
> private String[] from;
> private int[] to;
> private String size_text;
> public simplecursoradapter_textsize(Context context, int layout,
> Cursor c, String[] from, int[] to, String size_text) {
> super(context, layout, c, from, to);
> this.layout = layout;
> this.from = from;
> this.to = to;
> this.size_text = size_text;
> }
> @Override
> public void bindView(View v, Context context, Cursor c) {
> for (int i = 0; i < from.length; i++) {
> TextView t = (TextView) v.findViewById(to[i]);
> t.setText(c.getString(c.getColumnIndex(from[i])));
> if (size_text.equals("1")) {
> t.setTextSize(getResources().getDimension(
> com.dim.list_orders.R.dimen.text_small));
> } else if (size_text.equals("3")) {
> t.setTextSize(getResources().getDimension(
> com.dim.list_orders.R.dimen.text_large));
> } else {
> t.setTextSize(getResources().getDimension(
> com.dim.list_orders.R.dimen.text_medium));
> }
> }
> }
> @Override
> public View newView(Context context, Cursor cursor, ViewGroup parent) {
> final LayoutInflater inflater = LayoutInflater.from(context);
> return inflater.inflate(layout, parent, false);
> }
> }


вторник, 28 августа 2012 г., 6:39:37 UTC+3 пользователь 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

[android-developers] Re: ListView sorting

2012-08-11 Thread Aparna Ks
i hop tis wil help you
http://www.ezzylearning.com/tutorial.aspx?tid=6816874
http://www.josecgomez.com/2010/05/03/android-putting-custom-objects-in-listview/


On Friday, 10 August 2012 00:18:41 UTC+5:30, Wolfgang 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:
>
> 
>  
>
> 
> 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

[android-developers] Re: Listview in Wifi

2012-08-10 Thread bob
 

adapter.add("Sample WAP");

On Friday, August 10, 2012 6:39:48 AM UTC-5, Meena Rengarajan wrote:
>
> 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];
>  List results = wifi.getScanResults();
>  for(int i=0;i  ScanResult result = (ScanResult)results[i];
>  str1[i] = result.SSID;
>  }
>  ArrayAdapteradapter=new 
> ArrayAdapter(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

[android-developers] Re: ListView and ListAdapter

2012-08-02 Thread Nicola Blaine


> hi John Gaby 
>
 
I have had the same issue. Could you please state what you changed in the 
end with regurds to  handling the custom ViewGroup?

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] Re: ListView with custom view item refresh issue

2012-08-01 Thread Justin Anderson
>
> Interesting…  I usually just create a new View every time in getView…  so
> I've never run into that.
>
That should be fine if you don't have a lot of items or if your views are
kept very simple Otherwise doing this will cause choppiness when
scrolling the listview.

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


On Sat, Jul 28, 2012 at 2:20 PM, soynerdito soynerdito  wrote:

>  A nice post describing that is here
> http://lucasr.org/2012/04/05/performance-tips-for-androids-listview/
> With an example of what is called a view holder to have a performance
> improvement.
> Also in the Google IO 2010 it is well explain from the developer itself
> http://www.youtube.com/watch?v=wDBM6wVEO70
>
>
>
> On Sat, Jul 28, 2012 at 2:41 PM, bob  wrote:
>
>> Interesting…  I usually just create a new View every time in getView…  so
>> I've never run into that.
>>
>>
>>
>> On Saturday, July 28, 2012 6:10:50 AM UTC-5, Sergio Panico wrote:
>>>
>>> Hi all,
>>> I thank all for your answers.
>>>
>>> I've understood the "strange" behaviour that doesn't makes my ListView
>>> to refreshes correctly.
>>>
>>> Here is the link where I've found the solution:
>>> https://groups.google.com/**forum/?fromgroups#!topic/**
>>> android-developers/2Ub4yhyKumM
>>>
>>> This topic clearly explains that, when the callback method "getView" is
>>> called, the parameter "convertView" is null only when ListView tries to
>>> draw the first 5 items, from "A" to "E". When I scroll down the content of
>>> the list, and the ListView draws the items 6 and 7, it "reuses" the views
>>> previoulsy created, hence "convertView" is not null and my getView
>>> implementation goes into "else" branch.
>>>
>>> What I've missed was to bind the "old" view, with the "new" model item
>>> getting showed. So the fix was simply to add, in this branch, the update of
>>> the bind between "recycled" view and model item.
>>>
>>> HTH
>>> Sergio
>>>
>>>
>>>
>>> Il giorno giovedì 26 luglio 2012 12:59:05 UTC+2, Sergio Panico ha
>>> scritto:

 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] Re: ListView with custom view item refresh issue

2012-07-28 Thread soynerdito soynerdito
 A nice post describing that is here
http://lucasr.org/2012/04/05/performance-tips-for-androids-listview/  With
an example of what is called a view holder to have a performance
improvement.
Also in the Google IO 2010 it is well explain from the developer itself
http://www.youtube.com/watch?v=wDBM6wVEO70


On Sat, Jul 28, 2012 at 2:41 PM, bob  wrote:

> Interesting…  I usually just create a new View every time in getView…  so
> I've never run into that.
>
>
>
> On Saturday, July 28, 2012 6:10:50 AM UTC-5, Sergio Panico wrote:
>>
>> Hi all,
>> I thank all for your answers.
>>
>> I've understood the "strange" behaviour that doesn't makes my ListView to
>> refreshes correctly.
>>
>> Here is the link where I've found the solution:
>> https://groups.google.com/**forum/?fromgroups#!topic/**
>> android-developers/2Ub4yhyKumM
>>
>> This topic clearly explains that, when the callback method "getView" is
>> called, the parameter "convertView" is null only when ListView tries to
>> draw the first 5 items, from "A" to "E". When I scroll down the content of
>> the list, and the ListView draws the items 6 and 7, it "reuses" the views
>> previoulsy created, hence "convertView" is not null and my getView
>> implementation goes into "else" branch.
>>
>> What I've missed was to bind the "old" view, with the "new" model item
>> getting showed. So the fix was simply to add, in this branch, the update of
>> the bind between "recycled" view and model item.
>>
>> HTH
>> Sergio
>>
>>
>>
>> Il giorno giovedì 26 luglio 2012 12:59:05 UTC+2, Sergio Panico ha scritto:
>>>
>>> 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

[android-developers] Re: ListView with custom view item refresh issue

2012-07-28 Thread bob
 

Interesting…  I usually just create a new View every time in getView…  so 
I've never run into that.



On Saturday, July 28, 2012 6:10:50 AM UTC-5, Sergio Panico wrote:
>
> Hi all,
> I thank all for your answers.
>
> I've understood the "strange" behaviour that doesn't makes my ListView to 
> refreshes correctly.
>
> Here is the link where I've found the solution: 
> https://groups.google.com/forum/?fromgroups#!topic/android-developers/2Ub4yhyKumM
>
> This topic clearly explains that, when the callback method "getView" is 
> called, the parameter "convertView" is null only when ListView tries to 
> draw the first 5 items, from "A" to "E". When I scroll down the content of 
> the list, and the ListView draws the items 6 and 7, it "reuses" the views 
> previoulsy created, hence "convertView" is not null and my getView 
> implementation goes into "else" branch.
>
> What I've missed was to bind the "old" view, with the "new" model item 
> getting showed. So the fix was simply to add, in this branch, the update of 
> the bind between "recycled" view and model item.
>
> HTH
> Sergio
>
>
>
> Il giorno giovedì 26 luglio 2012 12:59:05 UTC+2, Sergio Panico ha scritto:
>>
>> 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

[android-developers] Re: ListView with custom view item refresh issue

2012-07-28 Thread Sergio Panico
Hi all,
I thank all for your answers.

I've understood the "strange" behaviour that doesn't makes my ListView to 
refreshes correctly.

Here is the link where I've found the solution: 
https://groups.google.com/forum/?fromgroups#!topic/android-developers/2Ub4yhyKumM

This topic clearly explains that, when the callback method "getView" is 
called, the parameter "convertView" is null only when ListView tries to 
draw the first 5 items, from "A" to "E". When I scroll down the content of 
the list, and the ListView draws the items 6 and 7, it "reuses" the views 
previoulsy created, hence "convertView" is not null and my getView 
implementation goes into "else" branch.

What I've missed was to bind the "old" view, with the "new" model item 
getting showed. So the fix was simply to add, in this branch, the update of 
the bind between "recycled" view and model item.

HTH
Sergio



Il giorno giovedì 26 luglio 2012 12:59:05 UTC+2, Sergio Panico ha scritto:
>
> 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

[android-developers] Re: ListView with custom view item refresh issue

2012-07-27 Thread soynerdito soynerdito
Don't quite understands the situation. But here is a short example if you 
extends from BaseAdapter and implement in the same line. This is using a 
layout called custom_view (copied bellow). This code is from an Activity 
and can be on the onCreate (The activity must have a ListView called 
listView1
Experiment with different Adapters until you find the one that works better 
for you, all do basically the same but may require less code, depending on 
how much flexibility you need.

 ListView list = (ListView)findViewById(R.id.listView1);
   list.setAdapter(new BaseAdapter(){
   private String values[] = new String[] 
{"VALUE1","VALUE2","VALUE3","VALUE4","VALUE5",
   "VALUE6", "VALUE7" }; 
   
public int getCount() {
return values.length;
}

public Object getItem(int position) {
return values[position];
}

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

public View getView(int position, View convertView, ViewGroup 
parent) {
LayoutInflater inflater = getLayoutInflater();
View view = inflater.inflate(R.layout.custom_view,null);
TextView tvLine1 = (TextView)view.findViewById(R.id.textView1);
TextView tvLine2 = (TextView)view.findViewById(R.id.textView2);
tvLine1.setText(values[position]);
tvLine2.setText("Line2" + values[position]);
return view;
}
   
   });


*File: custom_view.xml*

http://schemas.android.com/apk/res/android";
android:id="@+id/LinearLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >







On Thursday, July 26, 2012 6:59:05 AM UTC-4, Sergio Panico wrote:
>
> 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

[android-developers] Re: ListView with custom view item refresh issue

2012-07-27 Thread bob
 

Sure sounds like a bug in getView.  Make sure getView works when 
position==5 and position==6.



On Thursday, July 26, 2012 5:59:05 AM UTC-5, Sergio Panico wrote:
>
> 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

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

2012-07-11 Thread Tolriq
Finally after writing my response I think about better search on google :)

And the solution is logical after I put better words on the problem :

listView.post(new Runnable() {

@Override
public void run() {
listView.requestChildRectangleOnScreen(view,
new Rect(0, 0, view.getRight(), 
view.getHeight()), false);
}
});

This will make the scroll happens after the redraw so works with correct 
measures.

Le mercredi 11 juillet 2012 14:42:45 UTC+2, Tolriq a écrit :
>
> 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

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

2012-06-29 Thread Robert Joly
I had the exact same setup in my app (multiple tabs using the same ListView 
and had the same issue as you observed).  My initial work-around was to 
quickly switch the tab to 1 and then back to 0 but, the way my app handled 
tab changes, this has some nasty side-effects.  What I ended up doing 
instead is toggling the visibility of the ListView in onStart():
mListView.setVisibility(View.GONE);
mListView.setVisibility(View.VISIBLE);

and that took care of my problem.

Good luck,
bob

-- 
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] Re: Listview similar to call logs of 'contacts' app

2012-06-11 Thread Guthyerrz maciel
But how can I create, those tow views, with like that divisor that has 
between.

Em terça-feira, 23 de novembro de 2010 04h44min59s UTC-3, deepak escreveu:
>
> Hi manas, 
>
> I forgot to mention 1 more thing. In the xml also, instead of 
> ImageView give the name of the class which extends ImageView. 
>
> Thanks, 
> Deepak 
>
> On Nov 23, 12:38 pm, deepak  wrote: 
> > Hi manas, 
> > 
> > It is actually a single list view, where we don't press the call icon 
> > when the parent is pressed. 
> > Just add a onClickListener for your view (i.e., similar to call 
> > button) in your ListActivity and implement the desired function in 
> > that. And for eg. if you are using a ImageView, then just create a 
> > class which extends ImageView and override "setPressed" function. 
> > Eg: 
> > 
> >@Override 
> > public void setPressed(boolean pressed) { 
> > // If the parent is pressed, do not set to pressed. 
> > if (pressed && ((View) getParent()).isPressed()) { 
> > return; 
> > } 
> > super.setPressed(pressed); 
> > } 
> > 
> > So, this doen't press your image view, when the parent is pressed. 
> > I hope this helps you. 
> > 
> > Thanks, 
> > Deepak 
> > 
> > On Nov 20, 4:08 pm, manas  wrote: 
> > 
> > > We are trying to create a listview exactly similar to 'call log 
> > > listview' of 'contact' application (which is a default one). 
> > > There is one listview item but two clickable controls. 
> > > 1. Left one - for viewing call log details 
> > > 2. Right one - for calling that person 
> > 
> > > Any pointer on how to achieve 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] Re: ListView with Simple adapter

2012-05-24 Thread imran ali
Hi, 
why are you doing this 
   View row=super.getView(position, convertView, parent);
 though you are in getView() Method.
so you will get convertView that is same. 

Ok, 
follow this,

if(convertview==null){
1. inflate view,  
2. check type of data and set visibility 
3.set tag of view.

}else{
// getTag value 
}
//set values in fields of view.

hope it will help you.

Regards
Imran Ali


On Thursday, May 24, 2012 4:22:42 PM UTC+5:30, shruthi santosh wrote:
>
> here is the code for getView(),
>
>  public View getView(int position, View convertView, ViewGroup parent) {
>
>View row=super.getView(position, convertView, parent);
>ViewHolder holder=(ViewHolder)row.getTag();
>if (holder==null) {
>String type="T";
>holder=new ViewHolder(row);
>row.setTag(holder);
>String blog_type = 
> ((TextView)row.findViewById(R.id.type)).getText().toString();
>if(blog_type.equals(type))
>{
>holder.button.setVisibility(Button.GONE);
>holder.text.setVisibility(TextView.VISIBLE);
>holder.text1.setVisibility(TextView.GONE);
>holder.button1.setVisibility(Button.VISIBLE);
>}
>holder.button.setTag(row);
>holder.button.setOnClickListener(new 
> View.OnClickListener() {
> 
> @Override
> public void onClick(View v) {
> // TODO Auto-generated method stub
> View r=(View)v.getTag();
> String type="A";
> String blog_data = 
> ((TextView)r.findViewById(R.id.blog_data)).getText().toString();
> String blog_id = 
> ((TextView)r.findViewById(R.id.blog_id)).getText().toString();
> String blog_type = 
> ((TextView)r.findViewById(R.id.type)).getText().toString();
> if(blog_type.equals(type))
> {
> playMessage(Integer.parseInt(blog_id));
> }
> 
> }
> });
>
>holder.button1.setTag(row);
>holder.button1.setOnClickListener(new 
> View.OnClickListener() {
> 
> @Override
> public void onClick(View v) {
> // TODO Auto-generated method stub
> View r=(View)v.getTag();
> String type="T";
> String blog_data = 
> ((TextView)r.findViewById(R.id.blog_data)).getText().toString();
> String blog_id = 
> ((TextView)r.findViewById(R.id.blog_id)).getText().toString();
> String blog_type = 
> ((TextView)r.findViewById(R.id.type)).getText().toString();
> String annotation = 
> ((TextView)r.findViewById(R.id.annotation)).getText().toString();
> String url = 
> ((TextView)r.findViewById(R.id.url)).getText().toString();
> if(blog_type.equals(type))
> {
> Intent message=new 
> Intent(FeedsActivity.this, BlogMessage.class);
> message.putExtra("blog_data", blog_data);
> message.putExtra("annotation", annotation);
> message.putExtra("flag","false");
> message.putExtra("url", url);
> startActivity(message);
> }
> 
> }
> }); 
>
>holder.text1.setTag(row);
>holder.text1.setOnClickListener(new 
> View.OnClickListener() {
> 
> @Override
> public void onClick(View v) {
> // TODO Auto-generated method stub
> View r=(View)v.getTag();
> String type="A";
> String blog_data = 
> ((TextView)r.findViewById(R.id.blog_data)).getText().toString();
> String blog_id = 
> ((TextView)r.findViewById(R.id.blog_id)).getText().toString();
> String blog_type = 
> ((TextView)r.findViewById(R.id.type)).getText().toString();
> Strin

Re: [android-developers] Re: ListView with Simple adapter

2012-05-24 Thread shruthi santosh
i had tried if ...else condition.it did not wok.so i changed it to
if...else if

shruthi

On Thu, May 24, 2012 at 4:22 PM, kalandar  wrote:

>
>  hi shruthi,
>
> I think you are using if condition inside the getView method to
> visible or invisible some buttons.
> try if... else condition instead of if , like this
>
> if(condition true)
>  {
>   button visible;
>  }
> else
>  {
>   button false;
>  }
>
> it will cure your problem
> let me know this will help or not
>
> Regards
> kalandar N
>
> --
> 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] Re: ListView with Simple adapter

2012-05-24 Thread shruthi santosh
here is the code for getView(),

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

   View row=super.getView(position, convertView, parent);
   ViewHolder holder=(ViewHolder)row.getTag();
   if (holder==null) {
   String type="T";
   holder=new ViewHolder(row);
   row.setTag(holder);
   String blog_type =
((TextView)row.findViewById(R.id.type)).getText().toString();
   if(blog_type.equals(type))
   {
   holder.button.setVisibility(Button.GONE);
   holder.text.setVisibility(TextView.VISIBLE);
   holder.text1.setVisibility(TextView.GONE);
   holder.button1.setVisibility(Button.VISIBLE);
   }
   holder.button.setTag(row);
   holder.button.setOnClickListener(new
View.OnClickListener() {

@Override
public void onClick(View v) {
// TODO Auto-generated method stub
View r=(View)v.getTag();
String type="A";
String blog_data =
((TextView)r.findViewById(R.id.blog_data)).getText().toString();
String blog_id =
((TextView)r.findViewById(R.id.blog_id)).getText().toString();
String blog_type =
((TextView)r.findViewById(R.id.type)).getText().toString();
if(blog_type.equals(type))
{
playMessage(Integer.parseInt(blog_id));
}

}
});

   holder.button1.setTag(row);
   holder.button1.setOnClickListener(new
View.OnClickListener() {

@Override
public void onClick(View v) {
// TODO Auto-generated method stub
View r=(View)v.getTag();
String type="T";
String blog_data =
((TextView)r.findViewById(R.id.blog_data)).getText().toString();
String blog_id =
((TextView)r.findViewById(R.id.blog_id)).getText().toString();
String blog_type =
((TextView)r.findViewById(R.id.type)).getText().toString();
String annotation =
((TextView)r.findViewById(R.id.annotation)).getText().toString();
String url =
((TextView)r.findViewById(R.id.url)).getText().toString();
if(blog_type.equals(type))
{
Intent message=new
Intent(FeedsActivity.this, BlogMessage.class);
message.putExtra("blog_data", blog_data);
message.putExtra("annotation", annotation);
message.putExtra("flag","false");
message.putExtra("url", url);
startActivity(message);
}

}
});

   holder.text1.setTag(row);
   holder.text1.setOnClickListener(new
View.OnClickListener() {

@Override
public void onClick(View v) {
// TODO Auto-generated method stub
View r=(View)v.getTag();
String type="A";
String blog_data =
((TextView)r.findViewById(R.id.blog_data)).getText().toString();
String blog_id =
((TextView)r.findViewById(R.id.blog_id)).getText().toString();
String blog_type =
((TextView)r.findViewById(R.id.type)).getText().toString();
String annotation =
((TextView)r.findViewById(R.id.annotation)).getText().toString();
String url =
((TextView)r.findViewById(R.id.url)).getText().toString();
if(blog_type.equals(type))
{
Intent message=new
Intent(FeedsActivity.this, BlogMessage.class);
message.putExtra("blog_data", blog_data);
message.putExtra("annotation", annotation);
message.putExtra("flag","true");
message.putExtra("url", url);
message.putExtra("type", type);
startActivity(message);
}

}
});
   }
  

[android-developers] Re: ListView with Simple adapter

2012-05-24 Thread kalandar

 hi shruthi,
  
I think you are using if condition inside the getView method to 
visible or invisible some buttons.
try if... else condition instead of if , like this

if(condition true)
 {
  button visible;
 }
else
 {
  button false;
 }

it will cure your problem
let me know this will help or not

Regards
kalandar N

-- 
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] Re: ListView with Simple adapter

2012-05-24 Thread imran ali
can you post part of code where your doing visible/invisible of buttons.
I think you are doing some mistake in getView(...) method of Adapter.
and it is going to mess on scroll of listview.


Regards
Imran Ali
On Thursday, May 24, 2012 2:56:38 PM UTC+5:30, shruthi santosh wrote:
>
> My feeds list conatins both text feeds and audio feeds.
> I have a button to view the complete text and a button to play the audio 
> feeds.
> I am checking the the type of the feed to make the appropriate button 
> visible.
> The first four feeds in the list gets the proper buttons but the rest are 
> not proper(i mean some text feeds r getting audio button and some audio 
> feeds are getting text button)
> Pl. help me with this problem
>
> shruthi
>

-- 
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] Re: Listview with multiple layout

2012-05-21 Thread Mek Rama

Layout:
Two layout xml  files:  1)one layout for listview 2)another layout for list 
items.  use two textview widget  and arrange it one below other.
Layout:  1)linear layout 2)relative layout or use combination of relative 
and linear

application code:

use i)SimpleCursorAdapter ii)custom adapter that fits your requirement

Referece : 
http://developer.android.com/reference/android/app/ListActivity.html
Use  list adapter similar to examles in  listing 4 and 14
http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/view/List4.html
 





On Friday, May 18, 2012 11:39:48 AM UTC+5:30, Jovish P wrote:
>
> In our app we have to show a screen just like below.  The data is in a 
> hash map with key value pairs.
> We want to show the keys of hashmap as header item of Listview and values 
> for that keys  as item layout under that key.
>  Please help us how to implement this.
>
> Regards, 
> Jovish
>

-- 
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] Re: Listview of programmatically created Drawables

2012-04-02 Thread Gene
Thanks.  I ended up wrapping the Drawable in a custom View. It wasn't
hard and I can control the appearance with custom attributes, which is
very nice.

On Mar 25, 3:41 am, Kostya Vasilyev  wrote:
> Set them as background objects for some views that appear in your item
> layouts.
>
> Or use image views and set them as 'src' images (this way you'll have
> better control over scaling and clipping).
>  25.03.2012 5:29 пользователь "Gene"  написал:
>
> > How can you get programmed stroked Drawables (not bitmaps) to appear
> > in the lines of a ListView?
>
> > On Mar 23, 1:36 am, TreKing  wrote:
> > > On Thu, Mar 22, 2012 at 9:42 PM, Gene  wrote:
> > > > ListView seems to be the way to go, but I can't grok how to make
> > > > other-than-bitmaps appear in ListView items.  No Canvas is in sight.
>
> > > You might want to elaborate and clarify - I, for one, have no clue what
> > > you're getting at.
>
> > --- 
> > ---
> > > 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] Re: Listview of programmatically created Drawables

2012-03-25 Thread tomc_apadmi
I haven't done anyting like what you are trying before but my best guess 
would be to create your own custom view overriding onDraw().

The below link might be useful.
http://stackoverflow.com/questions/2763572/override-ondraw-to-change-how-the-drawing-occurs-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] Re: Listview of programmatically created Drawables

2012-03-25 Thread Kostya Vasilyev
Set them as background objects for some views that appear in your item
layouts.

Or use image views and set them as 'src' images (this way you'll have
better control over scaling and clipping).
 25.03.2012 5:29 пользователь "Gene"  написал:

> How can you get programmed stroked Drawables (not bitmaps) to appear
> in the lines of a ListView?
>
> On Mar 23, 1:36 am, TreKing  wrote:
> > On Thu, Mar 22, 2012 at 9:42 PM, Gene  wrote:
> > > ListView seems to be the way to go, but I can't grok how to make
> > > other-than-bitmaps appear in ListView items.  No Canvas is in sight.
> >
> > You might want to elaborate and clarify - I, for one, have no clue what
> > you're getting at.
> >
> >
> --
> > 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] Re: Listview of programmatically created Drawables

2012-03-24 Thread Gene
How can you get programmed stroked Drawables (not bitmaps) to appear
in the lines of a ListView?

On Mar 23, 1:36 am, TreKing  wrote:
> On Thu, Mar 22, 2012 at 9:42 PM, Gene  wrote:
> > ListView seems to be the way to go, but I can't grok how to make
> > other-than-bitmaps appear in ListView items.  No Canvas is in sight.
>
> You might want to elaborate and clarify - I, for one, have no clue what
> you're getting at.
>
> ---­--
> 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] Re: ListView header/footer problem

2012-03-22 Thread Jason Tian
I've had a similar problem. And here is my solution:

Put the header/footer in another wrapper layout (e.g. a FrameLayout maybe), 
and set this wrapper to be the header/footer.

Hope it works.

在 2012年3月19日星期一UTC+8下午2时56分31秒,gropapa写道:
>
> hello guys,
> I have an expandableListView in wich i add a LinearLayout View as header 
> and another one for the footer.
> After i affect the Adapter, i want to be able to show/hide those views.
> The problem is that if i write
> myView.setVisibility(View.GONE)
> it acts exactly the same as INVISIBLE.
> Since it is not possible to removeHeader and add it back... really don't 
> see how i can fix, if you have any idea
>

-- 
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] Re: listview populate from external url

2012-02-21 Thread moktarul anam
Hi Abu,

http://ofertaweb.ro/android/sleepandlovemusic/list_files.php  api
output is one string
u can do this way ,
1. get the content of that url in string format
String output =
"Crickets_near_a_River:::Waterfall:::rainforest_sound:::Quick_Rain:::Atlantic_Ocean..";

2. string split of ":::" and put into ArrayList
3. Display ArrayList in listview

Enjoy
Moktarul

On Feb 21, 2:11 am, Abu Hamzah  wrote:
> i have posted my question here
> (http://stackoverflow.com/questions/9355617/android-mediaplayer-
> streaming-music) but no avail, can anybody look at the question let me
> know what i am missing?
> i am trying a way to populate listview items from this 
> urlhttp://ofertaweb.ro/android/sleepandlovemusic/list_files.php
>
> anybody please?

-- 
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] Re: listview search improve performance

2012-02-09 Thread skink


On 9 Lut, 12:43, vani reddy  wrote:
> I am not able to avoid creating a new adapter after every search.
>

see AbsListView.html#attr_android:textFilterEnabled

AbsListView already supports all you need to perform row filtering: it
creates temp TextView that displays filter constraint, delays actual
filtering etc

pskink

-- 
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] Re: ListView item into ListView

2012-01-31 Thread Narendra Singh Rathore
On Tue, Jan 31, 2012 at 1:46 AM, fala70  wrote:

> then ? what is the best solution to use a list variable items into an
> item listview ?
>

Hey, What about ExpandableListView?
Try that, may be helpful for you.

-- 
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] Re: ListView item into ListView

2012-01-31 Thread Narendra Singh Rathore
On Tue, Jan 31, 2012 at 1:46 AM, fala70  wrote:

> then ? what is the best solution to use a list variable items into an
> item listview ?
>

Hey, what about ExpandableListView?
Try that, may be helpful for you.

With Regards,
NSR

-- 
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] Re: ListView item into ListView

2012-01-30 Thread TreKing
On Mon, Jan 30, 2012 at 2:16 PM, fala70  wrote:

> what is the best solution to use a list variable items into an item
> listview ?
>

"Best" is debatable. If you just need a list of items, one after another, a
LinearLayout should suffice.

-
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] Re: ListView item into ListView

2012-01-30 Thread fala70
then ? what is the best solution to use a list variable items into an
item listview ?

On 30 Gen, 18:01, TreKing  wrote:
> On Mon, Jan 30, 2012 at 10:25 AM, fala70  wrote:
> > Any Idea ?
>
> Don't use ListViews within ListViews. That doesn't really make sense. Also,
> it's "inflated", not "inflacted".
>
> --- 
> --
> 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] Re: Listview and expandablelistview

2012-01-13 Thread FiltrSoft
well the "profit" part may be a little tricky, with Android. ;)

On Jan 13, 10:10 am, TreKing  wrote:
> On Fri, Jan 13, 2012 at 3:28 AM, Uday Gokhale wrote:
>
> > How can i achieve this.
>
> Learn to program, read the docs, read the samples, write some code, fail,
> learn, debug, fix, ask a better question, profit.
>
> -
> 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] Re: ListView + EditText

2011-11-01 Thread Kumar Bibek
I think it's possible. But I have never tried though.

But what I have learnt is that ListView aren't the best way to handle
such an UI.

This link would perhaps give you some more insights.

http://groups.google.com/group/android-developers/browse_thread/thread/50f0fc185da8fe4d

On Nov 1, 7:23 pm, John Gaby  wrote:
> I have a ListView which displays rows which can have a variety of
> controls.  If the row contains TextViews, ImageViews, and/or Buttons,
> everything works as expected.  However, if I add a EditText control to
> a row, then I no longer seem to be able to select a row (touching
> outside of the EditText control, of course).  Note that if I have a
> button on the row, it still works, but if I touch the row itself,
> onItemClick never fires.  Is it not possible to have EditText controls
> on rows of a ListView?
>
> 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] Re: Listview based on CursorAdapter, how to skip displaying a row?

2011-10-20 Thread Kostya Vasilyev
That should work, provided that item separators are disabled in the list 
view and added instead to layouts for the visible items.


20.10.2011 21:00, lbendlin пишет:

instead of skipping the row can you set the row height to zero?
--
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 


--
Kostya Vasilyev

--
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] Re: Listview based on CursorAdapter, how to skip displaying a row?

2011-10-20 Thread lbendlin
instead of skipping the row can you set the row height to zero?

-- 
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] Re: listview adapter. Recycle bitmap

2011-10-16 Thread emanuele
Putting the bitmap reference in the convertview tag and retrieve the
tag when
The getview is called could be a solution?

On 17 Ott, 04:41, IcedNet  wrote:
> You should look into Romain Guy's 2009/10 Google I/O presentations on
> UI -- he is the whip with ListViews/UI.
> If you're looking for what I think you're looking to do -- which is
> speed up that list view -- he has a view holder pattern that will do
> just that.
>
> Peace,
> Dan
>
> On Oct 16, 10:08 pm, Studio LFP  wrote:
>
>
>
> > Based on the code there, you wouldn't have the chance to recycle the bitmap
> > as you don't keep a handle to it anywhere.
>
> > Then again, if the ListView discards that particular row and you aren't
> > retaining any handles to the bitmap, then the bitmap should be scheduled for
> > collection by the GC. If you did try to retrieve the view that was holding
> > the image from the ListView and it did return it to you, there is a good
> > chance the ListView still wants to use it and you would not want to release
> > the bitmap.
>
> > Is there a reason you are wanting to try to recycle the bitmap?
>
> > Also, we are talking about the recycle() function on bitmap and not reusing
> > the same bitmap, correct?
>
> > Steven
> > Studio LFPhttp://www.studio-lfp.com
>
> > On Sunday, October 16, 2011 4:14:48 AM UTC-5, emanuele wrote:
>
> > > Hello guys.. that s my baseAdapter getview implmentation:
>
> > > @Override
> > > public View getView(int position, View convertView, ViewGroup parent)
> > > {
>
> > > int type = getItemViewType(position);
> > > if (convertView == null) {
> > > switch (type) {
> > > case TYPE_BIG_NEWS:
> > > convertView = mInflater.inflate(R.layout.big_news, null);
> > > break;
> > > case TYPE_NORMAL_NEWS:
> > > convertView = mInflater.inflate(R.layout.normal_news, null);
> > > break;
> > > default:
> > > break;
> > > }
> > > }
>
> > > ImageView thumb = (ImageView)
> > > convertView.findViewById(R.id.thumbId);
>
> > > File f = null;
> > > if (filename != null)
> > > f = mFileCache.getFile(i.newsKey, filename);
> > > if (f == null) {
> > > if (mGetThumbsThread != null && filename != null) {
> > > Log.i(TAG, "cache miss");
> > > thumbLinks.offer(new ThumbRequest(i.newsKey, i.thumbLink,
> > > i.thumbName));
> > > mGetThumbsThread.signal();
> > > }
> > > thumb.setImageResource(placeHolder);
> > > } else {
> > > Log.i(TAG,
> > > "file bitmap cached: " + f.getName() + " size: " + f.length() /
> > > 1024);
> > > bitmap = BitmapFactory.decodeFile(f.getAbsolutePath());
> > > thumb.setImageBitmap(bitmap);
> > > }
>
> > > return convertView;
> > > }
>
> > > Every row is compound of text and an ImageView. Is there any chance to
> > > recycle the bitmap I use in the getView?

-- 
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] Re: listview adapter. Recycle bitmap

2011-10-16 Thread IcedNet
You should look into Romain Guy's 2009/10 Google I/O presentations on
UI -- he is the whip with ListViews/UI.
If you're looking for what I think you're looking to do -- which is
speed up that list view -- he has a view holder pattern that will do
just that.

Peace,
Dan

On Oct 16, 10:08 pm, Studio LFP  wrote:
> Based on the code there, you wouldn't have the chance to recycle the bitmap
> as you don't keep a handle to it anywhere.
>
> Then again, if the ListView discards that particular row and you aren't
> retaining any handles to the bitmap, then the bitmap should be scheduled for
> collection by the GC. If you did try to retrieve the view that was holding
> the image from the ListView and it did return it to you, there is a good
> chance the ListView still wants to use it and you would not want to release
> the bitmap.
>
> Is there a reason you are wanting to try to recycle the bitmap?
>
> Also, we are talking about the recycle() function on bitmap and not reusing
> the same bitmap, correct?
>
> Steven
> Studio LFPhttp://www.studio-lfp.com
>
>
>
>
>
>
>
> On Sunday, October 16, 2011 4:14:48 AM UTC-5, emanuele wrote:
>
> > Hello guys.. that s my baseAdapter getview implmentation:
>
> > @Override
> > public View getView(int position, View convertView, ViewGroup parent)
> > {
>
> > int type = getItemViewType(position);
> > if (convertView == null) {
> > switch (type) {
> > case TYPE_BIG_NEWS:
> > convertView = mInflater.inflate(R.layout.big_news, null);
> > break;
> > case TYPE_NORMAL_NEWS:
> > convertView = mInflater.inflate(R.layout.normal_news, null);
> > break;
> > default:
> > break;
> > }
> > }
>
> > ImageView thumb = (ImageView)
> > convertView.findViewById(R.id.thumbId);
>
> > File f = null;
> > if (filename != null)
> > f = mFileCache.getFile(i.newsKey, filename);
> > if (f == null) {
> > if (mGetThumbsThread != null && filename != null) {
> > Log.i(TAG, "cache miss");
> > thumbLinks.offer(new ThumbRequest(i.newsKey, i.thumbLink,
> > i.thumbName));
> > mGetThumbsThread.signal();
> > }
> > thumb.setImageResource(placeHolder);
> > } else {
> > Log.i(TAG,
> > "file bitmap cached: " + f.getName() + " size: " + f.length() /
> > 1024);
> > bitmap = BitmapFactory.decodeFile(f.getAbsolutePath());
> > thumb.setImageBitmap(bitmap);
> > }
>
> > return convertView;
> > }
>
> > Every row is compound of text and an ImageView. Is there any chance to
> > recycle the bitmap I use in the getView?

-- 
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] Re: listview adapter. Recycle bitmap

2011-10-16 Thread Studio LFP
Based on the code there, you wouldn't have the chance to recycle the bitmap 
as you don't keep a handle to it anywhere.

Then again, if the ListView discards that particular row and you aren't 
retaining any handles to the bitmap, then the bitmap should be scheduled for 
collection by the GC. If you did try to retrieve the view that was holding 
the image from the ListView and it did return it to you, there is a good 
chance the ListView still wants to use it and you would not want to release 
the bitmap.

Is there a reason you are wanting to try to recycle the bitmap?

Also, we are talking about the recycle() function on bitmap and not reusing 
the same bitmap, correct?

Steven
Studio LFP
http://www.studio-lfp.com


On Sunday, October 16, 2011 4:14:48 AM UTC-5, emanuele wrote:
>
> Hello guys.. that s my baseAdapter getview implmentation: 
>
> @Override 
> public View getView(int position, View convertView, ViewGroup parent) 
> { 
>
> int type = getItemViewType(position); 
> if (convertView == null) { 
> switch (type) { 
> case TYPE_BIG_NEWS: 
> convertView = mInflater.inflate(R.layout.big_news, null); 
> break; 
> case TYPE_NORMAL_NEWS: 
> convertView = mInflater.inflate(R.layout.normal_news, null); 
> break; 
> default: 
> break; 
> } 
> } 
>
> ImageView thumb = (ImageView) 
> convertView.findViewById(R.id.thumbId); 
>
>
>
>
> File f = null; 
> if (filename != null) 
> f = mFileCache.getFile(i.newsKey, filename); 
> if (f == null) { 
> if (mGetThumbsThread != null && filename != null) { 
> Log.i(TAG, "cache miss"); 
> thumbLinks.offer(new ThumbRequest(i.newsKey, i.thumbLink, 
> i.thumbName)); 
> mGetThumbsThread.signal(); 
> } 
> thumb.setImageResource(placeHolder); 
> } else { 
> Log.i(TAG, 
> "file bitmap cached: " + f.getName() + " size: " + f.length() / 
> 1024); 
> bitmap = BitmapFactory.decodeFile(f.getAbsolutePath()); 
> thumb.setImageBitmap(bitmap); 
> } 
>
> return convertView; 
> } 
>
>
> Every row is compound of text and an ImageView. Is there any chance to 
> recycle the bitmap I use in the getView?

-- 
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] Re: ListView disappears after return from activity

2011-10-16 Thread Ali Chousein
My first wild guess is that you might a problem in your onStart or
onResume of the activity which hosts your ListView.

-
Ali Chousein
Weather-Buddy
http://weatherbuddy.blogspot.com/
Geo-Filtered Assistant
http://geo-filtered-assistant.blogspot.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


Re: [android-developers] Re: ListView Row not firing the click event

2011-10-07 Thread NaveenShrivastva
Now expandable listview child click work fine but listview row child
click not working.

On Fri, Oct 7, 2011 at 12:47 PM, NaveenShrivastva
 wrote:
> Now expandable listview child click work fine but listview row child
> click not working.
>
>
> On Fri, Oct 7, 2011 at 12:25 PM, NaveenShrivastva
>  wrote:
>> Thanks very i have resolved the issue, i want to share you issue
>> resign is layout handling in frame layout need liner layout with
>> button
>>
>>
>> On Fri, Oct 7, 2011 at 9:56 AM, NaveenShrivastva
>>  wrote:
>>> Now i am trying thanks very much for this kind of precious information
>>>
>>> On Thu, Oct 6, 2011 at 9:42 PM, dilo.mt  
>>> wrote:
 Hi,

 There is nothing wrong with the code above. You have said when the
 image button clicks, it works.
 And you need to make the whole entry clickable. all the buttons by
 default clickable.

 I think you have image button and text or what ever inside a linear
 layout or relative layout.
 make sure the container of image button and text (i.e. layout)
 setClickable(true) then you will be oki.

 On Oct 6, 3:51 pm, NaveenShrivastva 
 wrote:
> i have two view one is Expandablelist and other is listview plz
> guideline me how to handle here facing listchildclick event
>
> On Thu, Oct 6, 2011 at 8:17 PM, dinesh adwani
>
>
>
>
>
>
>
>  wrote:
> > If you have added any other view like radio button make it
> > setfocasable(false)
>
> > On Oct 6, 2011 3:46 PM, "Naveen"  wrote:
>
> >> i am using custom list , it's
> >> l1.setAdapter(new EfficientAdapter(this));
>
> >>                l1.setFocusable(true);
> >>        l1.setClickable(true);
> >>                l1.setOnItemClickListener(new OnItemClickListener() {
> >>            @Override
> >>            public void onItemClick(AdapterView adapter, View
> >> view,      int pos, long id) {
> >>        Log.i("listview", "clicked1");
>
> >>                                Toast.makeText(getApplicationContext(),
> >>                                                "Child ItemClicked " + 
> >> pos
> >> ,
> >>                                                
> >> Toast.LENGTH_SHORT).show();
>
> >>            }
> >>        });
>
> >> it's not working
>
> >> --
> >> 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
>>>
>>
>>
>>
>> --
>> Naveen Shrivastava
>> BCA+MCA(LAST SEM)+O/A/B Level(DOEACC SOCITY IT GOVT INDIA)
>>
>
>
>
> --
> Naveen Shrivastava
> BCA+MCA(LAST SEM)+O/A/B Level(DOEACC SOCITY IT GOVT INDIA)
>



-- 
Naveen Shrivastava
BCA+MCA(LAST SEM)+O/A/B Level(DOEACC SOCITY IT GOVT INDIA)

-- 
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] Re: ListView Row not firing the click event

2011-10-07 Thread NaveenShrivastva
Now expandable listview child click work fine but listview row child
click not working.


On Fri, Oct 7, 2011 at 12:25 PM, NaveenShrivastva
 wrote:
> Thanks very i have resolved the issue, i want to share you issue
> resign is layout handling in frame layout need liner layout with
> button
>
>
> On Fri, Oct 7, 2011 at 9:56 AM, NaveenShrivastva
>  wrote:
>> Now i am trying thanks very much for this kind of precious information
>>
>> On Thu, Oct 6, 2011 at 9:42 PM, dilo.mt  
>> wrote:
>>> Hi,
>>>
>>> There is nothing wrong with the code above. You have said when the
>>> image button clicks, it works.
>>> And you need to make the whole entry clickable. all the buttons by
>>> default clickable.
>>>
>>> I think you have image button and text or what ever inside a linear
>>> layout or relative layout.
>>> make sure the container of image button and text (i.e. layout)
>>> setClickable(true) then you will be oki.
>>>
>>> On Oct 6, 3:51 pm, NaveenShrivastva 
>>> wrote:
 i have two view one is Expandablelist and other is listview plz
 guideline me how to handle here facing listchildclick event

 On Thu, Oct 6, 2011 at 8:17 PM, dinesh adwani







  wrote:
 > If you have added any other view like radio button make it
 > setfocasable(false)

 > On Oct 6, 2011 3:46 PM, "Naveen"  wrote:

 >> i am using custom list , it's
 >> l1.setAdapter(new EfficientAdapter(this));

 >>                l1.setFocusable(true);
 >>        l1.setClickable(true);
 >>                l1.setOnItemClickListener(new OnItemClickListener() {
 >>            @Override
 >>            public void onItemClick(AdapterView adapter, View
 >> view,      int pos, long id) {
 >>        Log.i("listview", "clicked1");

 >>                                Toast.makeText(getApplicationContext(),
 >>                                                "Child ItemClicked " + 
 >> pos
 >> ,
 >>                                                
 >> Toast.LENGTH_SHORT).show();

 >>            }
 >>        });

 >> it's not working

 >> --
 >> 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
>>
>
>
>
> --
> Naveen Shrivastava
> BCA+MCA(LAST SEM)+O/A/B Level(DOEACC SOCITY IT GOVT INDIA)
>



-- 
Naveen Shrivastava
BCA+MCA(LAST SEM)+O/A/B Level(DOEACC SOCITY IT GOVT INDIA)

-- 
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] Re: ListView Row not firing the click event

2011-10-06 Thread NaveenShrivastva
Thanks very i have resolved the issue, i want to share you issue
resign is layout handling in frame layout need liner layout with
button


On Fri, Oct 7, 2011 at 9:56 AM, NaveenShrivastva
 wrote:
> Now i am trying thanks very much for this kind of precious information
>
> On Thu, Oct 6, 2011 at 9:42 PM, dilo.mt  wrote:
>> Hi,
>>
>> There is nothing wrong with the code above. You have said when the
>> image button clicks, it works.
>> And you need to make the whole entry clickable. all the buttons by
>> default clickable.
>>
>> I think you have image button and text or what ever inside a linear
>> layout or relative layout.
>> make sure the container of image button and text (i.e. layout)
>> setClickable(true) then you will be oki.
>>
>> On Oct 6, 3:51 pm, NaveenShrivastva 
>> wrote:
>>> i have two view one is Expandablelist and other is listview plz
>>> guideline me how to handle here facing listchildclick event
>>>
>>> On Thu, Oct 6, 2011 at 8:17 PM, dinesh adwani
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>  wrote:
>>> > If you have added any other view like radio button make it
>>> > setfocasable(false)
>>>
>>> > On Oct 6, 2011 3:46 PM, "Naveen"  wrote:
>>>
>>> >> i am using custom list , it's
>>> >> l1.setAdapter(new EfficientAdapter(this));
>>>
>>> >>                l1.setFocusable(true);
>>> >>        l1.setClickable(true);
>>> >>                l1.setOnItemClickListener(new OnItemClickListener() {
>>> >>            @Override
>>> >>            public void onItemClick(AdapterView adapter, View
>>> >> view,      int pos, long id) {
>>> >>        Log.i("listview", "clicked1");
>>>
>>> >>                                Toast.makeText(getApplicationContext(),
>>> >>                                                "Child ItemClicked " + pos
>>> >> ,
>>> >>                                                
>>> >> Toast.LENGTH_SHORT).show();
>>>
>>> >>            }
>>> >>        });
>>>
>>> >> it's not working
>>>
>>> >> --
>>> >> 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
>



-- 
Naveen Shrivastava
BCA+MCA(LAST SEM)+O/A/B Level(DOEACC SOCITY IT GOVT INDIA)

-- 
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] Re: ListView Row not firing the click event

2011-10-06 Thread NaveenShrivastva
Now i am trying thanks very much for this kind of precious information

On Thu, Oct 6, 2011 at 9:42 PM, dilo.mt  wrote:
> Hi,
>
> There is nothing wrong with the code above. You have said when the
> image button clicks, it works.
> And you need to make the whole entry clickable. all the buttons by
> default clickable.
>
> I think you have image button and text or what ever inside a linear
> layout or relative layout.
> make sure the container of image button and text (i.e. layout)
> setClickable(true) then you will be oki.
>
> On Oct 6, 3:51 pm, NaveenShrivastva 
> wrote:
>> i have two view one is Expandablelist and other is listview plz
>> guideline me how to handle here facing listchildclick event
>>
>> On Thu, Oct 6, 2011 at 8:17 PM, dinesh adwani
>>
>>
>>
>>
>>
>>
>>
>>  wrote:
>> > If you have added any other view like radio button make it
>> > setfocasable(false)
>>
>> > On Oct 6, 2011 3:46 PM, "Naveen"  wrote:
>>
>> >> i am using custom list , it's
>> >> l1.setAdapter(new EfficientAdapter(this));
>>
>> >>                l1.setFocusable(true);
>> >>        l1.setClickable(true);
>> >>                l1.setOnItemClickListener(new OnItemClickListener() {
>> >>            @Override
>> >>            public void onItemClick(AdapterView adapter, View
>> >> view,      int pos, long id) {
>> >>        Log.i("listview", "clicked1");
>>
>> >>                                Toast.makeText(getApplicationContext(),
>> >>                                                "Child ItemClicked " + pos
>> >> ,
>> >>                                                Toast.LENGTH_SHORT).show();
>>
>> >>            }
>> >>        });
>>
>> >> it's not working
>>
>> >> --
>> >> 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


[android-developers] Re: ListView Row not firing the click event

2011-10-06 Thread dilo.mt
Hi,

There is nothing wrong with the code above. You have said when the
image button clicks, it works.
And you need to make the whole entry clickable. all the buttons by
default clickable.

I think you have image button and text or what ever inside a linear
layout or relative layout.
make sure the container of image button and text (i.e. layout)
setClickable(true) then you will be oki.

On Oct 6, 3:51 pm, NaveenShrivastva 
wrote:
> i have two view one is Expandablelist and other is listview plz
> guideline me how to handle here facing listchildclick event
>
> On Thu, Oct 6, 2011 at 8:17 PM, dinesh adwani
>
>
>
>
>
>
>
>  wrote:
> > If you have added any other view like radio button make it
> > setfocasable(false)
>
> > On Oct 6, 2011 3:46 PM, "Naveen"  wrote:
>
> >> i am using custom list , it's
> >> l1.setAdapter(new EfficientAdapter(this));
>
> >>                l1.setFocusable(true);
> >>        l1.setClickable(true);
> >>                l1.setOnItemClickListener(new OnItemClickListener() {
> >>            @Override
> >>            public void onItemClick(AdapterView adapter, View
> >> view,      int pos, long id) {
> >>        Log.i("listview", "clicked1");
>
> >>                                Toast.makeText(getApplicationContext(),
> >>                                                "Child ItemClicked " + pos
> >> ,
> >>                                                Toast.LENGTH_SHORT).show();
>
> >>            }
> >>        });
>
> >> it's not working
>
> >> --
> >> 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] Re: ListView and MotionEvent

2011-10-03 Thread Studio LFP
The HTC Hero has a little ball that can go any direction. So it will work 
left/right and up/down.

With the keyboard, you should be getting onKeyEvents. Override that and 
watch for different keycodes and events.

http://developer.android.com/reference/android/view/KeyEvent.html

I think disable fields may still be able to receive focus for things like 
copy and paste. Even in desktop OSes, you can usually focus and highlight 
disabled fields for things like copy and paste, but just can't edit or 
activate them.

Try using setVisibility( View.GONE ) if you want windows to be 
non-accessible.

A lot of these questions seem to be not related to Android, are you trying 
to do things cross platform or they just an FYI type of thing? Most (if not 
all) Android devices will usually provide ample control. Even the upcoming 
(a few current) Google TVs that don't have a touch screen (one of the reason 
you would still support touch events for fake touch) will have plenty of 
control mechanisms like keyboard, directional pads, mice and touchpads.

Unless someone else that watches this group can let us know, I'm not sure 
there are any Android devices that work like a Blackberry with only one 
degree of movement type control.

Steven
Studio LFP
http://www.studio-lfp.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

Re: [android-developers] Re: ListView and MotionEvent

2011-10-03 Thread John Goche
I also noticed that a disabled button can be focused, which could require
having to
design a separate icon. I don't understand the point of this combination: if
a button
is disabled why does android make it possible for it to receive the focus?

Regards,

John Goche

On Mon, Oct 3, 2011 at 12:00 PM, John Goche wrote:

>
> On Mon, Oct 3, 2011 at 3:57 AM, Studio LFP  wrote:
>
>> The HTC Hero is fairly old. I keep one around because it's quite slow and
>> if I can make something function fast on it, it will run exceptionally well
>> on new hardware.
>>
>
> As a curiosity does it have two way na vigation (just a scrollwheel and no
> touchscreen) for navigating up and down
> like on the blackberry, so that up and down sometimes also means left and
> right, or does it have separate left
> and right buttons.
>
> This makes a difference when programming the focusing of events. On a
> keyboard we have two degrees of freedom
> for navigation but with a single scrollwheel it's only one. If I program
> for two degrees of freedom devices with a single
> degree of freedom may find some buttons inaccessible if laid out
> horizontally.
>
> Any suggestions with this regard?
>
> Yes, it is nice to have an app also work with a keyboard attached to a
> tablet.
>
> Also, when I press enter on a listview item nothing happens. I thought it
> would generate a mousedown
> on the emulator but nothing happens. Do I need to modify my code to listen
> for some more events?
>
> Thanks,
>
> John Goche
>

-- 
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] Re: ListView and MotionEvent

2011-10-03 Thread John Goche
On Mon, Oct 3, 2011 at 3:57 AM, Studio LFP  wrote:

> The HTC Hero is fairly old. I keep one around because it's quite slow and
> if I can make something function fast on it, it will run exceptionally well
> on new hardware.
>

As a curiosity does it have two way na vigation (just a scrollwheel and no
touchscreen) for navigating up and down
like on the blackberry, so that up and down sometimes also means left and
right, or does it have separate left
and right buttons.

This makes a difference when programming the focusing of events. On a
keyboard we have two degrees of freedom
for navigation but with a single scrollwheel it's only one. If I program for
two degrees of freedom devices with a single
degree of freedom may find some buttons inaccessible if laid out
horizontally.

Any suggestions with this regard?

Yes, it is nice to have an app also work with a keyboard attached to a
tablet.

Also, when I press enter on a listview item nothing happens. I thought it
would generate a mousedown
on the emulator but nothing happens. Do I need to modify my code to listen
for some more events?

Thanks,

John Goche


>
> On the tablet you can use both a wired and a Bluetooth mouse (I've used a
> wired mouse and Bluetooth keyboard simultaneously). You shouldn't have to
> worry too much about the mouse as it is considered "fake touch" and just
> acts like a simulated finger event. Check out the "Touchscreen" section at
> this link to understand how to support it:
>
>
> http://developer.android.com/guide/topics/manifest/uses-feature-element.html#hw-features
>
> What you might want to test out is a tablet or phone with a Bluetooth
> keyboard with directional keys. I've run into a few apps that I wanted to
> use the directional keys on my Bluetooth keyboard and it wouldn't function
> properly.  If you plan on doing apps that take a lot of input (like typing
> information in), your users will thank you if you support navigation via the
> keyboard. I'm not fond of having to constantly touch the screen to change
> input boxes when I have a tab and directional keys available.
>
> Some of the specialty hardware, like the Sony Xperia Play, have controls
> that take special consideration. I picked one up to make sure I could test
> things properly on an actual piece of hardware. Some even have special SDK
> add-ons available via Eclipse or from the manufacturers sites. It is one of
> the things that makes Android more challenging to code for, but I personally
> enjoy the challenge. It also gives us, the consumers, a lot of options and
> doesn't force everyone to be the same.
>
>
> Steven
> Studio LFP
> http://www.studio-lfp.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

Re: [android-developers] Re: ListView and MotionEvent

2011-10-02 Thread Studio LFP
The HTC Hero is fairly old. I keep one around because it's quite slow and if 
I can make something function fast on it, it will run exceptionally well on 
new hardware.

On the tablet you can use both a wired and a Bluetooth mouse (I've used a 
wired mouse and Bluetooth keyboard simultaneously). You shouldn't have to 
worry too much about the mouse as it is considered "fake touch" and just 
acts like a simulated finger event. Check out the "Touchscreen" section at 
this link to understand how to support it:

http://developer.android.com/guide/topics/manifest/uses-feature-element.html#hw-features

What you might want to test out is a tablet or phone with a Bluetooth 
keyboard with directional keys. I've run into a few apps that I wanted to 
use the directional keys on my Bluetooth keyboard and it wouldn't function 
properly.  If you plan on doing apps that take a lot of input (like typing 
information in), your users will thank you if you support navigation via the 
keyboard. I'm not fond of having to constantly touch the screen to change 
input boxes when I have a tab and directional keys available.

Some of the specialty hardware, like the Sony Xperia Play, have controls 
that take special consideration. I picked one up to make sure I could test 
things properly on an actual piece of hardware. Some even have special SDK 
add-ons available via Eclipse or from the manufacturers sites. It is one of 
the things that makes Android more challenging to code for, but I personally 
enjoy the challenge. It also gives us, the consumers, a lot of options and 
doesn't force everyone to be the same.

Steven
Studio LFP
http://www.studio-lfp.com


On Sunday, October 2, 2011 6:43:31 PM UTC-5, John Goche wrote:
>
>
> Thanks, apparently I was able to get it to work perfectly following your 
> advice.
> What I have not implemented is the code for trackball and joystick devices
> which seem to generate their own events as described at:
>
> http://developer.android.com/reference/android/view/MotionEvent.html
>
> Just how old is the HTC Hero and friends which have a trackball?
> Do the new tablets take a wired or blutooth keyboard? I find it
> interesting that you would wire a blutooth keyboard to a cell phone.
>
> Regards,
>
> John Goche
>
> On Mon, Oct 3, 2011 at 1:03 AM, Studio LFP  wrote:
>
>> An ACTION_CANCEL is sent in the case where the user puts their finger down 
>> on a ListView item (or similar) and then starts to scroll. Since the 
>> ListView is using it as a scroll command and your finger may stay inside the 
>> view, it sends this to cancel the touch on your view.
>>
>> The ACTION_OUTSIDE would be where a view couldn't or won't scroll and the 
>> user drags their finger outside the view that received the ACTION_DOWN. 
>> Computers do the same with mouse events and it gives the user the ability to 
>> "cancel" a click by holding down and dragging outside of whatever they 
>> clicked on.
>>
>> Those two actions are why it is usually recommended to perform an action 
>> on a mouse/touch/key up instead of down.
>>
>>
>> Steven
>> Studio LFP
>> http://www.studio-lfp.com
>>
>>
>> On Sunday, October 2, 2011 5:28:24 PM UTC-5, John Goche wrote:
>>
>>>
>>> Thank you Steven for your reply,
>>>
>>> Would you be able to provide some insight on the difference between 
>>> ACTION_CANCEL
>>> and ACTION_UP. I am somewhat fuzzy on the concept. Anyways, I'm going to 
>>> give it a go.
>>>
>>> Thanks,
>>>
>>> John Goche
>>>
>>> On Sun, Oct 2, 2011 at 11:36 PM, Studio LFP  wrote:
>>>
  You've got it right.

 Just make sure you are catching MotionEvent.ACTION_CANCEL and 
 MotionEvent.ACTION_OUTSIDE.

 Return false in onTouch to allow it to pass to the Click and LongClick, 
 but change your colors in the onTouch.

 Steven
 Studio LFP
 http://www.studio-lfp.com

 -
 You received this message because you are subscribed to the Google
 Groups "Android Developers" group.
 To post to this group, send email to androi...@googlegroups.com

 To unsubscribe from this group, send email to
 android-develop...@**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-d...@googlegroups.com
>> To unsubscribe from this group, send email to
>> android-develop...@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 

Re: [android-developers] Re: ListView and MotionEvent

2011-10-02 Thread John Goche
Thanks, apparently I was able to get it to work perfectly following your
advice.
What I have not implemented is the code for trackball and joystick devices
which seem to generate their own events as described at:

http://developer.android.com/reference/android/view/MotionEvent.html

Just how old is the HTC Hero and friends which have a trackball?
Do the new tablets take a wired or blutooth keyboard? I find it
interesting that you would wire a blutooth keyboard to a cell phone.

Regards,

John Goche

On Mon, Oct 3, 2011 at 1:03 AM, Studio LFP  wrote:

> An ACTION_CANCEL is sent in the case where the user puts their finger down
> on a ListView item (or similar) and then starts to scroll. Since the
> ListView is using it as a scroll command and your finger may stay inside the
> view, it sends this to cancel the touch on your view.
>
> The ACTION_OUTSIDE would be where a view couldn't or won't scroll and the
> user drags their finger outside the view that received the ACTION_DOWN.
> Computers do the same with mouse events and it gives the user the ability to
> "cancel" a click by holding down and dragging outside of whatever they
> clicked on.
>
> Those two actions are why it is usually recommended to perform an action on
> a mouse/touch/key up instead of down.
>
>
> Steven
> Studio LFP
> http://www.studio-lfp.com
>
>
> On Sunday, October 2, 2011 5:28:24 PM UTC-5, John Goche wrote:
>
>>
>> Thank you Steven for your reply,
>>
>> Would you be able to provide some insight on the difference between
>> ACTION_CANCEL
>> and ACTION_UP. I am somewhat fuzzy on the concept. Anyways, I'm going to
>> give it a go.
>>
>> Thanks,
>>
>> John Goche
>>
>> On Sun, Oct 2, 2011 at 11:36 PM, Studio LFP  wrote:
>>
>>> You've got it right.
>>>
>>> Just make sure you are catching MotionEvent.ACTION_CANCEL and
>>> MotionEvent.ACTION_OUTSIDE.
>>>
>>> Return false in onTouch to allow it to pass to the Click and LongClick,
>>> but change your colors in the onTouch.
>>>
>>> Steven
>>> Studio LFP
>>> http://www.studio-lfp.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-d...@googlegroups.com
>>>
>>> To unsubscribe from this group, send email to
>>> android-develop...@**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] Re: ListView and MotionEvent

2011-10-02 Thread Studio LFP
An ACTION_CANCEL is sent in the case where the user puts their finger down 
on a ListView item (or similar) and then starts to scroll. Since the 
ListView is using it as a scroll command and your finger may stay inside the 
view, it sends this to cancel the touch on your view.

The ACTION_OUTSIDE would be where a view couldn't or won't scroll and the 
user drags their finger outside the view that received the ACTION_DOWN. 
Computers do the same with mouse events and it gives the user the ability to 
"cancel" a click by holding down and dragging outside of whatever they 
clicked on.

Those two actions are why it is usually recommended to perform an action on 
a mouse/touch/key up instead of down.

Steven
Studio LFP
http://www.studio-lfp.com


On Sunday, October 2, 2011 5:28:24 PM UTC-5, John Goche wrote:
>
>
> Thank you Steven for your reply,
>
> Would you be able to provide some insight on the difference between 
> ACTION_CANCEL
> and ACTION_UP. I am somewhat fuzzy on the concept. Anyways, I'm going to 
> give it a go.
>
> Thanks,
>
> John Goche
>
> On Sun, Oct 2, 2011 at 11:36 PM, Studio LFP  wrote:
>
>> You've got it right.
>>
>> Just make sure you are catching MotionEvent.ACTION_CANCEL and 
>> MotionEvent.ACTION_OUTSIDE.
>>
>> Return false in onTouch to allow it to pass to the Click and LongClick, 
>> but change your colors in the onTouch.
>>
>> Steven
>> Studio LFP
>> http://www.studio-lfp.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-d...@googlegroups.com
>> To unsubscribe from this group, send email to
>> android-develop...@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] Re: ListView and MotionEvent

2011-10-02 Thread John Goche
Thank you Steven for your reply,

Would you be able to provide some insight on the difference between
ACTION_CANCEL
and ACTION_UP. I am somewhat fuzzy on the concept. Anyways, I'm going to
give it a go.

Thanks,

John Goche

On Sun, Oct 2, 2011 at 11:36 PM, Studio LFP  wrote:

> You've got it right.
>
> Just make sure you are catching MotionEvent.ACTION_CANCEL and
> MotionEvent.ACTION_OUTSIDE.
>
> Return false in onTouch to allow it to pass to the Click and LongClick, but
> change your colors in the onTouch.
>
> Steven
> Studio LFP
> http://www.studio-lfp.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 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] Re: ListView and MotionEvent

2011-10-02 Thread Studio LFP
You've got it right.

Just make sure you are catching MotionEvent.ACTION_CANCEL and 
MotionEvent.ACTION_OUTSIDE.

Return false in onTouch to allow it to pass to the Click and LongClick, but 
change your colors in the onTouch.

Steven
Studio LFP
http://www.studio-lfp.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

Re: [android-developers] Re: listview with images: postInvalidate problems

2011-10-02 Thread John Goche
Thanks, that works!

 ((SimpleAdapter)
FooActivity.this.listView.getAdapter()).notifyDataSetChanged();

The other function (postInvalidate()) was only refreshing stuff off the
list.

Makes me wonder what use it may have.

Best Regards,

John Goche

On Sun, Oct 2, 2011 at 10:07 AM, skink  wrote:

>
>
> John Goche wrote:
> > Hello,
> >
> > I am overriding SimpleAdapter to add an image to a listview.
> > When I call postInvalidate() inside my onClickListener it is
> > only when the views are scrolled off the screen and then
> > back on screen that the images are updated. The images
> > in the rows which are not off the screen do not get updated.
> > Any ideas what I should do so that the views on the screen
> > are redrawn immediately?
> >
> > Thanks,
> >
> > John Goche
>
> Just call:
> notifyDataSetChanged()
>
> Notifies the attached View that the
> underlying data has been changed
> and it should refresh itself.
>
> pskinkhe attached View that the
> underlying data has been changed
> and it should refresh itself.
>
> pskink
>
>
>
> --
> 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] Re: listview with images: postInvalidate problems

2011-10-02 Thread skink


John Goche wrote:
> Hello,
>
> I am overriding SimpleAdapter to add an image to a listview.
> When I call postInvalidate() inside my onClickListener it is
> only when the views are scrolled off the screen and then
> back on screen that the images are updated. The images
> in the rows which are not off the screen do not get updated.
> Any ideas what I should do so that the views on the screen
> are redrawn immediately?
>
> Thanks,
>
> John Goche

Just call:
notifyDataSetChanged()

Notifies the attached View that the
underlying data has been changed
and it should refresh itself.

pskinkhe attached View that the
underlying data has been changed
and it should refresh itself.

pskink



-- 
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] Re: ListView: responding to item clicks via a listener

2011-09-21 Thread Streets Of Boston
Try not to do this. It will break the UI model that Android users expect on 
their phones.
However, if you really need it:

1. Modify the data items that are handled by your ListView's adapter. Add an 
field that could tell how many times a list-item has been clicked (e.g. 
numberOfClicks).

2. Handle the onItemClick(...) (or in your case 'onClick(...)') as follows:
MyDataItem item = adapter.getItem(position);
Increase the item.numberOfClicks. 
If it becomes 1: do nothing.
If it becomes 2: go to the other screen and re-set item.numberOfClicks to 0.
(Be sure to call adapter.notifyDatatSetChanged()).

3. Change the 'getView()' method of your ListView's adapter:
MyDataItem item = getItem(position);
If the corresponding's item.numberOfClicks is 1, then color the background 
of that item in a particular color (that would indicate a 'highlight').
If the corresponding's item.numberOfClicks is not 1, then make the 
background of that item transparent (android.R.color.transparent).


-- 
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] Re: ListView: responding to item clicks via a listener

2011-09-20 Thread John Goche
Hello,

I am having a slight problem with my approach. When a row is highlighted
orange and
I click on it the orange highlighting goes away. But I want it to stay as I
want taps to

1. highlight the row on the first tap
2. take to a second screen on the second tap

Is this possible?

Thanks,

John Goche

On Mon, Sep 19, 2011 at 6:32 PM, John Goche wrote:

>
> On Mon, Sep 19, 2011 at 5:32 PM, Streets Of Boston <
> flyingdutc...@gmail.com> wrote:
>
>> The solution you have may work, but it's not the best... keyboard/dpad
>> navigation of your list won't work well.
>>
>> My question is:
>> What about  R.layout.alarmgroups_item. Could you show the
>> alarmgroups_item.xml contents? Maybe one of the items in there is clickable
>> and/or focusable.
>>
>
> Well, here is all I have in the file at the moment. Just a bunch of text
> views. The idea is that the user can click them
> to highlight them and then push a button to take the user to another
> screen. How can I improve things
> then if that is not the best solution?
>
> Thanks for your help,
>
> John Goche
> SimpleAdapter adapter = new SimpleAdapter(this, maps,
> R.layout.alarmgroups_item, from, to) {
>   @Override
>   public View getView(int position, View convertView, ViewGroup parent)
> {
> View view = super.getView(position, convertView, parent);
> // view.setOnClickListener(
> AlarmGroupsActivity.this);
> view.setOnClickListener(new OnClickListener() {
>
>   public void onClick(View arg0) {
> Toast.makeText(getApplicationContext(), "clicked",
> Toast.LENGTH_SHORT).show();
>   }
> });
> return view;
>
>   }
> };
>
> listView.setAdapter(adapter);
>
>
> 
>xmlns:android="http://schemas.android.com/apk/res/android";
>   android:orientation="vertical"
>   android:layout_width="fill_parent"
>   android:layout_height="fill_parent">
>android:layout_width="match_parent"
> android:layout_height="wrap_content">
>android:id="@+id/one"
>   android:layout_height="wrap_content"
>   android:layout_width="200dp">
> 
>android:id="@+id/two"
>   android:layout_weight="1"
>   android:layout_width="wrap_content"
>   android:layout_height="wrap_content"
>   android:inputType="time">
> 
>   
>android:layout_width="match_parent"
> android:layout_height="wrap_content">
>android:id="@+id/three"
>   android:layout_height="wrap_content"
>   android:layout_width="200dp">
> 
>android:id="@+id/four"
>   android:layout_weight="1"
>   android:layout_width="wrap_content"
>   android:layout_height="wrap_content"
>   android:inputType="time">
> 
>   
>android:id="@+id/five"
> android:layout_height="wrap_content"
> android:layout_width="match_parent">
>   
> 
>

-- 
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] Re: ListView: responding to item clicks via a listener

2011-09-19 Thread John Goche
On Mon, Sep 19, 2011 at 5:32 PM, Streets Of Boston
wrote:

> The solution you have may work, but it's not the best... keyboard/dpad
> navigation of your list won't work well.
>
> My question is:
> What about  R.layout.alarmgroups_item. Could you show the
> alarmgroups_item.xml contents? Maybe one of the items in there is clickable
> and/or focusable.
>

Well, here is all I have in the file at the moment. Just a bunch of text
views. The idea is that the user can click them
to highlight them and then push a button to take the user to another screen.
How can I improve things
then if that is not the best solution?

Thanks for your help,

John Goche


http://schemas.android.com/apk/res/android";
  android:orientation="vertical"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent">
  




  
  




  
  
  


-- 
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] Re: ListView: responding to item clicks via a listener

2011-09-19 Thread Streets Of Boston
The solution you have may work, but it's not the best... keyboard/dpad 
navigation of your list won't work well.

My question is:
What about  R.layout.alarmgroups_item. Could you show the 
alarmgroups_item.xml contents? Maybe one of the items in there is clickable 
and/or focusable.

-- 
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] Re: ListView: responding to item clicks via a listener

2011-09-19 Thread John Goche
Hello,

The solution was to attach an onItemClick listener to each list item rather
than to the
ListView itself like so:

SimpleAdapter adapter = new SimpleAdapter(this, maps,
R.layout.alarmgroups_item, from, to) {
  @Override
  public View getView(int position, View convertView, ViewGroup parent)
{
View view = super.getView(position, convertView, parent);
// view.setOnClickListener(AlarmGroupsActivity.this);
view.setOnClickListener(new OnClickListener() {

  public void onClick(View arg0) {
Toast.makeText(getApplicationContext(), "clicked",
Toast.LENGTH_SHORT).show();
  }
});
return view;

  }
};

listView.setAdapter(adapter);


--
Regards,

John Goche


On Mon, Sep 19, 2011 at 4:27 PM, John Goche wrote:

>
> Hello,
>
> I am trying to respond to item clicks in a ListView which has an adapter.
> When
> the items are clicked (each item is just a LinearLayout with four
> TextViews),
> my onItemClick listener is not called even though my ListView is clickable
> and focusable. I have read the following but was no help to me:
>
>
> http://stackoverflow.com/questions/4742611/android-onitemclick-silently-fails
>
> Anyone have any ideas?
>
> Thanks,
>
> John Goche
>

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