随笔分类 - Android_常用代码片
项目中常用的,实用小工具代码片,精致而强悍。
摘要:com.imagepicker.ImagePickerModule package com.imagepicker; import android.app.Activity; import android.content.ActivityNotFoundException; import andro
阅读全文
摘要:1..播放res/raw 2.播放res/assets
阅读全文
摘要:Android code wiki Tip1: 类的全局静态变量的使用,这样可以静态变量只分配一次内存,可以不通过类的对象也就是可以通过类名直接使用该变量。(使用场景:Request_Code ,Result_Code,Log Tag,权限名字,Activity之间传递参数Name eg:bundl
阅读全文
摘要:屏蔽ScrollView滑动操作,如下,会用到ViewConfiguration这个类,这个类可以获取到用户是否为滑动操作的临界值。 代码如下:
阅读全文
摘要:Android生成桌面快捷方式的几种方法:
阅读全文
摘要:如下,用 JSONTokener 实现:
阅读全文
摘要:因为默认获取的不是真实宽高,是缩放比例的宽高
阅读全文
摘要:package com.edaixi.main.adapter; import android.content.Context; import android.support.v4.view.PagerAdapter; import android.text.TextUtils; import android.view.LayoutInflater; import android.view....
阅读全文
摘要:/** * Adapter for grid of coupons. */ private static class CouponAdapter extends BaseAdapter { private LayoutInflater mInflater; private List mAllCoupons; /**...
阅读全文
摘要:/* * Copyright (C) 2013 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You ma...
阅读全文
摘要:在Android开发中,大部分应用都是以用户为第一位,用户都有自己的个人中心,用来展示自己的信息,头像无疑是展示自己最直观的方式,随着各种政策的出台,实名认证,真人头像变得尤为重要,如果要求上传真人头像,那就需要后台做校验,判断是不是真人,如果真人审核,那工作量是非人力所能为的,这时候就用到各种识别
阅读全文
摘要:BigDecimal bd = new BigDecimal(0.0199999999999); System.out.println("res:"+bd.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()); DecimalFormat df = new DecimalFormat("#.00"); ...
阅读全文
摘要:/* * Copyright (C) 2012 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * Y...
阅读全文
摘要:public void showComplainDialog() { ComplainDialog complain_dialog = new ComplainDialog(OrderDetialActivity.this, R.style.customdialog_complain_style, R.layou...
阅读全文
摘要:ButterKnife,这个方便findViewById而使用的库,无数的应用在使用它,以注解来实现的他,对应用的性能影响几乎可以忽略,可以放心使用。 使用: 我们常用的无非就是: 其实他的功能远不仅仅如此,常用的还有下面点是你需要知道的。 1.对多个view的点击事件监听: 2.长按以及选中Ite
阅读全文
摘要:代码如下: From:http://hannesdorfmann.com/android/adapter-delegates
阅读全文
摘要:/** * 安装APK文件 */ private void installApk() { File apkfile = new File(mSavePath,Constant.appFileName); if (!apkfile.exists()) { return; } // 通过Intent安装
阅读全文
摘要:WindowManger wm =(WindowManger)context.getSystemService(Context.WINDOW_SERVICE); View view = Toast.makeText(context,text,Toast.LENGTH_SHORT).getView(); //设置布局参数 WindowManger.LayoutParams params = ...
阅读全文
摘要:package com.dexode.fragment; import android.annotation.TargetApi; import android.app.Activity; import android.os.Build; import android.os.Bundle; import android.os.Handler; import android.support.v...
阅读全文
摘要:由于页面含有ImageView引起的内存溢出。 作如下处理:在OnDestroy中
阅读全文