gpt4 book ai didi

java - 如何在对话框子类内单击按钮时使用“创建选择器”

转载 作者:行者123 更新时间:2023-12-01 04:13:33 28 4
gpt4 key购买 nike

使用此代码通过创建选择器共享音频文件但不起作用...

公共(public)类 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)

}
});
}

}

最佳答案

你的 Intent 是 Intent 而不是ishareUri 是 stringUri 但你提到 ed 为 StringUri..你可以发布完整的代码..以查看错误(如果有)

关于java - 如何在对话框子类内单击按钮时使用“创建选择器”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19653566/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com