Android 常用开源库

来源:互联网 发布:广告市场有多大 知乎 编辑:程序博客网 时间:2024/05/20 06:56

1.网络

  • volley

volley https://github.com/google/volley
缺点:上传文件 、session 处理、大数据量处理不适合使用

  • async-http

async-http

https://github.com/loopj/android-async-http

处理cookie

 public static  void post(String url,RequestParams params,JsonHttpResponseHandler responseHandler){        AsyncHttpClient client = new AsyncHttpClient();        //保存cookie,自动保存到了shareprefercece        PersistentCookieStore myCookieStore = new PersistentCookieStore(Application.mInstance);        client.setCookieStore(myCookieStore);        if(params == null){            params =  new RequestParams();        }                List<Cookie> cookies = myCookieStore.getCookies();            int  size =cookies.size();            if(size>0){                BasicCookieStore bcs = new BasicCookieStore();                bcs.addCookies(cookies.toArray(                        new Cookie[cookies.size()]));                client.setCookieStore(bcs);            }        try {            client.post(url, params, responseHandler);        } catch (Exception e) {            e.printStackTrace();            responseHandler.onFailure(-1, new Header[]{}, new Throwable(e.getMessage()), new JSONObject());        }    }

上传图片:

   List<File> images        if (images != null) {            for (int i = 0; i < images.size(); i++) {                File file = images.get(i);                try {                    params.put("img_file[" + i + "]", file, "image/png");                } catch (FileNotFoundException e) {                    failuredListener.onRespone("file not found", -1);                    return;                }            }        }
  • okhttp

https://github.com/square/okhttp

2.导航指示器

  • viewpagerindicator
    https://github.com/hackware1993/MagicIndicator

  • ViewPagerIndicator
    https://github.com/JakeWharton/ViewPagerIndicator

3.跑马灯

俗名:可垂直跑、可水平跑的跑马灯;学名:可垂直翻、可水平翻的翻页公告

https://github.com/sfsheng0322/MarqueeView

4.侧滑菜单

slidingMenu_library

https://github.com/jfeinstein10/SlidingMenu

5.黄油刀

butterknife

https://github.com/JakeWharton/butterknife

6.dialog

  • material-dialogs

https://github.com/afollestad/material-dialogs

  • sweet-alert-dialog

https://github.com/pedant/sweet-alert-dialog

7.EventBu

EventBu

https://github.com/greenrobot/EventBus

8.图片

  • glide

https://github.com/bumptech/glide

  • Android-Universal-Image-Loader

https://github.com/nostra13/Android-Universal-Image-Loader

9.扫码

BGAQRCode-Android
https://github.com/bingoogolapple/BGAQRCode-Android

10.轮播图

android-auto-scroll-view-pager
https://github.com/Trinea/android-auto-scroll-view-pager/

11.Json解析

  • fastjson

https://github.com/alibaba/fastjson

  • gson

https://github.com/google/gson

12.下拉刷新

  • com.navercorp.pulltorefresh

    compile ‘com.navercorp.pulltorefresh:library:3.2.0@aar’

  • CommonPullToRefresh
    https://github.com/Chanven/CommonPullToRefresh

13.数据库

LitePal

https://github.com/LitePalFramework/LitePal

14.logger

logger

https://github.com/orhanobut/logger

15.内存泄漏检测

leakcanary

https://github.com/square/leakcanary

原创粉丝点击