2017-02-13 13 views
0

私は動作送信を使用してファイルを送信するアプリケーションを作成しました.1時間後にコードが機能しません。androidでファイルを共有するには

他のアプリを開くと、shareItとbluetoothファイルのiamafileに「このようなコンテンツタイプの転送はサポートされていません」というエラーが表示されます...ここにコードがありますが、作業。 plsヘルプ

File root = new File(Environment.getExternalStorageDirectory(), "/QuizApp/MyAnswer/"+sharedPreferenceUsername +"/"+ editTitle); 
         Uri uri = Uri.fromFile(root); 


         Intent intent = new Intent(); 
         intent.setAction(Intent.ACTION_SEND); 

         intent.setType("*/*"); 
         intent.putExtra(Intent.EXTRA_STREAM, uri); 

         startActivity(intent); 

途中でeditTitleがファイルです。

答えて

0

私はこれが複数のビデオファイルのために働いています。あなたは、あなたのニーズに合致するようにいくつかの行を変更することができます。

申し訳ありませんが、kotlinで書かれていますが、十分理解できると思います。

val sharingIntent = Intent(Intent.ACTION_SEND_MULTIPLE) 
     val files = ArrayList<Uri>() 
     files.add(<first file URI>) 
    ... 
     files.add(<n th file URI>) 
     //here set the type wanted. I think that */* is a bad idea because the app could catch it even if the type is not good 
     sharingIntent.type = "video/*" 
     sharingIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, files) 
     sharingIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) 
     context.startActivity(sharingIntent) 
+0

ありがとうございます。私は何かを変更しなかったとしても、その奇妙なことが再び働いた – mime

関連する問題