Share/Send Files to Google Drive via share-button - Android

ArrayList<Uri> fileURIs = [ uris of files in mobile device ]

Intent shareIntent = new Intent();
shareIntent.setAction( Intent.ACTION_SEND_MULTIPLE );
shareIntent.putExtra( Intent.EXTRA_SUBJECT, [ subject text ] );
shareIntent.putExtra( Intent.EXTRA_TEXT, [ contents text ] );
shareIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, fileURIs );
shareIntent.setType( "text/*" );    // set the type you want

// Google Drive package name : com.google.android.apps.docs
shareIntent.setPackage("com.google.android.apps.docs");

// It will start the Google Drive APP.
activity.startActivity( shareIntent );

留言

這個網誌中的熱門文章

7-ELEVEN 電子發票明細查詢方式

Java 使用 regular expression 正則表達,過濾特殊字元,反斜線處理重點

Ubuntu GUI中,無法啟動WIFI連結解決方法