Cannot share audio file with android app -


So I have this app, and when you press a button, it allows you to choose a file, And whatever it shares, the apps that allow sharing (preferably Google drive)

However, I am able to choose only one file, and the app has not been selected so that I can send the file Let's choose an app.

In addition, the file is also saved in .3gpp format.

My code:

  import java.util.List; Import android.os.build; Importroid.os.Bundle; Import android.app.ActionBar; Import android App Import android.content.Intent; Import android.content.pm.PackageManager; Import android.content.pm.ResolveInfo; Import android.view.KeyEvent; Import android.view.Menu; Import android.view.View; Import android.view.View.OnClickListener; Import android.widget.Button; Public class Main activity enhances the activity (button Camera button button Rikordsoundbtn button Launch Gallery button Odiowuar: @ Override protected void saved create (bundled Instansstet) {Suprknkret (saved Instensstet); setContentView (R.layout .activity_main); Cameratton = (find button) VBiID (RID Camerabatan); // Create button and check for ID camera button Button onClicklist (new onclicklist) () {@ Override Public Wide onclick onclick (View v) {// TODO Auto-generated method stub Lepano ();}}); Rikardsoundbtn = (Button) searching for Vibibaiaidi (Arkaidikrekordsoundbtn); Rikardsoundbutn Ksetonkliklaistr (new Onkliklistr () {@ override Public wide onclick onclick (View v) {// Todo Auto-generated method stub Opanaprekordsound ();} // End Opanrkrord sound}); // and record sound button listener Onc gallery = (Button) findViewById (R.id.PhotoViewer); launchGallery.setOnClickListener (new OnClickListener) {@Override public void Click (See ARG0) {// TODO Auto-generated method stub Loncapapeho Gallery ();}} ); // End Launch Gallery Button Listener Audioviewer = (Button) findViewById (R) .id.AudioViewer); AudioViewer.setOnClickListener (new OnClickListener () {@Override public void onClick (View v) {// TODO Auto-generated method stub LaunchFileManager ();} // Click on the end)}; // End Audio viewer listener // make sure we are running on Honeycomb or higher to use ActionBar API if (Build.VERSION.SDK_INT & for gt; = Build.VERSION_CODES.HONEYCOMB) {// main activity, Make sure that the action icon does not behave in the // action bar as a button actionbase = action button = getActionBar (); actionBar.setHomeButtonEnabled (wrong); } // end at end}} // Public vs OpenUpRecordSound () {startActivity (New Intent (MainActivity.This, RecordASound.class)); } // And Open UpRecord Sound Public Zero Lepepo () {// Fire the camera app on the phone Intent i = new Intent (); I.setAction (Intent.ACTION_CAMERA_BUTTON); I.putExtra (Intent.EXTRA_KEY_EVENT, New KeyEvent (KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_CAMERA)); Sendorderbreadcast (I, blank); // Make sure there is a camera app on the phone! PackageManager packageManager = getPackageManager (); & Lt; ResolveInfo & gt; Activities = PackageManager.CarIententitatives (I, 0); Boolean isIntentSafe = activities.size () & gt; 0; // Start an activity if it's safe (ifIntentSafe) {startActivity (i); } // end if} // end takeaphoto public void LaunchUpAPhotoGallery () {intention intended = new intent (Intent.ACTION_VIEW); intent.setType ("image / *"); StartActivity; } // End Photo Launcher handler ant public void LaunchFileManager () Intentionally intended = new intention (); Intent.setAction (Intent.ACTION_GET_CONTENT); Intent.setType ("file / *"); StartActivity (Intent.createChooser (intent, "share sound file")); } // Launch File Manager @ Override Public Boolean On Crate Option Menu (Menu Menu) {// Expand Menu; It adds the item to the Action Bar if it exists GetMenuInflater (). Fulao (R. menu menu, menu); Back true; }}    

You must actually specify the file URI in your intent, for example For:

  intent to intent = new intent (int. Action_ VIEW); intent.setDataAndType (Uri.fromFile (soundFile), "audio / *"); StartActivity (Intent.createChooser (intent, "share sound file"));    

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -