I am creating a recycler View that shows the images that user gives to it, I get the directory of pictures and then I create a File of them and then I create A bitmap from my file and set it to my Image View . but when user choose a picture, recycer view does not show it .

I used permissions and dexter library but it did not work.

my Adapter

```
public class Adaptor extends RecyclerView.Adapter<Adaptor.ViewHolder> {
    private Context context;
    private List<model> list;

    public Adaptor(Context context, List<model> list) {
        this.context = context;
        this.list = list;
    }

    @NonNull
    @Override
    public Adaptor.ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
        View view= LayoutInflater.from(context).inflate(R.layout.imageview,viewGroup,false);
        return new ViewHolder(view);
    }

    @Override
    public void onBindViewHolder(@NonNull Adaptor.ViewHolder viewHolder, int i) {
        model model=list.get(i);
        Uri uri= Uri.parse(model.getPath());
        File file=new File(String.valueOf(uri));
            Bitmap bitmap= BitmapFactory.decodeFile(file.getAbsolutePath());
            viewHolder.img.setImageBitmap(bitmap);
    }

    @Override
    public int getItemCount() {
        return list.size();
    }
    public class ViewHolder extends RecyclerView.ViewHolder {
        ImageView img;
        public ViewHolder(@NonNull View itemView) {
            super(itemView);
            img=itemView.findViewById(R.id.img_view);
        }
    }

```

My Database 

```
public class database extends SQLiteOpenHelper {
    public database(@Nullable Context context) {
        super(context, "add_image", null, 1);
    }

    @Override
    public void onCreate(SQLiteDatabase sqLiteDatabase) {
        sqLiteDatabase.execSQL("CREATE TABLE IF NOT EXISTS ADD_IMAGE(_ID INTEGER PRIMARY KEY AUTOINCREMENT,_PICTURES varchar )");

    }

    @Override
    public void onUpgrade(SQLiteDatabase sqLiteDatabase, int i, int i1) {

    }
    public long insert(String directory){
        SQLiteDatabase db=this.getWritableDatabase();
        ContentValues cv=new ContentValues();
        cv.put("_PICTURES",directory);
        return db.insert("ADD_IMAGE",null,cv);

    }
    public Cursor cursor(){
        SQLiteDatabase DB=this.getReadableDatabase();
        return DB.rawQuery(" select * from ADD_IMAGE",null);
    }
}

```

MY Model class

```
public class model {
    String path;

    public String getPath() {
        return path;
    }

    public void setPath(String path) {
        this.path = path;
    }
}

```

My Activity

```
public class MainActivity extends AppCompatActivity {
    database database=new database(this);
    SQLiteDatabase sqLiteDatabase;
    RecyclerView rec_view;
    List<model> list=new ArrayList<>();
    Context context;
Button btn;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Dexter.withActivity(this).withPermission(Manifest.permission.READ_EXTERNAL_STORAGE).withListener(new PermissionListener() {
            @Override
            public void onPermissionGranted(PermissionGrantedResponse response) {
                Toast.makeText(context, "thanks", Toast.LENGTH_SHORT).show();
            }

            @Override
            public void onPermissionDenied(PermissionDeniedResponse response) {
                Toast.makeText(context, "please give premission", Toast.LENGTH_SHORT).show();
            }

            @Override
            public void onPermissionRationaleShouldBeShown(PermissionRequest permission, PermissionToken token) {

            }
        }).check();
        context = this;
        final Adaptor adaptor = new Adaptor(context, list);
        rec_view = findViewById(R.id.rec_image);
        rec_view.setAdapter(adaptor);
        rec_view.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
        btn = findViewById(R.id.loadimage);
        btn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(Intent.ACTION_PICK,
                        android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
                startActivityForResult(intent, 0);
                Cursor cursor = database.cursor();
                for (cursor.moveToFirst(); !cursor.isAfterLast(); cursor.moveToNext()) {
                    model model = new model();
                    model.setPath(cursor.getString(1));
                    list.add(model);
                    adaptor.notifyDataSetChanged();
                    startActivity(new Intent(getApplicationContext(),MainActivity.class));
                }
            }
        });

    }
    @Override
    protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
    if (requestCode==RESULT_OK){
        Uri tartgeturi=data.getData();
        String directory=String.valueOf(tartgeturi);
        database.insert(directory);
        }

    }

    }

```

I want My recycler view to show pictures correctly,