gpt4 book ai didi

安卓分享文字链接使用 Intent 到LINE APP

转载 作者:太空狗 更新时间:2023-10-29 15:01:40 73 4
gpt4 key购买 nike

我有一个问题。

我需要使用 intent 将链接文本分享到 Android 中的 LINE App。

但我不知道如何将超链接文本分享到 Line。

我知道分享文字到LINE消息。下面:

intent.setAction(Intent.ACTION_SEND);
intent = mContext.getPackageManager().getLaunchIntentForPackage(
AppConfig.LINE_PACKAGE_NAME);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_TEXT, "this is share text but I want to set hyperlink");
mContext.startActivity(intent);

有谁知道如何设置文本链接(例如:链接到 www.google.com)使用 intent 并分享到 Android 中的 LINE App?

非常感谢。

最佳答案

public static void openLine(Context context, String number, String msg) {
try {
final String appName = "jp.naver.line.android";
final boolean isAppInstalled = isAppAvailable(context, appName);
if (isAppInstalled) {
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.setData(Uri.parse("line://msg/text/" + msg));
context.startActivity(intent);
} else {
Toast.makeText(context, "Line not Installed", Toast.LENGTH_SHORT).show();
}
} catch (Exception e) {
Log.e("ERROR LINE", e.toString());
Toast.makeText(context, "Line not installed in your device", Toast.LENGTH_LONG).show();
}
}

关于安卓分享文字链接使用 Intent 到LINE APP,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25936838/

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