in my app i am trying to store the images in internal memory so that it can be used only in my app and cannot be seen in other ways.
In the following way i have stor
You have written wrong code.
Replace
File cacheDir = getApplicationContext().getDir("", Context.MODE_PRIVATE);
File fileWithinMyDir = new File(cacheDir, "");
To
File fileWithinMyDir = getApplicationContext().getFilesDir();
Then
Replace
String PATH = fileWithinMyDir + filename;
To
String PATH = fileWithinMyDir.getAbsolutePath() + "/" +filename+".file extension";