顯示具有 Gallery 標籤的文章。 顯示所有文章
顯示具有 Gallery 標籤的文章。 顯示所有文章

2015年4月15日 星期三

[Android] share photo or video with fb, gmail, messages..


String path=Environment.getExternalStorageDirectory().toString()+"/Download/IPCam/UID/photo/event/test0._1.png";
//String path=Environment.getExternalStorageDirectory().toString()+"/Download/IPCam/UID/video/event/test1.mp4";
Intent intent = new Intent(Intent.ACTION_SEND);
intent.putExtra(Intent.EXTRA_TEXT, "test");
intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new File(path)));
intent.setType("image/jpeg");
startActivity( Intent.createChooser(intent,"Send with"));

reference: https://developers.facebook.com/bugs/363863587019268


=======================================
Customize Android Intent.ACTION_SEND
http://stackoverflow.com/questions/20015410/customize-android-intent-action-send

Sending Simple Data to Other Apps (Send Multiple Pieces of Content)

[Android] Android Fullscreen Image Slider with Swipe and Pinch Zoom Gestures (轉貼)


來源:
http://www.androidhive.info/2013/09/android-fullscreen-image-slider-with-swipe-and-pinch-zoom-gestures/


remember to add permission as below,
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

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);

2015年4月8日 星期三

Android: How to open a specific folder via Intent and show its content in a file browser? (轉貼)

來源:http://stackoverflow.com/questions/17165972/android-how-to-open-a-specific-folder-via-intent-and-show-its-content-in-a-file

public void openFolder() 
{ 
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
Uri uri = Uri.parse(Environment.getExternalStorageDirectory().getPath()
    + "/myFolder/"); 
intent.setDataAndType(uri, "text/csv");
startActivity(Intent.createChooser(intent, "Open folder"));
} 



Uri selectedUri = Uri.parse(Environment.getExternalStorageDirectory() + "/myFolder/");
 Intent intent = new Intent(Intent.ACTION_VIEW);
 intent.setDataAndType(selectedUri, "resource/folder");
 startActivity(intent);