public class AddImage extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_add_account);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if(requestCode == PICK_IMAGE && resultCode == RESULT_OK && data != null && data.getData() != null){
uriSecurityQuestion = data.getData();
ivSecurityQuestions.setImageURI(uriSecurityQuestion);
ivSecurityQuestions.setVisibility(View.VISIBLE);
}
}
}
I send a request to add a .png file, then on the intent return, the onActivityResult is called with the intent data (containing the filepath to the .png selected)
From the Intent data, I don't get a path that is /storage/emulated/0/, but rather I get something like /document/msf:49 . How can I get the absolute filesystem path?
data.getData().getPath() doesn't seem to give the path I want.
I want to use this path to create a java.io.File object and push it to my google drive api service. When I manually type the path to the file myself, it does seem to upload the document so my only roadblock is getting the correct filepath.