// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
}
}
1、
在使用AndroidStudio导入项目后,提示图片错误问题,原因是当前AS版本和之前项目版本有差异,根据网络资料,
最新的ADT在AS中必须要使用.9.png图片,解决办法就有两种:
错误:9.png Error:Must have one-pixel frame that is either transparent or white. -xxx/app/src/main/res/drawable-
xhdpi/icon_addpic_focused.png: libpng warning: iCCP: Not recognizing known sRGB profile that has been edited
解决办法一:修改图片名称为.9.png
解决办法二:到build.grade文件中修改
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
}
}
将classpath 'com.android.tools.build:gradle:1.5.0'的版本改为之前项目的版本,手动修改,比如1.2.3
07-20 11:30:47.528: E/InputEventReceiver(15683): Exception dispatching input event.
07-20 11:30:47.528: E/MessageQueue-JNI(15683): Exception in MessageQueue callback: handleReceiveCallback
07-20 11:30:47.558: E/MessageQueue-JNI(15683): java.lang.IllegalStateException: The content of the adapter has changed but
ListView did not receive a notification. Make sure the content of your adapter is not modified from a background thread, but
only from the UI thread. Make sure your adapter calls notifyDataSetChanged() when its content changes. [in ListView
(2131362029, class android.widget.ListView) with Adapter(class com.apical.aiproforremote.adapter.LoadQueueAdapter)]
07-20 11:30:47.558: E/MessageQueue-JNI(15683):
at android.widget.ListView.layoutChildren(ListView.java:1555)
07-20 11:30:47.558: E/MessageQueue-JNI(15683):
at android.widget.AbsListView.onTouchMove(AbsListView.java:3696)
07-20 11:30:47.558: E/MessageQueue-JNI(15683):
at android.widget.AbsListView.onTouchEvent(AbsListView.java:3552)
07-20 11:30:47.558: E/MessageQueue-JNI(15683):
at android.view.View.dispatchTouchEvent(View.java:7731)
07-20 11:30:47.558: E/MessageQueue-JNI(15683):
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2212)
07-20 11:30:47.558: E/MessageQueue-JNI(15683):
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1945)
07-20 11:30:47.558: E/MessageQueue-JNI(15683):
at android.widget.AbsListView.dispatchTouchEvent(AbsListView.java:930)
07-20 11:30:47.558: E/MessageQueue-JNI(15683):
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2218)
07-20 11:30:47.558: E/MessageQueue-JNI(15683):
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1959)
07-20 11:30:47.558: E/MessageQueue-JNI(15683):
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2218)
07-20 11:30:47.558: E/MessageQueue-JNI(15683):
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1959)
07-20 11:30:47.558: E/MessageQueue-JNI(15683):
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2218)
07-20 11:30:47.558: E/MessageQueue-JNI(15683):
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1959)
07-20 11:30:47.558: E/MessageQueue-JNI(15683):
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2218)
07-20 11:30:47.558: E/MessageQueue-JNI(15683):
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1959)
07-20 11:30:47.558: E/MessageQueue-JNI(15683):
at com.android.internal.policy.impl.PhoneWindow
$DecorView.superDispatchTouchEvent(PhoneWindow.java:2242)
07-20 11:30:47.558: E/MessageQueue-JNI(15683):
at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent
(PhoneWindow.java:1536)
07-20 11:30:47.558: E/MessageQueue-JNI(15683):
at android.app.Activity.dispatchTouchEvent(Activity.java:2501)
07-20 11:30:47.558: E/MessageQueue-JNI(15683):
at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent
(PhoneWindow.java:2190)
07-20 11:30:47.558: E/MessageQueue-JNI(15683):
at android.view.View.dispatchPointerEvent(View.java:7911)
07-20 11:30:47.558: E/MessageQueue-JNI(15683):
at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent
(ViewRootImpl.java:4041)
07-20 11:30:47.558: E/MessageQueue-JNI(15683):
at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess
(ViewRootImpl.java:3920)
07-20 11:30:47.558: E/MessageQueue-JNI(15683):
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3481)
07-20 11:30:47.558: E/MessageQueue-JNI(15683):
at android.view.ViewRootImpl$InputStage.onDeliverToNext
(ViewRootImpl.java:3531)
07-20 11:30:47.558: E/MessageQueue-JNI(15683):
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3500)
07-20 11:30:47.558: E/MessageQueue-JNI(15683):
at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:3607)
07-20 11:30:47.558: E/MessageQueue-JNI(15683):
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3508)
07-20 11:30:47.558: E/MessageQueue-JNI(15683):
at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:3664)
07-20 11:30:47.558: E/MessageQueue-JNI(15683):
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3481)
07-20 11:30:47.558: E/MessageQueue-JNI(15683):
at android.view.ViewRootImpl$InputStage.onDeliverToNext
(ViewRootImpl.java:3531)
07-20 11:30:47.558: E/MessageQueue-JNI(15683):
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3500)
07-20 11:30:47.558: E/MessageQueue-JNI(15683):
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3508)
07-20 11:30:47.558: E/MessageQueue-JNI(15683):
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3481)
07-20 11:30:47.558: E/MessageQueue-JNI(15683):
at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:5629)
07-20 11:30:47.558: E/MessageQueue-JNI(15683):
at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:5606)
07-20 11:30:47.558: E/MessageQueue-JNI(15683):
at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:5577)
07-20 11:30:47.558: E/MessageQueue-JNI(15683):
at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent
(ViewRootImpl.java:5773)
07-20 11:30:47.558: E/MessageQueue-JNI(15683):
at android.view.InputEventReceiver.dispatchInputEvent
(InputEventReceiver.java:185)
07-20 11:30:47.558: E/MessageQueue-JNI(15683):
at android.os.MessageQueue.nativePollOnce(Native Method)
07-20 11:30:47.558: E/MessageQueue-JNI(15683):
at android.os.MessageQueue.next(MessageQueue.java:138)
07-20 11:30:47.558: E/MessageQueue-JNI(15683):
at android.os.Looper.loop(Looper.java:123)
07-20 11:30:47.558: E/MessageQueue-JNI(15683):
at android.app.ActivityThread.main(ActivityThread.java:5128)
07-20 11:30:47.558: E/MessageQueue-JNI(15683):
at java.lang.reflect.Method.invokeNative(Native Method)
07-20 11:30:47.558: E/MessageQueue-JNI(15683):
at java.lang.reflect.Method.invoke(Method.java:515)
07-20 11:30:47.558: E/MessageQueue-JNI(15683):
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run
(ZygoteInit.java:893)
07-20 11:30:47.558: E/MessageQueue-JNI(15683):
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:702)
07-20 11:30:47.558: E/MessageQueue-JNI(15683):
at dalvik.system.NativeStart.main(Native Method)
07-20 11:30:47.878: E/TestinAgent(15683): ****************************************
@Override
public void onLongPress(MotionEvent arg0) {
// TODO Auto-generated method stub
loadQueueAdapter.isListViewScrolling = true;
}
@Override
public boolean onScroll(MotionEvent arg0, MotionEvent arg1, float arg2,
float arg3) {
// TODO Auto-generated method stub
loadQueueAdapter.isListViewScrolling = true;
return false;
}
@Override
public void onShowPress(MotionEvent arg0) {
// TODO Auto-generated method stub
loadQueueAdapter.isListViewScrolling = true;
}
@Override
public boolean onSingleTapUp(MotionEvent arg0) {
// TODO Auto-generated method stub
loadQueueAdapter.isListViewScrolling = true;
return false;
}
@Override
public boolean onTouch(View arg0, MotionEvent event) {
// TODO Auto-generated method stub
return mGestureDetector.onTouchEvent(event);
//return false;
}
}
4、在适配器中移除数据项的处理:如果滚动就先做保存,当不滚动的时候再做移除,如上面滚动事件类代码中
loadQueueAdapter.removeDataFromListAgain();。
具体有:public void removeDataFromList(int item){
if (list.size() > 0){
if (isListViewScrolling){
countItemDownloaded++;
laterList.add(item);
return;
} else {
removeDataFromListAgain();
}
if (activity_flag == DOWN_ACTIVITY_FLAG){
list.remove(item);
notifyDataSetChanged();
removedTotalItemCount = list.size();
……
} else if (activity_flag == UP_ACTIVITY_FLAG){
list.remove(item);
notifyDataSetChanged();
……
}
} else {
list = new ArrayList<String>();
notifyDataSetChanged();
}
}
public void removeDataFromListAgain(){
if (!(countItemDownloaded > 0)){
return ;
}
if (list.size() > 0){
for (int i = 0; i < laterList.size(); i++){
int item = laterList.get(i);
list.remove(item);
notifyDataSetChanged();