Trying to parse Uri from a string but I get the error permission denial: ACTION_OPEN DOCUMENT

In my code I saved the Uri I got after choosing an image from the gallery as a string file and then saved it in a database then I passed the value of the database into a constructor of the class note and it uses the method getAddress now I want to parse the Uri back from the generated string but it keeps giving me the ACTION_OPEN_DOCUMENT error and I need this done before Tuesday.

package com.example.bookreviewapplication;

import android.content.Context;
import android.content.Intent;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import java.util.List;

public class Adapter extends RecyclerView.Adapter<Adapter.ViewHolder> {
    private LayoutInflater inflater;
    private List<Note> notes;
    Uri new_image_Uri;

    Adapter(Context context,List<Note> notes){
        this.inflater = LayoutInflater.from(context);
        this.notes = notes;

    public ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
        View view = inflater.inflate(R.layout.add_views,viewGroup,false);
        return new ViewHolder(view);

    public void onBindViewHolder(@NonNull ViewHolder viewHolder, int i) {
        String  title    = notes.get(i).getTitle();
        String genre      = notes.get(i).getGenre();
        String review      = notes.get(i).getReview();
        String address      = notes.get(i).getAddress();

        new_image_Uri = Uri.parse(address);


    public int getItemCount() {
        return notes.size();

    public class ViewHolder extends RecyclerView.ViewHolder{
        TextView nTitle,nGenre,nReview;
        ImageView nImage;

        public ViewHolder(@NonNull final View itemView) {
            nTitle  = itemView.findViewById(;
            nGenre  = itemView.findViewById(;
            nReview  = itemView.findViewById(;
            nImage  = itemView.findViewById(;

            itemView.setOnClickListener(new View.OnClickListener() {
                public void onClick(View v) {
                    Intent i = new Intent(v.getContext(),ViewReviewActivity.class);
                    Log.i("tag", notes.get(getAdapterPosition()).getTitle());

Read more here:

Content Attribution

This content was originally published by Unikid500 at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: