Hello I want to make plugin in my theta V, I download the sdk for android and I would like to show picture in ImageView in Vyson however I have a Permission denied there is the default code :
private TakePictureTask.Callback mTakePictureTaskCallback = new Callback() {
@Override
public void onTakePicture(String fileUrl){
Log.d(TAG, fileUrl); //first log
String imgName = Environment.getExternalStorageDirectory() + File.separator + "DCIM" + File.separator + "100RICOH" + File.separator + Uri.parse(fileUrl).getLastPathSegment();
checkFileExist(imgName);
}
};
There is my function checkFileExist :
private void checkFileExist(String fileUrl) {
String s = fileUrl;
File f = new File(s);
while(!f.exists()) {
s = fileUrl;
f = new File(s);
}
Log.d(TAG, String.valueOf(f.exists())); //second log
Log.d(TAG, f.getAbsolutePath()); //third log
imageView.setImageURI(Uri.fromFile(f));
}
this is the result of the function:
first log = http://127.0.0.1:8080/files/150100525831424d42079e9dd4eb8400/100RICOH/R0010537.JPG
second = true so this picture exist
third = /storage/emulated/0/DCIM/100RICOH/R0010537.JPG
D/com.theta360.pluginapplication.MainActivity: http://127.0.0.1:8080/files/150100525831424d42079e9dd4eb8400/100RICOH/R0010537.JPG
true
/storage/emulated/0/DCIM/100RICOH/R0010537.JPG
W/ImageView: Unable to open content: file:///storage/emulated/0/DCIM/100RICOH/R0010537.JPG
java.io.FileNotFoundException: /storage/emulated/0/DCIM/100RICOH/R0010537.JPG (Permission denied)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:146)
at java.io.FileInputStream.<init>(FileInputStream.java:99)
at android.content.ContentResolver.openInputStream(ContentResolver.java:704)
at android.widget.ImageView.getDrawableFromUri(ImageView.java:900)
at android.widget.ImageView.resolveUri(ImageView.java:871)
at android.widget.ImageView.setImageURI(ImageView.java:490)
at android.support.v7.widget.AppCompatImageView.setImageURI(AppCompatImageView.java:124)
at com.theta360.pluginapplication.MainActivity.checkFileExist(MainActivity.java:135)
at com.theta360.pluginapplication.MainActivity.access$100(MainActivity.java:50)
at com.theta360.pluginapplication.MainActivity$1.onTakePicture(MainActivity.java:64)
at com.theta360.pluginapplication.task.TakePictureTask$CaptureListener.onObjectChanged(TakePictureTask.java:62)
at com.theta360.pluginapplication.network.HttpConnector$CapturedTimerTask.run(HttpConnector.java:1017)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)
resolveUri failed on bad bitmap uri: file:///storage/emulated/0/DCIM/100RICOH/R0010537.JPG
I the vysor view I see my plugin but I can’t show the picture taken.
what can I do to show this picture I add all permission in the manifest INTERNET, READ_EXTERNAAL_STORAGE, WRITE…
Thanks