调用本地新浪微博客户端分享内容到微博

不用OAuth认证!

不用下载新浪微博SDK!

不用写复杂的代码!

 

十几行代码,直接分享!

你没有听错!

你没有听错!

 

private void share(){
    	Intent intent=new Intent(Intent.ACTION_SEND);   
        intent.setType("image/*");   
        intent.putExtra(Intent.EXTRA_TEXT, "文本");    
        intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new File("/sdcard/aaa.jpg")));    
		intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);  
		
		Context context = null;
		
		try{
			context=createPackageContext("com.sina.weibo", Context.CONTEXT_IGNORE_SECURITY);
			intent.setClassName(context, "com.sina.weibo.EditActivity");  
			
			startActivity(intent);
		}catch (ActivityNotFoundException  e){
			Toast.makeText(getApplicationContext(), "您的手机没有安装新浪微博客户端", Toast.LENGTH_LONG).show();
		} catch (NameNotFoundException e) {
			e.printStackTrace();
		}
    }
posted @ 2012-08-22 12:57  ihou  阅读(2423)  评论(0编辑  收藏  举报