/*
* 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 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() );
setContentView(tv);
}
/* A native method that is implemented by the
* 'hello-jni' native library, which is packaged
* with this application.
*/
public native String stringFromJNI();
/* 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通过jin调用C示例
共50个文件
so:8个
class:5个
gdbserver:4个
需积分: 10 19 下载量 182 浏览量
2015-07-04
21:17:46
上传
评论
收藏 1.75MB RAR 举报
温馨提示
演示Android环境下C语言调用方法,Android通过jin调用C代码,jin作为中介实现Android与C语言交互。JIN中提供给Android调用的接口不必与C中的接口名称一致
资源推荐
资源详情
资源评论
收起资源包目录
HelloJni.rar (50个子文件)
HelloJni
bin
classes.dex 2KB
res
HelloJni.apk 1007KB
dexedLibs
classes
com
example
hellojni
BuildConfig.class 349B
HelloJni.class 955B
R$attr.class 346B
R.class 393B
R$string.class 404B
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 56KB
objs-debug
hello-jni
hello-jni.o.d 2KB
hello-jni.o 24KB
armeabi
libhello-jni.so 56KB
objs-debug
hello-jni
hello-jni.o.d 2KB
hello-jni.o 24KB
x86
libhello-jni.so 25KB
objs-debug
hello-jni
hello-jni.o.d 2KB
hello-jni.o 24KB
mips
libhello-jni.so 25KB
objs-debug
hello-jni
hello-jni.o.d 2KB
hello-jni.o 24KB
assets
gen
com
example
hellojni
BuildConfig.java 162B
R.java 395B
tests
default.properties 365B
src
com
example
hellojni
HelloJniTest.java 655B
AndroidManifest.xml 1KB
jni
Android.mk 748B
hello-jni.c 2KB
Application.mk 14B
HelloJni.cpp 18B
.settings
org.eclipse.jdt.core.prefs 177B
src
com
example
hellojni
HelloJni.java 2KB
.project 3KB
.cproject 4KB
.classpath 475B
project.properties 563B
AndroidManifest.xml 695B
libs
armeabi-v7a
gdbserver 384KB
gdb.setup 263B
libhello-jni.so 13KB
armeabi
gdbserver 384KB
gdb.setup 259B
libhello-jni.so 13KB
x86
gdbserver 609KB
gdb.setup 255B
libhello-jni.so 5KB
mips
gdbserver 649KB
gdb.setup 257B
libhello-jni.so 5KB
共 50 条
- 1
资源评论
brown_chen_001
- 粉丝: 0
- 资源: 7
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功