- 打印JsonObject所有的key和value
Iterator<?> keys = json_array.keys();
while( keys.hasNext() ) {
String key = (String) keys.next();
System.out.println("Key: " + key);//获取key
System.out.println("Value: " + json_array.get(key));//获取value
}
- Recyclerview 在加载的之前更改了头部的状态导致异常,stackoverflow
Cannot call this method in a scroll callback. Scroll callbacks mightbe run during a measure & layout pass where you cannot change theRecyclerView data. Any method call that might change the structureof the RecyclerView or the adapter contents should be postponed tothe next frame.
java.lang.IllegalStateException:
at android.support.v7.widget.RecyclerView.assertNotInLayoutOrScroll(RecyclerView.java:2581)
at android.support.v7.widget.RecyclerView$RecyclerViewDataObserver.onItemRangeChanged(RecyclerView.java:4943)
解决办法:
recyclerView.post(new Runnable() {
public void run() {
articleAdapter.notifyItemInserted(allArticles.size() - 1);
}
});
- Mint wapper图片放的位置
/usr/share/backgrounds/
- Android Studio 添加测试第三方库,打包release的时候又不能打包进去
- build.gradle添加如下方法
debugCompile('com.facebook.stetho:stetho-okhttp3:1.4.2') { exclude group: 'com.android.support', module: 'appcompat-v7' }
- 在main的同级目录添加debug文件夹,目录结构和main的保持一直
网友评论