摘要:
问题描述: 使用FileOutputStream,根据文档上看,new FileOutputStream(path),如果path路径下的文件不存在,则自动创建新的文件。 但是在使用过程中,path = Environment.getExternalStorageDirectory().ge...
阅读全文
posted @ 2015-07-28 09:51
Ivan Aldrich
阅读(5928)
推荐(0)
摘要:
1、写了个简单的方法,打算从c中返回一个字符串。c中代码为:JNIEXPORT jstring JNICALL Java_com_example_jnitest_getstring (JNIEnv *e, jclass j) { return "from jni"; } java中...
阅读全文
posted @ 2015-06-04 11:11
Ivan Aldrich
阅读(154)
推荐(0)
摘要:
private static final int STREAM_BUFFER_LENGTH = 1024;private static final String ALGORITHM_MD5 = "MD5";public static String md5File(File file) { ...
阅读全文
posted @ 2015-04-23 18:03
Ivan Aldrich
阅读(508)
推荐(0)
摘要:
自定义的一个ListView放到布局文件中,设置width=match_parent,height=wrap_content。设置数据后执行notifyDatasetChanged。可以确定数据发生了变化,但是没有进入到getView中刷新数据。经过尝试,设置height为match_parent之...
阅读全文
posted @ 2015-03-20 10:55
Ivan Aldrich
阅读(389)
推荐(0)
摘要:
1 Intent intent = new Intent(Intent.ACTION_GET_CONTENT);2 intent.setType("audio/*");3 startActivity(Intent.createChooser(intent, "Select music"));
阅读全文
posted @ 2015-01-27 20:07
Ivan Aldrich
阅读(444)
推荐(0)
摘要:
在adapter中有mDatas。需要在EditText编辑完之后,将新的值赋给mDatas中。之前的做法,继承实现了一个TextWatcher类,构造函数中获得当前被点击item的position。然后mDatas.get(position).setValue(s.toString());可是不知...
阅读全文
posted @ 2015-01-27 19:40
Ivan Aldrich
阅读(456)
推荐(0)
摘要:
问题描述: 在ListView中,点击EditText获得焦点时,会重新调用getView,此时EditText会失去焦点。方案:定义一个全局的mCurrentIndex,记录刷新前是哪一项被点击量。给EdtiText设置onTouchListener,在这里设置mCurrentIndex的值。然后...
阅读全文
posted @ 2015-01-23 15:21
Ivan Aldrich
阅读(2220)
推荐(0)
摘要:
在activity2中弹出来软键盘,点击返回后,进入activity1,里面也有edittext,这样的话软键盘还是会显示在那里,有时挺影响体验的。可以在返回事件中添加这样一个方法:private void closeSoftInput() { InputMethodManager imm ...
阅读全文
posted @ 2015-01-23 14:45
Ivan Aldrich
阅读(126)
推荐(0)
摘要:
调用手机默认的浏览器:1 Intent intent = new Intent();2 intent.setAction("android.intent.action.VIEW");3 Uri targetUrl = Uri.parse("http://www.cnblogs.com/ivan-al...
阅读全文
posted @ 2015-01-15 22:40
Ivan Aldrich
阅读(303)
推荐(0)
摘要:
有时候项目中进行时间设置时,只需要设置年/或月/或日。这时候就需要对相应的部分进行隐藏。1 DatePicker datePk = (DatePicker) findViewById(R.id.dp_date);2 // 获取到年/月/日所在的组件群3 ViewGroup targetGroup =...
阅读全文
posted @ 2015-01-15 22:34
Ivan Aldrich
阅读(977)
推荐(0)