[android-developers] Re: When I scroll a list I get the force close message

2009-11-01 Thread Dexter#39;s Brain
A small code snippet or the stack trace would help us figure out the
problem

Dexter

http://tech-droid.blogspot.com

On Nov 1, 12:46 pm, jax jackma...@gmail.com wrote:
 I have an ArrayList connected to a ListView with an onclick event that
 loads some extra info about each list item.

 When the list fits inside the screen (no scrolling) it works fine,
 however, when the list becomes long enought that I need to scroll I
 get the Force Close message.

 why is 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: When I scroll a list I get the force close message

2009-11-01 Thread jax
Here is the output from logcat as I scroll down


11-01 17:04:08.979: ERROR/StatsDisplay(1355):
android.widget.textv...@4381ade8 is not a valid ListView!
11-01 17:04:08.999: DEBUG/AndroidRuntime(1355): Shutting down VM
11-01 17:04:08.999: WARN/dalvikvm(1355): threadid=3: thread exiting
with uncaught exception (group=0x4001aa28)
11-01 17:04:08.999: ERROR/AndroidRuntime(1355): Uncaught handler:
thread main exiting due to uncaught exception
11-01 17:04:09.259: DEBUG/dalvikvm(1355): GC freed 7712 objects /
415992 bytes in 220ms
11-01 17:04:09.279: ERROR/AndroidRuntime(1355):
java.lang.NullPointerException
11-01 17:04:09.279: ERROR/AndroidRuntime(1355): at
android.widget.ListView.setupChild(ListView.java:1683)
11-01 17:04:09.279: ERROR/AndroidRuntime(1355): at
android.widget.ListView.addViewBelow(ListView.java:2797)
11-01 17:04:09.279: ERROR/AndroidRuntime(1355): at
android.widget.ListView.scrollListItemsBy(ListView.java:2725)
11-01 17:04:09.279: ERROR/AndroidRuntime(1355): at
android.widget.ListView.arrowScrollImpl(ListView.java:2225)
11-01 17:04:09.279: ERROR/AndroidRuntime(1355): at
android.widget.ListView.arrowScroll(ListView.java:2172)
11-01 17:04:09.279: ERROR/AndroidRuntime(1355): at
android.widget.ListView.commonKey(ListView.java:1977)
11-01 17:04:09.279: ERROR/AndroidRuntime(1355): at
android.widget.ListView.onKeyDown(ListView.java:1924)
11-01 17:04:09.279: ERROR/AndroidRuntime(1355): at
android.view.KeyEvent.dispatch(KeyEvent.java:893)
11-01 17:04:09.279: ERROR/AndroidRuntime(1355): at
android.view.View.dispatchKeyEvent(View.java:3647)
11-01 17:04:09.279: ERROR/AndroidRuntime(1355): at
android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:744)
11-01 17:04:09.279: ERROR/AndroidRuntime(1355): at
android.widget.ListView.dispatchKeyEvent(ListView.java:1909)
11-01 17:04:09.279: ERROR/AndroidRuntime(1355): at
android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:746)
11-01 17:04:09.279: ERROR/AndroidRuntime(1355): at
android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:746)
11-01 17:04:09.279: ERROR/AndroidRuntime(1355): at
android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:746)
11-01 17:04:09.279: ERROR/AndroidRuntime(1355): at
android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:746)
11-01 17:04:09.279: ERROR/AndroidRuntime(1355): at
com.android.internal.policy.impl.PhoneWindow
$DecorView.superDispatchKeyEvent(PhoneWindow.java:1708)
11-01 17:04:09.279: ERROR/AndroidRuntime(1355): at
com.android.internal.policy.impl.PhoneWindow.superDispatchKeyEvent
(PhoneWindow.java:1197)
11-01 17:04:09.279: ERROR/AndroidRuntime(1355): at
android.app.Activity.dispatchKeyEvent(Activity.java:1967)
11-01 17:04:09.279: ERROR/AndroidRuntime(1355): at
com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchKeyEvent
(PhoneWindow.java:1684)
11-01 17:04:09.279: ERROR/AndroidRuntime(1355): at
android.view.ViewRoot.deliverKeyEventToViewHierarchy(ViewRoot.java:
2329)
11-01 17:04:09.279: ERROR/AndroidRuntime(1355): at
android.view.ViewRoot.handleFinishedEvent(ViewRoot.java:2299)
11-01 17:04:09.279: ERROR/AndroidRuntime(1355): at
android.view.ViewRoot.handleMessage(ViewRoot.java:1621)
11-01 17:04:09.279: ERROR/AndroidRuntime(1355): at
android.os.Handler.dispatchMessage(Handler.java:99)
11-01 17:04:09.279: ERROR/AndroidRuntime(1355): at
android.os.Looper.loop(Looper.java:123)
11-01 17:04:09.279: ERROR/AndroidRuntime(1355): at
android.app.ActivityThread.main(ActivityThread.java:4203)
11-01 17:04:09.279: ERROR/AndroidRuntime(1355): at
java.lang.reflect.Method.invokeNative(Native Method)
11-01 17:04:09.279: ERROR/AndroidRuntime(1355): at
java.lang.reflect.Method.invoke(Method.java:521)
11-01 17:04:09.279: ERROR/AndroidRuntime(1355): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run
(ZygoteInit.java:791)
11-01 17:04:09.279: ERROR/AndroidRuntime(1355): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)
11-01 17:04:09.279: ERROR/AndroidRuntime(1355): at
dalvik.system.NativeStart.main(Native Method)
11-01 17:04:09.319: INFO/Process(568): Sending signal. PID: 1355 SIG:
3
11-01 17:04:09.329: INFO/dalvikvm(1355): threadid=7: reacting to
signal 3
11-01 17:04:09.399: INFO/dalvikvm(1355): Wrote stack trace to '/data/
anr/traces.txt'
11-01 17:04:11.979: INFO/Process(1355): Sending signal. PID: 1355 SIG:
9




On Nov 1, 4:36 pm, Dexter#39;s Brain coomar@gmail.com wrote:
 A small code snippet or the stack trace would help us figure out the
 problem

 Dexter

 http://tech-droid.blogspot.com

 On Nov 1, 12:46 pm, jax jackma...@gmail.com wrote:

  I have an ArrayList connected to a ListView with an onclick event that
  loads some extra info about each list item.

  When the list fits inside the screen (no scrolling) it works fine,
  however, when the list becomes long enought that I need to scroll I
  get the Force Close message.

  why is this?



-- 
You received this message because you 

[android-developers] Re: When I scroll a list I get the force close message

2009-11-01 Thread jax
Something I did not say - actually I forgot I even did it - is that I
subclasses ArrayAdapter.  Here is the subclass.




/*
 * Subclass of ArrayAdapter to change the color of the
 * text to red if it is not 100%
 *
 */
public class ScoringAdapter extends ArrayAdapterString {

private ArrayListString items;

public ScoringAdapter(Context context, int textViewResourceId,
ArrayListString items) {
super(context, textViewResourceId, items);
this.items = items;
}

@Override
public View getView(int position, View convertView, ViewGroup
parent) {
try {
View v = (ListView)convertView;
if (v == null) {
LayoutInflater vi = (LayoutInflater)
getSystemService(Context.LAYOUT_INFLATER_SERVICE);
v = vi.inflate
(android.R.layout.simple_list_item_1, null);
}

String item = items.get(position);
TextView tv = (TextView) v.findViewById
(android.R.id.text1);
tv.setText(item);

if(!item.contains(100%)) {
tv.setTextColor(Color.RED);
}

return v;
}
catch(ClassCastException e) {
Log.e(TAG, convertView.toString()+ is not a valid
ListView!);
}

return null;
}
}



On Nov 1, 5:05 pm, jax jackma...@gmail.com wrote:
 Here is the output from logcat as I scroll down

 11-01 17:04:08.979: ERROR/StatsDisplay(1355):
 android.widget.textv...@4381ade8 is not a valid ListView!
 11-01 17:04:08.999: DEBUG/AndroidRuntime(1355): Shutting down VM
 11-01 17:04:08.999: WARN/dalvikvm(1355): threadid=3: thread exiting
 with uncaught exception (group=0x4001aa28)
 11-01 17:04:08.999: ERROR/AndroidRuntime(1355): Uncaught handler:
 thread main exiting due to uncaught exception
 11-01 17:04:09.259: DEBUG/dalvikvm(1355): GC freed 7712 objects /
 415992 bytes in 220ms
 11-01 17:04:09.279: ERROR/AndroidRuntime(1355):
 java.lang.NullPointerException
 11-01 17:04:09.279: ERROR/AndroidRuntime(1355):     at
 android.widget.ListView.setupChild(ListView.java:1683)
 11-01 17:04:09.279: ERROR/AndroidRuntime(1355):     at
 android.widget.ListView.addViewBelow(ListView.java:2797)
 11-01 17:04:09.279: ERROR/AndroidRuntime(1355):     at
 android.widget.ListView.scrollListItemsBy(ListView.java:2725)
 11-01 17:04:09.279: ERROR/AndroidRuntime(1355):     at
 android.widget.ListView.arrowScrollImpl(ListView.java:2225)
 11-01 17:04:09.279: ERROR/AndroidRuntime(1355):     at
 android.widget.ListView.arrowScroll(ListView.java:2172)
 11-01 17:04:09.279: ERROR/AndroidRuntime(1355):     at
 android.widget.ListView.commonKey(ListView.java:1977)
 11-01 17:04:09.279: ERROR/AndroidRuntime(1355):     at
 android.widget.ListView.onKeyDown(ListView.java:1924)
 11-01 17:04:09.279: ERROR/AndroidRuntime(1355):     at
 android.view.KeyEvent.dispatch(KeyEvent.java:893)
 11-01 17:04:09.279: ERROR/AndroidRuntime(1355):     at
 android.view.View.dispatchKeyEvent(View.java:3647)
 11-01 17:04:09.279: ERROR/AndroidRuntime(1355):     at
 android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:744)
 11-01 17:04:09.279: ERROR/AndroidRuntime(1355):     at
 android.widget.ListView.dispatchKeyEvent(ListView.java:1909)
 11-01 17:04:09.279: ERROR/AndroidRuntime(1355):     at
 android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:746)
 11-01 17:04:09.279: ERROR/AndroidRuntime(1355):     at
 android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:746)
 11-01 17:04:09.279: ERROR/AndroidRuntime(1355):     at
 android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:746)
 11-01 17:04:09.279: ERROR/AndroidRuntime(1355):     at
 android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:746)
 11-01 17:04:09.279: ERROR/AndroidRuntime(1355):     at
 com.android.internal.policy.impl.PhoneWindow
 $DecorView.superDispatchKeyEvent(PhoneWindow.java:1708)
 11-01 17:04:09.279: ERROR/AndroidRuntime(1355):     at
 com.android.internal.policy.impl.PhoneWindow.superDispatchKeyEvent
 (PhoneWindow.java:1197)
 11-01 17:04:09.279: ERROR/AndroidRuntime(1355):     at
 android.app.Activity.dispatchKeyEvent(Activity.java:1967)
 11-01 17:04:09.279: ERROR/AndroidRuntime(1355):     at
 com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchKeyEvent
 (PhoneWindow.java:1684)
 11-01 17:04:09.279: ERROR/AndroidRuntime(1355):     at
 android.view.ViewRoot.deliverKeyEventToViewHierarchy(ViewRoot.java:
 2329)
 11-01 17:04:09.279: ERROR/AndroidRuntime(1355):     at
 android.view.ViewRoot.handleFinishedEvent(ViewRoot.java:2299)
 11-01 17:04:09.279: ERROR/AndroidRuntime(1355):     at
 android.view.ViewRoot.handleMessage(ViewRoot.java:1621)
 11-01 17:04:09.279: ERROR/AndroidRuntime(1355):     at
 android.os.Handler.dispatchMessage(Handler.java:99)
 11-01 17:04:09.279: ERROR/AndroidRuntime(1355):     at
 

[android-developers] Re: When I scroll a list I get the force close message

2009-11-01 Thread Dexter#39;s Brain
I think.

In your getView() method, don't cast it to ListView, remove that and I
guess, I will work.

Dexter.

http://tech-droid.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


[android-developers] Re: When I scroll a list I get the force close message

2009-11-01 Thread jax
Thanks, it worked




On Nov 1, 7:58 pm, Dexter#39;s Brain coomar@gmail.com wrote:
 I think.

 In your getView() method, don't cast it to ListView, remove that and I
 guess, I will work.

 Dexter.

 http://tech-droid.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