java - How can i Apply a OnClickListener to a LinearLayouts Child? -


This is my code for each child trying to give the audience every child should have a picture that I know Kiss is clicked, so I can start an image pager with that picture. But with this code childs do not get clicks to help.

  thumbs_layout.getChildAt (i) .setOnClickListener (New View.OnClickListener () {@Override see public void onClick (View) {Intent intent = new Intent (mContext, ImagePager.class); intent . input extra ( "CHILD_INDEX", Dekenkgetaidi ()); Prarnbwykti intent ();}});  

You can baby your click listener such loop within your layout , / p for <>

  (I Int = 0; i & LT; layoutParent.getChildCount (); i ++) {views = layoutParent.getChildAt (i); view.setOnClickListener (New View.OnClickListener () {@Override public void onClick (View view) {Intent intent = new Intent (mContext, ImagePager.class); intent.putExtra ( "CHILD_INDEX", view.getId ()); startActivity (Intent);}}); }  

Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -