You forgot to setTag when convertView is null...

On Apr 20, 11:41 pm, ABSOLUT <davidt...@gmail.com> wrote:
> Hi again,
> I begin a new proyect deleting all and only have a listview and the
> funcion where I get the arraylist and I have the same error :-(
>
> 04-21 03:28:27.035: ERROR/AndroidRuntime(682): FATAL EXCEPTION: main
> 04-21 03:28:27.035: ERROR/AndroidRuntime(682):
> java.lang.NullPointerException
> 04-21 03:28:27.035: ERROR/AndroidRuntime(682):     at
> com.es.paraBorrar.paraBorrar$listaAdaptador.getView(paraBorrar.java:
> 179)
> 04-21 03:28:27.035: ERROR/AndroidRuntime(682):     at
>
> The simple code is:
>
> public class paraBorrar extends Activity {
>     /** Called when the activity is first created. */
>
>         private ArrayList<String> tit  = new  ArrayList<String>();
>     String horaIn;
>     String horaFi;
>     String canal;
>     int posicion;
>     int pos=0;
>         private ArrayList<String> des  = new  ArrayList<String>();
>         listaAdaptador adaptador3 = null;
>
>     @Override
>     public void onCreate(Bundle savedInstanceState) {
>         super.onCreate(savedInstanceState);
>         setContentView(R.layout.main);
>         ListView list=(ListView)findViewById(R.id.listaTele);
>
>                 list.setFocusable(true);
>                 list.setItemsCanFocus(true);
>         adaptador3 = new listaAdaptador();
>         list.setAdapter(adaptador3);
>
>         getRSS("http://www.miguiatv.com/rss/la2.xml","LADOS";);
>
>     }
>
>    private void getRSS(String rss,String tabla)
>         {
>
>                 ...................
>         }
>
>     class listaAdaptador extends ArrayAdapter<String> {
>           listaAdaptador() {
>
>         //       super(paraBorrar.this, R.layout.row,R.id.programa,tit);
>                 super(paraBorrar.this, R.layout.row,tit);
>           }
>           public View getView(int position, View convertView,
>                              ViewGroup parent) {
>
>                   View row = convertView;
>                   ViewHolder holder;
>
>                         Log.d("PRUEBA","la position con su respectivo valor 
> es ..." +
> tit.get(position));
>
>                   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));
>
>             return(row);
>           }
>         }
> static class ViewHolder {
>      public TextView programa;
>   }
>
> I cant understand the error
> Any help please?
>
> On 20 abr, 20:14, ABSOLUT <davidt...@gmail.com> wrote:
>
>
>
>
>
>
>
> > But tit is not null.
> > In other function I load this function I dont have any field null
>
> >                 for (i=0; i<tit.size(); i++){
>
> >                         Log.d("PRUEBA", "vamos a ver si hay nulo ... " + 
> > tit.get(i));
>
> >                 }
> > 04-20 18:10:43.596: DEBUG/PRUEBA(1274): vamos a ver si hay nulo ...
> > Documentales Culturales - 14:35
> > 04-20 18:10:43.596: DEBUG/PRUEBA(1274): vamos a ver si hay nulo ...
> > Imaginantes - 15:25
> > 04-20 18:10:43.606: DEBUG/PRUEBA(1274): vamos a ver si hay nulo ...
> > Saber y ganar - 15:30
> > 04-20 18:10:43.606: DEBUG/PRUEBA(1274): vamos a ver si hay nulo ...
> > Grandes documentales - 16:00
> > 04-20 18:10:43.606: DEBUG/PRUEBA(1274): vamos a ver si hay nulo ...
> > Documentales Culturales - 17:55
> > 04-20 18:10:43.606: DEBUG/PRUEBA(1274): vamos a ver si hay nulo ...
> > Biodiario - 18:55
> > 04-20 18:10:43.606: DEBUG/PRUEBA(1274): vamos a ver si hay nulo ...
> > Ciudades para el siglo XIX - 19:00
> > 04-20 18:10:43.606: DEBUG/PRUEBA(1274): vamos a ver si hay nulo ...
> > Redes 2.0 - 19:30
> > 04-20 18:10:43.666: DEBUG/PRUEBA(1274): vamos a ver si hay nulo ... La
> > 2 Noticias - 20:00
> > 04-20 18:10:43.666: DEBUG/PRUEBA(1274): vamos a ver si hay nulo ...
> > Imaginantes - 20:25
> > 04-20 18:10:43.666: DEBUG/PRUEBA(1274): vamos a ver si hay nulo ...
> > Nostromo - 00:50
> > 04-20 18:10:43.701: DEBUG/PRUEBA(1274): vamos a ver si hay nulo ...
> > ZZZ - 01:50
> > 04-20 18:10:43.706: DEBUG/PRUEBA(1274): vamos a ver si hay nulo ...
> > Documentales culturales - 01:55
> > 04-20 18:10:43.706: DEBUG/PRUEBA(1274): vamos a ver si hay nulo ...
> > Conciertos de Radio 3 - 02:45
> > 04-20 18:10:43.716: DEBUG/PRUEBA(1274): vamos a ver si hay nulo ...
> > Nostromo - 03:20
> > 04-20 18:10:43.716: DEBUG/PRUEBA(1274): vamos a ver si hay nulo ...
> > Redes 2.0 - 04:20
> > 04-20 18:10:43.746: DEBUG/PRUEBA(1274): vamos a ver si hay nulo ...
> > Mapa Sonoro - 05:05
> > 04-20 18:10:43.746: DEBUG/PRUEBA(1274): vamos a ver si hay nulo ...
> > That´s English - 06:30
> > 04-20 18:10:43.756: DEBUG/PRUEBA(1274): vamos a ver si hay nulo ...
> > Conciertos de Radio 3 - 07:00
> > 04-20 18:10:43.756: DEBUG/PRUEBA(1274): vamos a ver si hay nulo ...
> > Grandes Documentales - 07:30
> > 04-20 18:10:43.756: DEBUG/PRUEBA(1274): vamos a ver si hay nulo ...
> > Biodiario - 08:25
> > 04-20 18:10:43.776: DEBUG/PRUEBA(1274): vamos a ver si hay nulo ... +
> > De España - 08:30
> > 04-20 18:10:43.776: DEBUG/PRUEBA(1274): vamos a ver si hay nulo ...
> > Biodiario - 09:25
> > 04-20 18:10:43.786: DEBUG/PRUEBA(1274): vamos a ver si hay nulo ...
> > Aqui hay trabajo - 09:30
> > 04-20 18:10:43.786: DEBUG/PRUEBA(1274): vamos a ver si hay nulo ... La
> > aventura del Saber - 10:00
> > 04-20 18:10:43.786: DEBUG/PRUEBA(1274): vamos a ver si hay nulo ...
> > Accion Directa - 11:00
> > 04-20 18:10:43.786: DEBUG/PRUEBA(1274): vamos a ver si hay nulo ...
> > Para Todos La 2 - 11:30
> > 04-20 18:10:43.786: DEBUG/PRUEBA(1274): vamos a ver si hay nulo ...
> > Redes 2.0 - 13:10
> > 04-20 18:10:43.816: DEBUG/PRUEBA(1274): vamos a ver si hay nulo ...
> > Dias de Cine - 04:15
>
> > On 20 abr, 20:06, Kumar Bibek <coomar....@gmail.com> wrote:
>
> > > My guess, variable tit is null.
>
> > > Kumar Bibekhttp://techdroid.kbeanie.comhttp://www.kbeanie.com
>
> > > On Wed, Apr 20, 2011 at 11:35 PM, ABSOLUT <davidt...@gmail.com> wrote:
> > > > 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 <coomar....@gmail.com> 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 <davidt...@gmail.com> 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(PhoneW
> > > >  indow.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,
>
> ...
>
> read more »

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

Reply via email to