Tecnologia do Blogger.
RSS

[androidbrasil-dev] Retorno de ID pela View (NULL) em fragment (FindViewById)

Pessoal, help!

Tenho um fragment que está parando a aplicação ao adquirir a view no on createview:

Cenário:
Tentativa 1:
listaP = (ListView) getActivity().findViewById(R.layout_lista_p.ListaP); 
// listaP = NULL??? 
Obs: essa ListView Existe e está devidamente salva:

layout_lista_P.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
<ListView
   android:layout_width="fill_parent" 
   android:layout_height="fill_parent" 
   android:id="@+layout_lista_publicador/ListaP" 
   android:fastScrollEnabled="True"/>
</LinearLayout>


Teste 1
listaP = new ListView(getActivity());
// listaP CARREGADA

Teste 2:
listaP = (ListView)getActivity().findViewById(android.R.layout.simple_list_item_1);
//listaP = NULL??

Obs: já testei direto numa activity e dá o mesmo erro
O que estou esquecendo?
--
Anselmo M. Silva

--
You received this message because you are subscribed to the Google Groups "Android Brasil - Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to androidbrasil-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • RSS

0 comentários:

Postar um comentário