2015年4月14日 星期二

[Android] Open gallery from folder (call other APP)

ib_gallery = (ImageButton) findViewById(R.id.ib_gallery);
ib_gallery.setOnClickListener(new OnClickListener() {
 @Override
 public void onClick(View v) {
  Log.e("Environment.getExternalStorageDirectory()",""+Environment.getExternalStorageDirectory().getPath());
  Uri selectedUri = Uri.parse(Environment.getExternalStorageDirectory().getPath() + 
       "/Download/IPCam/"+VLCApplication.getCurrUID()+"/snapshot/liveview/");
  Intent intent = new Intent(Intent.ACTION_VIEW);
  intent.setDataAndType(selectedUri, "resource/folder");
  startActivity(intent);
 }
});

String path=Environment.getExternalStorageDirectory().toString()+"/Download/IPCam/main8.jpg";
Log.e("path",path);
Intent i=new Intent();
i.setAction(Intent.ACTION_VIEW);
i.setDataAndType(Uri.fromFile(new File(path)), "image/*");  
startActivity(i);

沒有留言:

張貼留言