2016-09-13 6 views
0

をクリックし、画像のIDは、私は、このイメージ図を持っているものを知っているし、この画像は、多くの画像を持ってリサイクルビューによる変更で,,質問ですどの画像をクリックするかを知る方法!と私はループの任意のアイデアにそれを追加する整数値がありますか?どのよう</p> <p><a href="https://i.stack.imgur.com/BjJ4l.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BjJ4l.jpg" alt="enter image description here"></a></p> <p>,,私はそれで

これは、あなたのonCreateViewHolder方法であなたのRecyclerViewのすべてのImageViewのために(あなたのアダプタで)OnClickListenerを設定する必要があり、この活動

public class ListViewDetailsFragment extends Fragment { 
ImageView AppImage; 
TextView AppName,AppArtist,AppContentType,AppRights,AppCategory,AppRealseDate,AppSammary; 
ImageButton AppLink; 
Context context; 
public ListViewDetailsFragment() { 
} 
@Override 
public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) { 
    return inflater.inflate(R.layout.fragment_list_view_details, container, false);} 
public void onActivityCreated(@Nullable Bundle savedInstanceState) { 
    super.onActivityCreated(savedInstanceState); 
    AppImage = (ImageView) getView().findViewById(R.id.imageView); 
    AppName = (TextView) getView().findViewById(R.id.textname); 
    AppArtist = (TextView) getView().findViewById(R.id.textartest); 
    AppContentType = (TextView) getView().findViewById(R.id.textcontent); 
    AppRights = (TextView) getView().findViewById(R.id.textrights); 
    AppCategory = (TextView) getView().findViewById(R.id.textCategory); 
    AppRealseDate = (TextView) getView().findViewById(R.id.textRelease); 
    AppSammary = (TextView) getView().findViewById(R.id.textSummary); 
    AppLink = (ImageButton) getView().findViewById(R.id.imageButton); 
    String name = getActivity().getIntent().getExtras().getString("App_name"); 
    final String image = getActivity().getIntent().getExtras().getString("App_image"); 
    String artist = getActivity().getIntent().getExtras().getString("App_artist"); 
    String contentType = getActivity().getIntent().getExtras().getString("App_ContentType"); 
    String rights = getActivity().getIntent().getExtras().getString("App_Rights"); 
    String category = getActivity().getIntent().getExtras().getString("App_Category"); 
    String realse = getActivity().getIntent().getExtras().getString("App_ReleaseDate"); 
    final String link = getActivity().getIntent().getExtras().getString("App_link"); 
    String sammary = getActivity().getIntent().getExtras().getString("App_summary"); 
    AppName.setText(name); 
    final AppShowModule appShowModule = new AppShowModule(); 

    AppArtist.setText(artist); 
    AppContentType.setText(contentType); 
    AppRights.setText(rights); 
    AppCategory.setText(category); 
    AppRealseDate.setText(realse); 
    AppSammary.setText(sammary); 
    Picasso.with(context).load(image).into(AppImage); 
    AppLink.setOnClickListener(new View.OnClickListener() { 
     @Override 
     public void onClick(View view) { 
      AppImage.setTag("id that you get from extras"); 
      Intent intent = new Intent(getActivity().getBaseContext(), 
        WebView.class); 
      intent.putExtra("App_link", link); 
      getActivity().startActivity(intent);}}); 
    AppImage.setOnClickListener(new View.OnClickListener() { 
     @Override 
     public void onClick(View view) { 

      Intent intent = new Intent(getActivity().getBaseContext(), ImageList.class); 
      getActivity().startActivity(intent); 
     }});}} 

答えて

0

のコードです。

viewHolder.getAdapterPosition()を使用して商品の位置を知ることができます。

+0

ありがとうございます@ZShockあなたの答えは私の問題は[link]です(http://stackoverflow.com/questions/39456214/error-when-parsing-jsonarray-include-another-jsonarray)すべての詳細を確認してくださいどんなアダプターを私に教えてください? –