jstring Java_com_example_hellojni_HelloJni_stringFromJNI
来源:互联网 发布:淘宝订单监控 编辑:程序博客网 时间:2024/05/16 06:57
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"); }}
/* * 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. * */#include <string.h>#include <jni.h>/* This is a trivial JNI example where we use a native method * to return a new VM String. See the corresponding Java source * file located at: * * apps/samples/hello-jni/project/src/com/example/hellojni/HelloJni.java */jstringJava_com_example_hellojni_HelloJni_stringFromJNI( JNIEnv* env, jobject thiz ){ return (*env)->NewStringUTF(env, "Hello from JNI !");}
# 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.
#
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := hello-jni
LOCAL_SRC_FILES := hello-jni.c
include $(BUILD_SHARED_LIBRARY)
- jstring Java_com_example_hellojni_HelloJni_stringFromJNI
- jstring
- JNI jstring
- jstring 和 char* 转换
- jstring 和 char* 互转
- jstring to char*
- jstring 转换为 char *
- JNI中jstring操作
- char* 和jstring转换
- jstring to char*
- JNI unicode jstring to char*
- JNI unicode jstring to char*
- jstring, String, char* 变换函数
- jni converting jstring to char *
- JNI中的string返回jstring
- char* const char* jstring转换
- jstring 和char* 之间的转换方法
- jni jstring 、char* 类型的转换
- Region Style in OA Framework
- Android优化技巧
- 线性(时不变)系统 非线性系统
- Google、Baidu、FB股权分配
- linux内核之中断
- jstring Java_com_example_hellojni_HelloJni_stringFromJNI
- IBM的LPI复习资料之LPI101-Topic102:Linux安装和包管理(3)管理动态链接库(查找和加载程序需要的动态链接库文件)
- spring报错Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace
- 恢复被GHOST格式化了整个硬盘的分区及数据的经验
- poj2362
- 出错:PhoneFactory.getDefaultPhone must be called from Looper thread
- 选择法降序与折半查找法
- delete 与 delete[] 的区别
- VC++获取屏幕大小第三篇 物理大小GetDeviceCaps 下