-4

i need to click in one image and send a URL (intent) but i have many images, so i tryed to get ID, but i can't find a proper away to do it, if you guys can help me i tryed everything i know

public class ProgramAdapter extends RecyclerView.Adapter<ProgramAdapter.ViewHolder> 
{
Context context;
String[] programTituloList;
String[] programDescList;
int[] programImages;

    public static class ViewHolder extends RecyclerView.ViewHolder 
  {
    TextView rowTitulo;
    TextView rowDesc;
    ImageView rowImage;

    public ViewHolder(@NonNull View itemView)
 {
        super(itemView);
        rowTitulo = itemView.findViewById(R.id.txt_titulo);
        rowDesc = itemView.findViewById(R.id.txt_desc);
        rowImage = itemView.findViewById(R.id.imagem_box);
    }
}

public ProgramAdapter(Context context, String[] programTituloList,
                      String[] programDescList, int[] images) {
    this.context = context;
    this.programTituloList = programTituloList;
    this.programDescList = programDescList;
    this.programImages = images;
}

@NonNull
@Override
public ProgramAdapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {

    LayoutInflater inflater = LayoutInflater.from(context);
    View view = inflater.inflate(R.layout.box, parent, false);
    ViewHolder viewHolder = new ViewHolder(view);
    return viewHolder;

}

@Override
public int getItemCount() {
    return programTituloList.length;
}

@Override
public void onBindViewHolder(@NonNull ProgramAdapter.ViewHolder holder, int position) {
    holder.rowTitulo.setText(programTituloList[position]);
    holder.rowDesc.setText(programDescList[position]);
    holder.rowImage.setImageResource(programImages[position]);
    
    holder.rowImage.setOnClickListener(new View.OnClickListener()
    {
        @Override
        public void onClick(View v)
        {
           
             if ()
             {
                 Uri uri = Uri.parse("http://www.google.com");
                 Intent i = new Intent(Intent.ACTION_VIEW, uri);
                 context.startActivity(i);
             }
        }
    });
}

} anyways to select image name and do an Intet url ??

here the image to understand better image

Lestat2022
  • 11
  • 6
  • 1
    What made you think adding garbage to the end of your post to get around the quality filter would in any way increase the quality of your question? Instead, read [ask] and [edit] the question to contain useful information. – Adriaan Feb 15 '22 at 11:03
  • 1
    Please [don’t post images of code, error messages, or other textual data.](https://meta.stackoverflow.com/questions/303812/discourage-screenshots-of-code-and-or-errors) – tripleee Feb 15 '22 at 11:05
  • i was editing... – Lestat2022 Feb 15 '22 at 11:05

1 Answers1

1

https://www.youtube.com/watch?v=SvTr9QA5NvA

i just adapt this code with this video and worked

holder.rowImage.setOnClickListener(new View.OnClickListener()
        {
            @Override
            public void onClick(View view)
            {
                Intent intent = new Intent(Intent.ACTION_VIEW);
                intent.setData(Uri.parse(Url[holder.getBindingAdapterPosition()]));
                context.startActivity(intent);
            }
        });
Lestat2022
  • 11
  • 6