package mobile.chgper;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import android.app.Activity;
import android.os.Bundle;
public class ChgperActivity extends Activity {
static{
copyLibToData("chgperjni");
System.loadLibrary("chgperjni");
}
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
startPerService();
}
public native int startPerService();
public native int stopPerService();
/**
* chgperjni.so默认是在system/lib目录下,因此必须拷贝到data/data/mobile.chgper/lib
* @param fileName
*/
private static void copyLibToData(String fileName) {
File filePcLib = new File("data/data/mobile.chgper/lib");
if (!filePcLib.exists()) {
filePcLib.mkdir();
}
if(filePcLib.isFile()){
filePcLib.delete();
filePcLib.mkdir();
}
File fileLib = new File("system/lib/" + fileName + ".so");
if (!fileLib.exists()) {
return;
}
filePcLib = new File("data/data/mobile.chgper/lib/lib" + fileName + ".so");
if (filePcLib.exists()) {
filePcLib.delete();
}
try {
filePcLib.createNewFile();
FileInputStream fileIS = new FileInputStream(fileLib);
FileOutputStream fos = new FileOutputStream(filePcLib);
byte[] buffer = new byte[1024];
int count = 0;
while ((count = fileIS.read(buffer)) >= 0) {
fos.write(buffer, 0, count);
}
fileIS.close();
fos.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
Chgper.rar (31个子文件)
chgperjni
inc
properties.h 4KB
Android.mk 298B
chgperjni.c 373B
chgperexe
openper.c 119B
Android.mk 247B
Chgper
bin
classes.dex 2KB
Chgper.apk 14KB
res
drawable-ldpi
ic_launcher.png 2KB
drawable-hdpi
ic_launcher.png 4KB
drawable-mdpi
ic_launcher.png 2KB
classes
mobile
chgper
R$layout.class 379B
R$drawable.class 392B
R$attr.class 325B
R.class 459B
R$string.class 412B
ChgperActivity.class 2KB
resources.ap_ 10KB
res
drawable-ldpi
ic_launcher.png 2KB
drawable-hdpi
ic_launcher.png 4KB
values
strings.xml 178B
drawable-mdpi
ic_launcher.png 3KB
layout
main.xml 398B
assets
gen
mobile
chgper
R.java 642B
proguard.cfg 1KB
Android.mk 301B
src
mobile
chgper
ChgperActivity.java 2KB
.project 842B
Android.mk.bak 628B
.classpath 364B
project.properties 360B
AndroidManifest.xml 778B
共 31 条
- 1
goleftgoright
- 粉丝: 35
- 资源: 17
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- MEM2307-VB一款SOT23封装P-Channel场效应MOS管
- 逐次分半积分实验.wps
- MEM2303XG-VB一款P-Channel沟道SOT23的MOSFET晶体管参数介绍与应用说明
- MEM2303-VB一款P-Channel沟道SOT23的MOSFET晶体管参数介绍与应用说明
- 1_base.apk.1
- 基于FPGA深度学习的9I2C 读写 RTC 时钟实验,适合FPGA初学者
- MEM2303M3G-VB一款P-Channel沟道SOT23的MOSFET晶体管参数介绍与应用说明
- MEM2302XG-VB一款N-Channel沟道SOT23的MOSFET晶体管参数介绍与应用说明
- manage.py 相对路径
- 数据库设计课程设计-高校选课管理系统免费提供
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
- 3
- 4
- 5
- 6
前往页