- 分享
public class ShareUtils {
public static void share(Context context, String shareText) {
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_TEXT, shareText);
context.startActivity(Intent.createChooser(intent, "分享分享"));
}
}
shareText里填充文字, url等内容;
2.在浏览器中打开网络链接
public static void openUrl(Context context, String url) {
Uri uri = Uri.parse(url);
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
context.startActivity(intent);
}
网友评论