Note that there are some explanatory texts on larger screens.

plurals
  1. POOnItemClick not being called in List Fragment
    text
    copied!<p>When I click in an item of the List the method OnItemClick is not ben called. I'm trying to call another activity to show more information about that "AnaliseEstrutural". What will be in the List is the value Brunton or Clar defined for ehBrunton . Then when the user clicks on a item it will apear the oter information about that "AnaliseEstrutural". But it's not passing by the method. </p> <p>here is the code: </p> <pre><code>public class AnalisesPonto extends ListFragment implements OnItemClickListener{ private ArrayList&lt;AnaliseEstrutural&gt; analises; AnalisesDAO andao; String idPonto; private View view; private ListView analisesList; private AnalisesAdapter analisesAdapter; private boolean ehBrunton; private Intent i; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setRetainInstance(true); idPonto = getArguments().getString("id"); andao = new AnalisesDAO(getActivity().getApplicationContext()); analises = andao.relatorioAnalises(idPonto); ehBrunton = true; i = new Intent(getActivity().getApplicationContext(), DadosAnalises.class); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { view = inflater.inflate(R.layout.analises_ponto_layout, null); analisesList = (ListView) view.findViewById(android.R.id.list); analisesAdapter = new AnalisesAdapter(getActivity().getApplicationContext(), true); for (int i = 0; i &lt; analises.size(); i++) { analisesAdapter.add(analises.get(i)); } analisesList.setAdapter(analisesAdapter); ViewGroup parent = (ViewGroup) analisesList.getParent(); parent.removeView(analisesList); analisesList.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; arg0, View arg1,int position, long arg3) { Bundle extra = new Bundle(); extra.putBoolean("radio", ehBrunton); extra.putString("tipo_est", analises.get(position).getTipo()); extra.putString("codigo", analises.get(position).getCodigo()); if(ehBrunton) { extra.putString("brun_clar", analises.get(position).getBrunton()); } else { extra.putString("brun_clar", analises.get(position).getClar()); } extra.putString("azimute", analises.get(position).getAzimute()); extra.putString("direcao", analises.get(position).getDirecao()); extra.putString("quadrante", analises.get(position).getQuadrante()); extra.putString("sentido", analises.get(position).getSentido()); extra.putString("descricao",analises.get(position).getDescricao()); extra.putString("mergulho", analises.get(position).getMergulho()); extra.putString("familia", analises.get(position).getFamilia()); i.putExtra("analise", extra); startActivity(i); } }); return analisesList; } } </code></pre> <p>The layout from the List:</p> <pre><code> &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" &gt; &lt;ListView android:id="@android:id/list" android:layout_width="fill_parent" android:layout_height="match_parent" &gt; &lt;/ListView&gt; &lt;/LinearLayout&gt; </code></pre> <p>And here is the Layout of the Element of the List</p> <pre><code> &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" &gt; &lt;TextView android:id="@+id/med_angular" android:layout_width="wrap_content" android:layout_height="wrap_content" /&gt; &lt;/LinearLayout&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload