I am opening video chooser by using this code in simpleWindow class.
ImageView btnselect = (ImageView) view.findViewById(R.id.imageView2);
btnselect.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent();
intent.setType("video/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
StandOutExampleActivity.a.startActivity(Intent.createChooser(intent, "Play Video"));
}
});
This simpleWindow is not extending activity class. So how can I use 'onActivityResult' in this class?
Here is my onActivityResult method, But when I am using this in my class, I am getting error.
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
Log.e("requestCode",""+requestCode);
if (requestCode == 1) {
Uri selectedImageUri = data.getData();
imagepath= getRealPathFromURI(selectedImageUri);
Toast.makeText(a, imagepath, Toast.LENGTH_LONG).show();
}
}
So how I can get selected file path in my class?