Back to project page Music-Share-Android.
The source code is released under:
GNU General Public License
If you think the Android project Music-Share-Android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.weibo.sdk.android.api; /*from w ww.j a v a 2s.c o m*/ import java.net.URLEncoder; import android.app.Activity; import android.content.Intent; import android.net.Uri; public class ActivityInvokeAPI { /** * ???????????????????????????????????????? * @param activity * @param content ?????? */ public static void openSendWeibo(Activity activity,String content){ if(activity==null||null==content){ return; } Intent intent=new Intent(); intent.setAction(Intent.ACTION_VIEW); intent.addCategory("android.intent.category.DEFAULT"); intent.setData(Uri.parse("sinaweibo://sendweibo?content="+URLEncoder.encode(content))); activity.startActivity(intent); } /** * ???????????????????????????????????????? * @param activity * @param content ?????? * @param xid ??? ???id * @param poiId POI?ID * @param poiName POI????? * @param longitude ??? * @param latitude ?? */ public static void openSendWeibo(Activity activity,String content,String xid,String poiId,String poiName,String longitude,String latitude){ if(activity==null){ return; } Intent intent=new Intent(); intent.setAction(Intent.ACTION_VIEW); intent.addCategory("android.intent.category.DEFAULT"); intent.setData(Uri.parse("sinaweibo://sendweibo?content="+content+"&xid="+xid+"&poiid="+poiId+"&poiname="+poiName+"&longitude="+longitude+"&latitude="+latitude)); activity.startActivity(intent); } /** * ????????????????? * @param activity */ public static void openNearbyPeople(Activity activity){ if(activity==null){ return; } Intent intent=new Intent(); intent.setAction(Intent.ACTION_VIEW); intent.addCategory("android.intent.category.DEFAULT"); intent.setData(Uri.parse("sinaweibo://nearbypeople")); activity.startActivity(intent); } /** * ???????????????????? * @param activity */ public static void openNearbyWeibo(Activity activity){ if(activity==null){ return; } Intent intent=new Intent(); intent.setAction(Intent.ACTION_VIEW); intent.addCategory("android.intent.category.DEFAULT"); intent.setData(Uri.parse("sinaweibo://nearbyweibo")); activity.startActivity(intent); } /** *???? ?????????? * @param activity * @param nickName ?? */ public static void openUserInfoByNickName(Activity activity,String nickName){ if(activity==null){ return; } Intent intent=new Intent(); intent.setAction(Intent.ACTION_VIEW); intent.addCategory("android.intent.category.DEFAULT"); // intent.setData(Uri.parse("sinaweibo://userinfo?nick="+URLEncoder.encode(nickName))); intent.setData(Uri.parse("sinaweibo://userinfo?nick="+nickName)); activity.startActivity(intent); } /** * ??uid?????????? * @param activity * @param uid */ public static void openUserInfoByUid(Activity activity,String uid){ if(activity==null){ return; } Intent intent=new Intent(); intent.setAction(Intent.ACTION_VIEW); intent.addCategory("android.intent.category.DEFAULT"); intent.setData(Uri.parse("sinaweibo://userinfo?uid="+uid)); activity.startActivity(intent); } /** * ??????????????? * @param activity * @param url ??????????? */ public static void openWeiboBrowser(Activity activity,String url){ if(activity==null){ return; } Intent intent=new Intent(); intent.setAction(Intent.ACTION_VIEW); intent.addCategory("android.intent.category.DEFAULT"); intent.setData(Uri.parse("sinaweibo://browser?url="+url)); activity.startActivity(intent); } /** * ????????? * @param activity */ public static void openWeibo(Activity activity){ if(activity==null){ return; } Intent intent=new Intent(); intent.setAction(Intent.ACTION_VIEW); intent.addCategory("android.intent.category.DEFAULT"); intent.setData(Uri.parse("sinaweibo://splash")); activity.startActivity(intent); } /** * ????????? * @param activity */ public static void openShake(Activity activity){ if(activity==null){ return; } Intent intent=new Intent(); intent.setAction(Intent.ACTION_VIEW); intent.addCategory("android.intent.category.DEFAULT"); intent.setData(Uri.parse("sinaweibo://shake")); activity.startActivity(intent); } /** * ????????? * @param activity */ public static void openContact(Activity activity){ if(activity==null){ return; } Intent intent=new Intent(); intent.setAction(Intent.ACTION_VIEW); intent.addCategory("android.intent.category.DEFAULT"); intent.setData(Uri.parse("sinaweibo://contact")); activity.startActivity(intent); } /** * ????????????? * @param activity * @param uid ??uid */ public static void openUserTrends(Activity activity,String uid){ if(activity==null){ return; } Intent intent=new Intent(); intent.setAction(Intent.ACTION_VIEW); intent.addCategory("android.intent.category.DEFAULT"); intent.setData(Uri.parse("sinaweibo://usertrends?uid="+uid)); activity.startActivity(intent); } /** * ???????????? * @param activity * @param uid ??uid */ public static void openMessageListByUid(Activity activity,String uid){ if(activity==null){ return; } Intent intent=new Intent(); intent.setAction(Intent.ACTION_VIEW); intent.addCategory("android.intent.category.DEFAULT"); intent.setData(Uri.parse("sinaweibo://messagelist?uid="+uid)); activity.startActivity(intent); } /** * ???????????? * @param activity * @param uid ??uid */ public static void openMessageListByNickName(Activity activity,String nickName){ if(activity==null){ return; } Intent intent=new Intent(); intent.setAction(Intent.ACTION_VIEW); intent.addCategory("android.intent.category.DEFAULT"); intent.setData(Uri.parse("sinaweibo://messagelist?nick="+(nickName))); activity.startActivity(intent); } /** * ????????????? * @param activity * @param blogId ?????????id */ public static void openDetail(Activity activity,String blogId){ if(activity==null){ return; } Intent intent=new Intent(); intent.setAction(Intent.ACTION_VIEW); intent.addCategory("android.intent.category.DEFAULT"); intent.setData(Uri.parse("sinaweibo://detail?mblogid="+blogId)); activity.startActivity(intent); } }