`
文章列表
当使用gson把实体转换成json时,如果实体中存在字段的值为NULL的话,那么转换出来的json字符串中将不存在对应的字段,这里就不应该使用Gson gson = new Gson(); 应该使用Gson gson = new GsonBuilder().serializeNulls().create();

单例模式

转载自:http://blog.csdn.net/guolin_blog/article/details/8860649 /** * 单例模式的log打印类 * 单例:保证一个类仅有一个实例,并提供一个访问它的全局访问点 * @author zhenggangyao * */ public class LogUtils { private static LogUtils utils; public static final int DEBUG = 0;//所有的bug public static final int INFO = 1;//正常信息 public static ...
/** * 写入文本 */ private void inputTxt(String txt){ FileOutputStream out = null; BufferedWriter writer = null; try { out = openFileOutput("txt", Context.MODE_PRIVATE); writer = new BufferedWriter(new OutputStreamWriter(out)); writer.write(txt); } catch (Exception e) { ...
/** * BaseAdapter的抽取 * @author xu-pc * * @param <T> * 泛型数据的格式 * 需实现getHolder() */ public abstract class SuperBaseAdapter<T> extends BaseAdapter{ private List<T> mData; /*public SuperBaseAdapter(List<T> list) { this.mData = list; }*/ public SuperBaseAdapter(List&l ...
public class AppException extends Exception implements UncaughtExceptionHandler { private static final String TAG = "AppException"; private static final long serialVersionUID = -6262909398048670705L; private String message; private Thread.UncaughtExceptionHandler mDefaultHandler; priv ...
这里写一些网络请求的相关 //初始化相关参数和对象 public class HttpUtil { private static HttpUtils httpUtils; private static RequestParams requestParams; public static HttpUtils getInstance() { httpUtils = new HttpUtils(); httpUtils.configRequestRetryCount(0); httpUtils.configTimeout(1000 * 20); httpUtils.c ...
整个思路,先判断服务端当前版本是不是高于本地版本,高的话可以选择更新,如果没有新版本,则提示用户当前是最新版本 /** * getVersionName(获取app版本号) * * @Title: getVersionName * @Description: TODO * @param @param ct * @param @return 设定文件 * @return String 返回类型 * @throws */ public static String getVersionName(Context ct) { String versionName ...
android端从相册或者拍照读取图片,见demo
转载:http://blog.csdn.net/one_isi_all/article/details/50923775
代码都是差不多,为了说明先贴出来了,需要注意的是红字部分。 PopupMenu menu = new PopupMenu(getApplicationContext(), v); menu.getMenuInflater().inflate(R.menu.main, menu.getMenu()); menu.setOnMenuItemClickListener(new OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { Toast.makeText( ...

Android零碎知识

http://www.iteye.com/topic/1141876

java设计模式

    博客分类:
  • java
http://www.iteye.com/blogs/subjects/java_design_patterns
http://www.oschina.net/question/84460_9608
分享 http://www.iteye.com/news/30895

sdk下载受限问题

http://blog.csdn.net/boonya/article/details/38752647 这篇文章中的第三种方法可以说是很实用的。
Global site tag (gtag.js) - Google Analytics