Skip to content

Make the row clickable to move another activity with Ripple effect #9

@sivailango

Description

@sivailango

Hi @slidenerd,

First of all thanks for you Material Design video tutorial.

I have two issues.
First one is, when i try click on the link on RecyclerView, it moves to sub activity only when click on the icon of menu list. So i added click listener for title too. Now it works, but ripple effect is only working when i click other than icon and title. I want to implement the click event anywhere on the item with ripple effect and it should take me to sub activity.

class MyViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {

    TextView title;
    ImageView item;

    public MyViewHolder(View itemView) {
        super(itemView);
        title = (TextView) itemView.findViewById(R.id.listMessage);
        item = (ImageView) itemView.findViewById(R.id.listItem);
        item.setOnClickListener(this);
        title.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        //Toast.makeText(context, "Item clicked at " + getPosition(), Toast.LENGTH_SHORT).show();
        //delete(getPosition());
        context.startActivity(new Intent(context, SubActivity.class));
    }
}    

Also i when back to MainActivity from SubActivity the Navigation is still in open status.

How do i solve it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions