Created
March 4, 2014 17:27
-
-
Save Corikachu/9351335 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.testap; | |
import android.os.Bundle; | |
import android.provider.MediaStore; | |
import android.app.Activity; | |
import android.content.Intent; | |
import android.content.pm.PackageManager; | |
import android.view.Menu; | |
import android.view.View; | |
import android.widget.Button; | |
public class MainActivity extends Activity { | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); | |
Button btn = null; | |
btn = (Button)findViewById(R.id.button1); | |
btn.setOnClickListener(new View.OnClickListener() { | |
@Override | |
public void onClick(View v) { | |
Intent intent = new Intent(); | |
intent.setAction(Intent.ACTION_GET_CONTENT); | |
intent.setType("audio/*"); | |
//intent.addCategory(Intent.CATEGORY_APP_MUSIC); 이건 ACTION_MAIN으로 지정해야 사용가능하다 | |
Intent chooser = Intent.createChooser(intent, "cho"); | |
startActivity(chooser); | |
} | |
}); | |
} | |
@Override | |
public boolean onCreateOptionsMenu(Menu menu) { | |
// Inflate the menu; this adds items to the action bar if it is present. | |
getMenuInflater().inflate(R.menu.main, menu); | |
return true; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment