【Android】通过URI启动应用程序
16lz
2021-01-23
一、 设置步骤
1. AndroidManifest.xml文件中,进行如下设置
2. 代码中进行如下调用 Intent it = new Intent(Intent.ACTION_SEND);int iLatitude = (int)(dLatitude * 100000);int iLongtitude = (int)(dLongitude * 100000);// 需要添加latlong.jsp,否则后面无法添加参数成为一个链接地址String strLinkMap = "http://huntshe.com/latlong.jsp?LAT="+ dLatitude + "&LONG=" + dLongitude;String strUri = "您的朋友与您分享一个位置:\n" + "纬度 " + iLatitude + " 经度 " + iLongtitude +"\n点击启动程序:" + strLinkMap +"\n您需要先下载寻她地图:http://a.app.qq.com/o/simple.jsp?pkgname=com.android.realize.huntshe";it.putExtra(Intent.EXTRA_TEXT, strUri); it.setType("text/plain");startActivity(Intent.createChooser(it, "将短串分享到"));
二、 效果展示
1. 程序中点击按钮,发送短串
2. 点击讯息功能
3. 点击“点击启动程序” 后面的链接
更多相关文章
- 图片拖动功能实现
- Android平台上实现图片的缩放,圆角,倒影效果
- android读取图片
- Android 使用Glide实现圆形和圆角图片
- 2012-7-20 android 图片叠加效果——两种方法
- 编写第一个Android程序
- Android Activity中启动另一应用程序的方法