ushahidi / Ushahidi_Android

[Deprecated] Ushahidi Android app For Ushahidi V2.x.x. Working on V3.x.x at
https://github.com/ushahidi/platform-android/
GNU Lesser General Public License v3.0
202 stars 148 forks source link

Bug on update reports #119

Closed ml1ght closed 11 years ago

ml1ght commented 11 years ago

I noticed one bug when updating reports on ReportTabActivity. When I select one of category (which no entries in it), and then click the Refresh button - there are reports of all the categories, but when I select any of them application is crashing (stored category selection to the lack of reports). I suggest when user uses refresh button reset categories value to the "All Categories" value.

ml1ght commented 11 years ago

And another one problem I have in android 2.3 - application don't works and crashes on start.

eyedol commented 11 years ago

What's the log saying?

ml1ght commented 11 years ago

This is shown in log: FATAL EXCEPTION: main java.lang.RuntimeException: Unable to start activity ComponentInfo{com.ushahidi.android.app/com.ushahidi.android.app.ui.phone.ViewReportActivity}: java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0 at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2100) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2125) at android.app.ActivityThread.access$600(ActivityThread.java:140) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1227) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:4898) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0 at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:251) at java.util.ArrayList.get(ArrayList.java:304) at com.ushahidi.android.app.ui.phone.ViewReportActivity.initReport(ViewReportActivity.java:181) at com.ushahidi.android.app.ui.phone.ViewReportActivity.onCreate(ViewReportActivity.java:97) at android.app.Activity.performCreate(Activity.java:5206) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1083) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2064)

eyedol commented 11 years ago

@ml1ght Fixed. Try the latest code in develop branch. Let me know how it goes.

ml1ght commented 11 years ago

Hi, error still stay in latest code in developer branch. FATAL EXCEPTION: main java.lang.RuntimeException: Unable to start activity ComponentInfo{com.ushahidi.android.app/com.ushahidi.android.app.ui.phone.ViewReportActivity}: java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0 at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2100) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2125) at android.app.ActivityThread.access$600(ActivityThread.java:140) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1227) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:4898) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0 at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:251) at java.util.ArrayList.get(ArrayList.java:304) at com.ushahidi.android.app.ui.phone.ViewReportActivity.initReport(ViewReportActivity.java:181) at com.ushahidi.android.app.ui.phone.ViewReportActivity.onCreate(ViewReportActivity.java:97) at android.app.Activity.performCreate(Activity.java:5206) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1083) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2064) ... 11 more 04-23 09:59:26.315: E/Google Maps Android API(20396): Failed to load map. Could not contact Google servers.

ml1ght commented 11 years ago

I try to explain how get this error: When I chose test map in ListMapActivity -> go to the ReportTabActivity and chose category (where no reports) -> and then tap update button and chose someone report -> crash application.

eyedol commented 11 years ago

@ml1ght are you running the latest develop code? Update your repo and give it a spin.

ml1ght commented 11 years ago

Hello. Yes, you were right application not crash more but now it shows black/blank activity on Reports when I do next steps: When I chose test map in ListMapActivity -> go to the ReportTabActivity and chose category (where no reports) -> and then tap update button and chose someone report -> black/blank Activity.

Log: W/SurfaceView(5661): CHECK surface infomation creating=false formatChanged=false sizeChanged=false visible=false visibleChanged=true surfaceChanged=true realSizeChanged=false redrawNeeded=false left=false top=false

P.S. and I have another one question: How I can view MAP on mapTab used location by GPS mobile location but not default location?

reddy2401 commented 11 years ago

Hello,

 Am also faced same issue and rectified. Replace following code in ListReportFragment.java  in  
 else if (status == 0){ } block at 744 line.

                               if(filterCategory > 0)
                               {
                reportByCategoryList();
               } else {
                        refreshReportLists();
                    }
                                showCategories();

if you want I can explain the reason.
ml1ght commented 11 years ago

Thank you. It's really work fine. And if you can explain the reason why it's happened?

P.S. and if you know how i can resolve my problem: How I can view MAP in MapFragment used location by GPS mobile location but not default location?

eyedol commented 11 years ago

@reddy2401 mind sending a pull request. I'll give it a review and merge when all is good

eyedol commented 11 years ago