Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

how to select a audio from android programmaticly

You can put below codes in your project when you want to select audio.

Intent intent_upload = new Intent();
intent_upload.setType("audio/*");
intent_upload.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(intent_upload,1);
And override onActivityResult in the same Activity, as below

@Override 
protected void onActivityResult(int requestCode,int resultCode,Intent data){

  if(requestCode == 1){

    if(resultCode == RESULT_OK){

        //the selected audio.
        Uri uri = data.getData(); 
    }
  }
  super.onActivityResult(requestCode, resultCode, data);
}
Comment

PREVIOUS NEXT
Code Example
Java :: arraycopy merging arrays 
Java :: error: package android.support.v4.content does not exist import android.support.v4.content.LocalBroadcastManager; 
Java :: set maven goals in eclipse 
Java :: 2d matrix multiplication 
Java :: Show the difference between this() and super() with help of a code 
Java :: springboot request list 
Java :: viewresolver in spring boot 
Java :: java thyemleaf save table form to database 
Java :: zweidimensionales array erstellen java 
Java :: java nom de la methode actuel 
Java :: Performance data in appium 
Java :: java operations on classes 
Java :: unlock the screen 
Java :: java 2d array previous object 
Java :: import txt.xz file to android studio app 
Java :: install the app from assest of other app 
Java :: gradle use local path 
Java :: matrix program 
Java :: BasicAWSCredentials 
Java :: reader java 
Java :: difido 
Java :: turn on device location android programmatically 
Java :: java to exe 
Java :: start with < and end with < in Java 
Java :: asserttrue in selenium java 
Java :: int to byte calculator 
Java :: how to get index of while loop java 
Java :: search in jdbc 
Java :: priority queue is empty java 
Java :: 2 multiples 
ADD CONTENT
Topic
Content
Source link
Name
4+3 =