Hello Romain-guy, I would be happy to if I knew how to properly answer your request. I removed the breakpoint on the getitematpos call and let it rip. Then when it crashed, I went to debugger window and did a copy of the stack trace and posted it below:
SwtorCompanion [Android Application] DalvikVM[localhost:8619] Thread [<1> main] (Suspended (exception RuntimeException)) ActivityThread.performLaunchActivity(ActivityThread$ActivityRecord, Intent) line: 2663 ActivityThread.handleLaunchActivity(ActivityThread$ActivityRecord, Intent) line: 2679 ActivityThread.access$2300(ActivityThread, ActivityThread$ActivityRecord, Intent) line: 125 ActivityThread$H.handleMessage(Message) line: 2033 ActivityThread$H(Handler).dispatchMessage(Message) line: 99 Looper.loop() line: 123 ActivityThread.main(String[]) line: 4627 Method.invokeNative(Object, Object[], Class, Class[], Class, int, boolean) line: not available [native method] Method.invoke(Object, Object...) line: 521 ZygoteInit$MethodAndArgsCaller.run() line: 868 ZygoteInit.main(String[]) line: 626 NativeStart.main(String[]) line: not available [native method] Thread [<7> Binder Thread #2] (Running) Thread [<6> Binder Thread #1] (Running) Thread [<9> Binder Thread #3] (Running) If i comment out the getitematposition line it will run ok. On Thu, Jan 5, 2012 at 2:49 PM, Romain Guy <romain...@android.com> wrote: > Please show us the stack trace generated by the exception. > > On Thu, Jan 5, 2012 at 11:46 AM, John Davis <davi...@gmail.com> wrote: >> Hello Mark, >> >> Nope. >> for (int i=0;i<numRows;i++) { >> // If it is the 2nd or 5th item, tag it so that it will be >> displayed in blue. >> if (i==2 || i==5) { >> listCount = adapter.getCount(); >> count = theList.getCount(); >> fooView = (View) theList.getItemAtPosition(i); >> // fooView.setTag(99); >> } >> >> i=2, listCount = 6 and count = 6. The listview stored in theList is >> functional, since it retuns the result provided by getCount. It is >> also in agreement with the array adapter count. >> theList.getItemAtPositon(5) should either return the item or null. It >> raises and exception. That is a bug. >> >> Once again, the docs say: >> ========================= >> public Object getItemAtPosition (int position) >> >> Since: API Level 1 >> Gets the data associated with the specified position in the list. >> Parameters >> >> position Which data to get >> Returns >> >> The data associated with the specified position in the list >> >> =============== >> >> On Thu, Jan 5, 2012 at 2:31 PM, Mark Murphy <mmur...@commonsware.com> wrote: >>> 2012/1/5 John Davis <davi...@gmail.com>: >>>> The only exception which i can find is >>>> javalang.unsupportedOperationException. >>>> as I was saying the api has a bug. The docs say you can get the data, >>>> when you try to so you get an exception. Either the docs are incorrect >>>> or its a bug. >>> >>> Yes, it is a bug in your code. My guess is that you are asking for an >>> invalid position, perhaps because numRows is greater than getCount(). >>> >>> -- >>> Mark Murphy (a Commons Guy) >>> http://commonsware.com | http://github.com/commonsguy >>> http://commonsware.com/blog | http://twitter.com/commonsguy >>> >>> Warescription: Three Android Books, Plus Updates, One Low Price! >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Android Developers" group. >>> To post to this group, send email to android-developers@googlegroups.com >>> To unsubscribe from this group, send email to >>> android-developers+unsubscr...@googlegroups.com >>> For more options, visit this group at >>> http://groups.google.com/group/android-developers?hl=en >> >> >> >> -- >> John F. Davis >> >> 独树一帜 >> >> -- >> You received this message because you are subscribed to the Google >> Groups "Android Developers" group. >> To post to this group, send email to android-developers@googlegroups.com >> To unsubscribe from this group, send email to >> android-developers+unsubscr...@googlegroups.com >> For more options, visit this group at >> http://groups.google.com/group/android-developers?hl=en > > > > -- > Romain Guy > Android framework engineer > romain...@android.com > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to android-developers@googlegroups.com > To unsubscribe from this group, send email to > android-developers+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en -- John F. Davis 独树一帜 -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en