Re: [android-developers] IndexOutofBoundsException thrown from getViewAt() in RemoteViewFactory

2012-06-16 Thread Harri Smått
Ah, my bad. Thought it was your code causing IndexOutOfBoundsException.

--
H
On Jun 14, 2012 4:12 PM, Ethan Gao ethangao.stu...@gmail.com wrote:

 I didn't ask for getViewAt(index=1), this method is called by android
 framework(I think it's called by RemoteViewsAdater).

 I can not figure out the reason RemoteViewsAdatper is calling
 getViewAt(index=1) after it called getCount() which returns 1.

 I suspect that this is an android bug, since I didn't do anything wrong
 according the docs.

 On Thursday, June 14, 2012 6:57:17 PM UTC+8, Harri Smått wrote:

 On Jun 14, 2012, at 1:37 PM, Ethan Gao wrote:
  Firstly, getCount() methods return 1, but the consequence getViewat()
 is still trying to get view at position 1 and 2.

 If getCount() returns 1, you shouldn't ask for getViewAt(index) where
 index = 1. It's your responsibility to make sure you do not exceed
 getCount() limits (at least usually).

 --
 H

  --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, 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] IndexOutofBoundsException thrown from getViewAt() in RemoteViewFactory

2012-06-14 Thread Ethan Gao
I am attempting to create a widget for android 4.0 phone. But the widget 
might crash after user clicks the clear data button in application's 
setting view. I looked into logcat, it saysIndexOutofBoundsException in 
getViewat() method. 
This is super weird in my eyes, since I put log in both getCount() and 
getViewat() methods. Firstly, getCount() methods return 1, but the 
consequence getViewat() is still trying to get view at position 1 and 2. 
Is there anyone see this problem before? any thoughts would be appreciated, 
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] IndexOutofBoundsException thrown from getViewAt() in RemoteViewFactory

2012-06-14 Thread Harri Smått
On Jun 14, 2012, at 1:37 PM, Ethan Gao wrote:
 Firstly, getCount() methods return 1, but the consequence getViewat() is 
 still trying to get view at position 1 and 2. 

If getCount() returns 1, you shouldn't ask for getViewAt(index) where index = 
1. It's your responsibility to make sure you do not exceed getCount() limits 
(at least usually).

--
H

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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] IndexOutofBoundsException thrown from getViewAt() in RemoteViewFactory

2012-06-14 Thread Ethan Gao
I didn't ask for getViewAt(index=1), this method is called by android 
framework(I think it's called by RemoteViewsAdater). 

I can not figure out the reason RemoteViewsAdatper is calling 
getViewAt(index=1) after it called getCount() which returns 1.

I suspect that this is an android bug, since I didn't do anything wrong 
according the docs.

On Thursday, June 14, 2012 6:57:17 PM UTC+8, Harri Smått wrote:

 On Jun 14, 2012, at 1:37 PM, Ethan Gao wrote: 
  Firstly, getCount() methods return 1, but the consequence getViewat() is 
 still trying to get view at position 1 and 2. 

 If getCount() returns 1, you shouldn't ask for getViewAt(index) where 
 index = 1. It's your responsibility to make sure you do not exceed 
 getCount() limits (at least usually). 

 -- 
 H

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