摘要: 演示使用swig工具创建c语言的java接口,生成.so库和java接口文件。在此之前先要安装swig,安装方法:sudo apt-get install swig1.使用eclipse创建工程。 2.创建包名。3.在包中创建c文件和swig接口文件。文件内容:example.c /* File : example.c */ #include double My_variable = 3.0; int fact(int n) { if (n <= 1) return 1; else return n*fact(n-1); } int my_mod(int x, int... 阅读全文
posted @ 2014-02-28 17:06 ihou 阅读(782) 评论(0) 推荐(0) 编辑
摘要: 添加:android:launchMode="singleTask" 阅读全文
posted @ 2013-05-10 17:31 ihou 阅读(233) 评论(0) 推荐(0) 编辑
摘要: 1.如何获取Fragement的引用? Fragment fragement = getSupportFragmentManager(). findFragmentByTag("android:switcher:"+R.id.ViewPage+":" + selectTab); 这个Tag可以从FragmentPagerAdapter的源码中找到,如下: ... 阅读全文
posted @ 2012-09-12 14:43 ihou 阅读(11549) 评论(0) 推荐(0) 编辑
摘要: Handler是Android中非常重要的类之一,通过Handler可以实现主线程的延时操作和线程之间的通信,通过在子类中的Handle、和Looper可以很轻松的实现一个请求队列。 在写代码之前首先简要的说一下 Handler、Looper、MessageQuene之间的关系。 每一个线程最多有一个Looper、一个Looper里边含有一个MessageQuene。 Handler每次将消... 阅读全文
posted @ 2012-08-28 18:29 ihou 阅读(5574) 评论(0) 推荐(0) 编辑
摘要: 不用OAuth认证!不用下载新浪微博SDK!不用写复杂的代码!十几行代码,直接分享!你没有听错!你没有听错!private void share(){ Intent intent=new Intent(Intent.ACTION_SEND); intent.setType("image/*"); intent.putExtra(Intent.EXTRA_TEXT, "文本"); intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new File("/sdcard/aaa.jp... 阅读全文
posted @ 2012-08-22 12:57 ihou 阅读(2423) 评论(0) 推荐(0) 编辑
摘要: 举例scale动画 <scale android:duration="300" android:pivotX="100%" android:pivotY="0%" android:fromXScale="0.5" android:toXScale="1.0" android:fromYScale="0.5" android:toYScale="1.0" > </scale>android:pivotX="100%" 阅读全文
posted @ 2012-08-09 19:47 ihou 阅读(1036) 评论(0) 推荐(1) 编辑
摘要: 效果如下: 代码: 在drawable文件夹下创建文件repate_bk.xml repate_bk.xml <?xml version="1.0" encoding="utf-8"?> <bitmap xmlns:android="http://schemas.android.com/apk/res/android" android:src=... 阅读全文
posted @ 2012-06-13 10:58 ihou 阅读(271) 评论(0) 推荐(0) 编辑
摘要: ClipDrawable是Drawable的子类,利用它可以做一些简单的加载动画,只使用一张资源图,如下图这样: 很简单,不多说,看源码 源码: http://files.cnblogs.com/ihou/ClipDrawableDemo.rar 阅读全文
posted @ 2012-05-30 14:22 ihou 阅读(284) 评论(0) 推荐(0) 编辑
摘要: 从一个BroadcastReceiver的onReceive方法启动一个Activity通常需要在Intent里边添加一个Flag Intent.FLAG_ACTIVITY_NEW_TASK看文档:If set, this activity will become the start of a new task on this history stack. A task (from the activity that started it to the next task activity) defines an atomic group of activities that the user 阅读全文
posted @ 2012-05-16 18:18 ihou 阅读(1311) 评论(0) 推荐(0) 编辑
摘要: ArrayList提供了一个将List转为数组的一个非常方便的方法toArray。toArray有两个重载的方法:1.list.toArray();2.list.toArray(T[] a);对于第一个重载方法,是将list直接转为Object[] 数组;第二种方法是将list转化为你所需要类型的数组,当然我们用的时候会转化为与list内容相同的类型。不明真像的同学喜欢用第一个,是这样写:ArrayList<String> list=new ArrayList<String>(); for (int i = 0; i < 10; i++) { list.add(& 阅读全文
posted @ 2012-05-10 16:26 ihou 阅读(89839) 评论(7) 推荐(11) 编辑