首页 > 移动平台 > 详细

安卓基础备忘

时间:2021-05-07 10:39:07      阅读:14      评论:0      收藏:0      [点我收藏+]

基础备忘

ViewPager

Android:ViewPage使用教程

常见报错

java.lang.IllegalArgumentException: pointerIndex out of range
The investigation found that this was a ViewPager of Android‘s bug, which occasionally happens when the user performs multitouch operations. The problem persists until at least Android 4.4. The solution is simple, overwriting the ViewPager‘s onTouchEvent and onInterceptTouchEvent methods, and the catch exception


 @Override
    public boolean onTouchEvent(MotionEvent ev) {
        try {
            return super.onTouchEvent(ev);
        } catch (IllegalArgumentException ex) {
            ex.printStackTrace();
        }
        return false;
    }
 
    @Override
    public boolean onInterceptTouchEvent(MotionEvent ev) {
        try {
            return super.onInterceptTouchEvent(ev);
        } catch (IllegalArgumentException ex) {
            ex.printStackTrace();
        }
        return false;
    }

FastJson

Java 语言 ArrayList 和 JSONArray 相互转换

//ArrayList 转成 JSONArray
      studentJsonArray = JSONArray.parseArray(JSON.toJSONString(studentList));
      System.out.println("\n方式 6: " + studentJsonArray.toJSONString());

//JSONArray 转成 ArrayList

        studentList = JSONArray.parseArray(studentJSONArray.toJSONString(), Student.class);
        studentList.forEach(student -> System.out.println("stundet info: " + student));

Java中用fastjson对String、JSONObject、JSONArray相互转换

安卓基础备忘

原文:https://www.cnblogs.com/sinjin/p/14737721.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!