使用此代码通过创建选择器共享音频文件但不起作用...
公共类 ActionDialog 扩展 Dialog {
static String sSongTitle="";
static String sSongPath = "";
static File fSongFile ;
public ActionDialog(final Context context, Message response) {
super(context);
// Inflate our UI from its XML layout description.
setContentView(R.layout.after_save_action);
setTitle(R.string.alert_title_success);
((Button)findViewById(R.id.button_share))
.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
Uri StringUri = Uri.fromFile(new File(sSongPath));
Intent intent = new Intent(android.content.Intent.ACTION_SEND, StringUri);
Intent in = new Intent(android.content.Intent.ACTION_SEND, StringUri, context, null);
intent.setType("audio/*");
startActivity(Intent.createChooser(in, "select any from the list:"));//getting error here as create method startActivity(Intent)
}
});
}
}