03 2013 档案
摘要:问题一:当我们在使用DefaultHttpClient进行Http网络请求的时候,你会发现开启多个线程进行请求会有阻塞的问题出现。解决方法:(通过Java的线程阻塞处理synchronized) synchronized (client) { HttpResponse httpResponse = client.execute(request); int statusCode = httpResponse.getStatusLine().getStatusCode(); LogUtil.info(TAG, "sta...
阅读全文
摘要:/** * An object to convert Chinese character to its corresponding pinyin string. * For characters with multiple possible pinyin string, only one is selected * according to collator. Polyphone is not supported in this implementation. * This class is implemented to achieve the best runtime performance
阅读全文
摘要:Bundle传递数据的时候,我们会发现传递Serializable集合会抛出IO异常。这个时候我们就必须使用Parcelable包裹类。Message.java:public class Message implements Parcelable{ @DatabaseField(generatedId = true,unique=true) int id; @DatabaseField private String Mid;//消息ID private MessageContent Content;//消息内容 @DatabaseField priva...
阅读全文
摘要:项目中我们经常会碰到这种情况,开启一个后台Service进行网络请求。当满足我们的条件发送一个广播,通过广播来改变UI。首先:我们应该注册Service和广播:mainfest.xml: <!--Service服务--> <service android:enabled="true" android:name=".service.MyService"> <intent-filter> <action android:name="org.allin.android.musicService" /
阅读全文
摘要:public class PullToRefreshView extends LinearLayout { private static final String TAG = "PullToRefreshView"; // refresh states private static final int PULL_TO_REFRESH = 2; private static final int RELEASE_TO_REFRESH = 3; private static final int REFRESHING = 4; // pull state pr...
阅读全文

浙公网安备 33010602011771号