The line is:
holder.programa.setText(tit.get(position));
But I dont know why say that is null
On 20 abr, 19:48, Kumar Bibek <[email protected]> wrote:
> java.lang.NullPointerException
> 04-20 17:40:23.116: ERROR/AndroidRuntime(1061): at com.es.tele.tele
> $listaAdaptador.getView(tele.
> java:425)
>
> Look at line number 425 in tele.java
>
> Kumar Bibekhttp://techdroid.kbeanie.comhttp://www.kbeanie.com
>
> On Wed, Apr 20, 2011 at 11:13 PM, ABSOLUT <[email protected]> wrote:
> > Hi,
>
> > In one of my projects I've got a ListView with some elements. But when
> > scrolling through this list I get the following error:
> > 04-20 17:40:23.056: WARN/dalvikvm(1061): threadid=1: thread exiting
> > with uncaught exception (group=0x40015560)
> > 04-20 17:40:23.116: ERROR/AndroidRuntime(1061): FATAL EXCEPTION: main
> > 04-20 17:40:23.116: ERROR/AndroidRuntime(1061):
> > java.lang.NullPointerException
> > 04-20 17:40:23.116: ERROR/AndroidRuntime(1061): at com.es.tele.tele
> > $listaAdaptador.getView(tele.java:425)
> > 04-20 17:40:23.116: ERROR/AndroidRuntime(1061): at
> > android.widget.AbsListView.obtainView(AbsListView.java:1409)
> > 04-20 17:40:23.116: ERROR/AndroidRuntime(1061): at
> > android.widget.ListView.makeAndAddView(ListView.java:1745)
> > 04-20 17:40:23.116: ERROR/AndroidRuntime(1061): at
> > android.widget.ListView.fillDown(ListView.java:670)
> > 04-20 17:40:23.116: ERROR/AndroidRuntime(1061): at
> > android.widget.ListView.fillGap(ListView.java:641)
> > 04-20 17:40:23.116: ERROR/AndroidRuntime(1061): at
> > android.widget.AbsListView.trackMotionScroll(AbsListView.java:3399)
> > 04-20 17:40:23.116: ERROR/AndroidRuntime(1061): at
> > android.widget.AbsListView.onTouchEvent(AbsListView.java:2233)
> > 04-20 17:40:23.116: ERROR/AndroidRuntime(1061): at
> > android.widget.ListView.onTouchEvent(ListView.java:3446)
> > 04-20 17:40:23.116: ERROR/AndroidRuntime(1061): at
> > android.view.View.dispatchTouchEvent(View.java:3885)
> > 04-20 17:40:23.116: ERROR/AndroidRuntime(1061): at
> > android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:903)
> > 04-20 17:40:23.116: ERROR/AndroidRuntime(1061): at
> > android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:942)
> > 04-20 17:40:23.116: ERROR/AndroidRuntime(1061): at
> > android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:942)
> > 04-20 17:40:23.116: ERROR/AndroidRuntime(1061): at
> > android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:942)
> > 04-20 17:40:23.116: ERROR/AndroidRuntime(1061): at
> > android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:942)
> > 04-20 17:40:23.116: ERROR/AndroidRuntime(1061): at
> > android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:942)
> > 04-20 17:40:23.116: ERROR/AndroidRuntime(1061): at
> > android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:942)
> > 04-20 17:40:23.116: ERROR/AndroidRuntime(1061): at
> > android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:942)
> > 04-20 17:40:23.116: ERROR/AndroidRuntime(1061): at
> > com.android.internal.policy.impl.PhoneWindow
> > $DecorView.superDispatchTouchEvent(PhoneWindow.java:1691)
> > 04-20 17:40:23.116: ERROR/AndroidRuntime(1061): at
>
> > com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:
> > 1125)
> > 04-20 17:40:23.116: ERROR/AndroidRuntime(1061): at
> > android.app.Activity.dispatchTouchEvent(Activity.java:2096)
>
> > My adapter is:
>
> > class listaAdaptador extends ArrayAdapter<String> {
> > listaAdaptador() {
>
> > super(tele.this, R.layout.row,R.id.programa,tit);
>
> > }
> > public View getView(int position, View convertView,
> > ViewGroup parent) {
>
> > View row = convertView;
> > ViewHolder holder;
>
> > if(row == null)
> > {
> > LayoutInflater inflater = getLayoutInflater();
> > row = inflater.inflate(R.layout.row, null);
> > holder = new ViewHolder();
> > holder.programa =
> > (TextView)row.findViewById(R.id.programa);
>
> > }
> > else {
>
> > holder = (ViewHolder)row.getTag();
>
> > }
>
> > holder.programa.setText(tit.get(position));
>
> > ImageView icon=(ImageView)row.findViewById(R.id.icon);
>
> > if (tabhost.getCurrentTab() == 0){
> > Log.d("PRUEBA", "Cargamos el primer canal");
> > icon.setImageResource(R.drawable.la1);
> > }
> > if (tabhost.getCurrentTab() == 1){
> > Log.d("PRUEBA", "Cargamos el segundo canal");
> > icon.setImageResource(R.drawable.la2);
> > }
>
> > if (tabhost.getCurrentTab() == 2){
> > Log.d("PRUEBA", "Cargamos el primer canal");
> > icon.setImageResource(R.drawable.antena3);
> > }
> > if (tabhost.getCurrentTab() == 3){
> > Log.d("PRUEBA", "Cargamos el segundo canal");
> > icon.setImageResource(R.drawable.cuatro);
> > }
>
> > if (tabhost.getCurrentTab() == 4){
> > Log.d("PRUEBA", "Cargamos el primer canal");
> > icon.setImageResource(R.drawable.telecinco);
> > }
> > if (tabhost.getCurrentTab() == 5){
> > Log.d("PRUEBA", "Cargamos el segundo canal");
> > icon.setImageResource(R.drawable.sexta);
> > }
>
> > if (tabhost.getCurrentTab() == 6){
> > Log.d("PRUEBA", "Cargamos el primer canal");
> > icon.setImageResource(R.drawable.marca);
> > }
>
> > return(row);
> > }
> > }
> > static class ViewHolder {
> > TextView programa;
>
> > }
>
> > I dont see any null field in the arrayList "tit"
>
> > Could you help me please?
> > Many thanks and sorry for my english!
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to [email protected]
> > To unsubscribe from this group, send email to
> > [email protected]
> > 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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en