Jni知识翻看之前博客。直接上代码
1、Java层代码
public class AppActivity extends Cocos2dxActivity{
public static Activity acty;
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
acty = this;
}
static {
System.loadLibrary("cocos2dcpp");
}
public static void Share(){
new Thread(new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
Intent intent = new Intent("android.intent.action.SEND");
intent.setType("image/*");
intent.putExtra(Intent.EXTRA_SUBJECT,"我的分享");
intent.putExtra(Intent.EXTRA_TEXT,"分享完成");
intent.putExtra(
Intent.EXTRA_STREAM,Uri.parse(""));//要分享的文件路径
acty.startActivity(Intent.createChooser(intent,"分享"));
}
}).start();
}
}
2、Jni层代码与C++层代码
与上篇博客代码一样。http://blog.csdn.net/yuxikuo_1/article/details/40711875。注意加上平台判断。Jni知识自行百度。