Buenas, desde android quiero hacer una peticion a un servicio web y posteriormente mostrar datos en Android. La peticion al servicio la realizo desde un AsyncTask... pero luego no consiiguo hacer para añadir elementos al Layout con la informacion obtenida.
Aqui mi codigo..
protected void onPostExecute(){
            for(int j=1;j<5;j++){
                nivel = new RelativeLayout(ctx);
                nivel.setId(j);
                //Controlar click block/desblock
                if(j<4){
                    nivel.setOnClickListener(new View.OnClickListener(){
                        @Override
                        public void onClick(View v) {
                            // TODO Auto-generated method stub
                            nivelClick(v);
                        }
                    });
                }
                RelativeLayout.LayoutParams param = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT,RelativeLayout.LayoutParams.WRAP_CONTENT);
                param.addRule(RelativeLayout.CENTER_HORIZONTAL);
                if(j==1){
                    param.setMargins(0, 0, 0, 0);
                }else{
                    param.setMargins(0, 200*(j-1), 0, 0);
                }
                nivel.setLayoutParams(param);
                ImageView imagen = new ImageView(ctx);
                int idimageblock;
                //Controlar icono bloqeuado / desbloqueado
                if(j<4){
                    idimageblock = R.drawable.nivel_desblo;
                }else{
                    idimageblock = R.drawable.nivel_block;
                }
                imagen.setImageDrawable(getResources().getDrawable(idimageblock));
                RelativeLayout.LayoutParams textparams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT,RelativeLayout.LayoutParams.WRAP_CONTENT);
                textparams.setMargins(20, 0, 0, 0);
                textparams.addRule(RelativeLayout.CENTER_VERTICAL);
                TextView texto = new TextView(ctx);
                texto.setText("Nivel "+String.valueOf(j));
                //texto.setText(arrayLevel.get(j-1).getTitulo());
                texto.setTextSize(30);
                texto.setLayoutParams(textparams);
                texto.setTextColor(Color.BLACK);
                //texto.setTextAppearance(this, R.attr.textAppearanceLargePopupMenu);
                nivel.addView(imagen);
                nivel.addView(texto);
            }           
         }
La variable ctx proviene de una referencia del ActionBarActivity que llamo desde el constructor,
Cuando pruebo el codigo hace como si no se ejecutara.



