/*
* Copyright (C) 2009 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.example.hellojni;
import com.example.jni.JNI;
import android.app.Activity;
import android.widget.TextView;
import android.os.Bundle;
public class HelloJni extends Activity
{
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
/* Create a TextView and set its content.
* the text is retrieved by calling a native
* function.
*/
TextView tv = new TextView(this);
//tv.setText( stringFromJNI("abc") );
tv.setText(JNI.stringFromJNI());
setContentView(tv);
}
/* A native method that is implemented by the
* 'hello-jni' native library, which is packaged
* with this application.
*/
public native String stringFromJNI(String str);
/* This is another native method declaration that is *not*
* implemented by 'hello-jni'. This is simply to show that
* you can declare as many native methods in your Java code
* as you want, their implementation is searched in the
* currently loaded native libraries only the first time
* you call them.
*
* Trying to call this function will result in a
* java.lang.UnsatisfiedLinkError exception !
*/
public native String unimplementedStringFromJNI();
/* this is used to load the 'hello-jni' library on application
* startup. The library has already been unpacked into
* /data/data/com.example.hellojni/lib/libhello-jni.so at
* installation time by the package manager.
*/
static {
System.loadLibrary("hello-jni");
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
Android NDK编程hello-jni代码
共63个文件
so:8个
class:8个
java:6个
5星 · 超过95%的资源 需积分: 16 42 下载量 8 浏览量
2014-10-24
16:22:40
上传
评论 1
收藏 1.62MB ZIP 举报
温馨提示
Android NDK编程,我的第一个hello-jni程序,如何调用自己编译的so库 博客地址:http://blog.csdn.net/dqksky/article/details/40425977
资源推荐
资源详情
资源评论
收起资源包目录
hello-jni.zip (63个子文件)
hello-jni
bin
classes.dex 2KB
res
HelloJni.apk 742KB
dexedLibs
classes
com
example
hellojni
BuildConfig.class 349B
HelloJni.class 1020B
R$attr.class 346B
R.class 393B
R$string.class 404B
jni
JNI.class 465B
resources.ap_ 1KB
AndroidManifest.xml 695B
res
drawable-ldpi
drawable-hdpi
drawable-xhdpi
values
strings.xml 110B
drawable-mdpi
layout
obj
local
armeabi-v7a
libhello-jni.so 80KB
libstdc++.a 8B
objs-debug
hello-jni
hello-jni.o.d 1KB
hello-jni.o 52KB
armeabi
libhello-jni.so 80KB
libstdc++.a 8B
objs-debug
hello-jni
hello-jni.o.d 1KB
hello-jni.o 52KB
x86
libhello-jni.so 48KB
libstdc++.a 8B
objs-debug
hello-jni
hello-jni.o.d 1KB
hello-jni.o 51KB
mips
libhello-jni.so 48KB
libstdc++.a 8B
objs-debug
hello-jni
hello-jni.o.d 1KB
hello-jni.o 51KB
assets
gen
com
example
hellojni
BuildConfig.java 162B
R.java 395B
tests
bin
res
classes
com
example
hellojni
tests
BuildConfig.class 361B
HelloJniTest.class 672B
AndroidManifest.xml 1KB
res
drawable-ldpi
drawable-hdpi
drawable-xhdpi
values
drawable-mdpi
layout
assets
gen
com
example
hellojni
tests
BuildConfig.java 168B
.settings
org.eclipse.jdt.core.prefs 177B
src
com
example
hellojni
HelloJniTest.java 655B
.project 841B
.classpath 475B
project.properties 563B
AndroidManifest.xml 1KB
jni
hello-jni.cpp 1KB
Android.mk 748B
Application.mk 14B
HelloJni.cpp 18B
.settings
org.eclipse.jdt.core.prefs 177B
src
com
example
hellojni
HelloJni.java 2KB
jni
JNI.java 173B
.project 1KB
.cproject 4KB
.classpath 475B
project.properties 563B
AndroidManifest.xml 695B
libs
armeabi-v7a
gdbserver 259KB
gdb.setup 235B
libhello-jni.so 13KB
armeabi
gdbserver 259KB
gdb.setup 231B
libhello-jni.so 13KB
x86
gdbserver 609KB
gdb.setup 227B
libhello-jni.so 5KB
mips
gdbserver 433KB
gdb.setup 229B
libhello-jni.so 5KB
共 63 条
- 1
资源评论
- yunjinwang2016-09-14学习并使用了,值得参考。
- etunjour2015-04-28对于初次上手JNI,有一定参考和学习价值
SkyKai_Dev
- 粉丝: 25
- 资源: 5
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功