Why does this edit of agenda_entry_setting.xml cause MobileOrg to crash?

10 views
Skip to first unread message

iain....@gmail.com

unread,
Dec 16, 2013, 2:57:04 PM12/16/13
to mobileor...@googlegroups.com
Right now the Agenda command makes queries like the todo command type
(see Org-Mode's org-agenda-custom-commands documentation). I want to
make it able to do queries like the agenda type, where it displays tasks
with a deadline or scheduled before a certain date, or with a timestamp
within a date range. I have looked at the code to see how to implement
this. Please note that I am brand new to writing for Android, or really
GUI code of any kind.

Right now, deadline, scheduled, and timestamp are stored in the
payload. There seem to be a few options:

When generating the agenda view, we could take the result of the SQL
query, check the date requirements against the payload in Java, and
discard those that don't meet the date conditions. This seems mildly
inefficient, but I have don't have enough entries in my org files for it
to be a problem.

To make the resulting interface resemble org-agenda-custom-commands, I
tried adding the following snippet to agenda_entry_setting.xml:

#+BEGIN_EXAMPLE
<LinearLayout
style"@style/EditBorders"
android:layout_width"fill_parent"
android:layout_height"wrap_content"
android:orientation"vertical"
android:paddingTop"3dip" >

<Spinner
android:id"@+id/agenda_entry_type"
android:layout_width"fill_parent"
android:layout_height"wrap_content" />
</LinearLayout>
#+END_EXAMPLE

and the values for that spinner in arrays.xml:

#+BEGIN_EXAMPLE
<string-array name="agendaCommandTypes">
<item>TODO list</item>
<item>Agenda</item>
</string-array>
#+END_EXAMPLE

although I haven't yet added the code that inflates the Spinner from the
array. I successfully ran ant debug install, but when I tried running
the resulting app, adb logcat reported:

#+BEGIN_EXAMPLE
I/ActivityManager( 588): START u0 {cmp=com.matburt.mobileorg/.Gui.Wizard.WizardActivity} from pid 12759
E/AndroidRuntime(12759): FATAL EXCEPTION: main
E/AndroidRuntime(12759): Process: com.matburt.mobileorg, PID: 12759
E/AndroidRuntime(12759): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.matburt.mobileorg/com.matburt.mobileorg.Gui.Outline.OutlineActivity}: java.lang.NullPointerException
E/AndroidRuntime(12759): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)
E/AndroidRuntime(12759): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
E/AndroidRuntime(12759): at android.app.ActivityThread.access$800(ActivityThread.java:135)
E/AndroidRuntime(12759): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
E/AndroidRuntime(12759): at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime(12759): at android.os.Looper.loop(Looper.java:136)
E/AndroidRuntime(12759): at android.app.ActivityThread.main(ActivityThread.java:5017)
E/AndroidRuntime(12759): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(12759): at java.lang.reflect.Method.invoke(Method.java:515)
E/AndroidRuntime(12759): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
E/AndroidRuntime(12759): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
E/AndroidRuntime(12759): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime(12759): Caused by: java.lang.NullPointerException
E/AndroidRuntime(12759): at com.matburt.mobileorg.Gui.Outline.OutlineActivity.setupList(OutlineActivity.java:92)
E/AndroidRuntime(12759): at com.matburt.mobileorg.Gui.Outline.OutlineActivity.onCreate(OutlineActivity.java:56)
E/AndroidRuntime(12759): at android.app.Activity.performCreate(Activity.java:5231)
E/AndroidRuntime(12759): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
E/AndroidRuntime(12759): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
E/AndroidRuntime(12759): ... 11 more
W/ActivityManager( 588): Activity pause timeout for ActivityRecord{4250c7a8 u0 com.matburt.mobileorg/.Gui.Outline.OutlineActivity t58}
#+END_EXAMPLE

Thinking the problem might be that I didn't actually inflate the Spinner
yet, or that I failed to grasp some other subtlety of how they work, I
made it a Checkbox (just copying an existing one and changing the ID),
but still couldn't launch the app. I don't understand what is causing
the crash, especially since the NPE is found while starting
OutlineActivity, which I haven't touched. What could cause this crash?

iain....@gmail.com

unread,
Dec 17, 2013, 6:11:19 PM12/17/13
to mobileor...@googlegroups.com
Well, it works now. Maybe it was the ant clean. I'll continue hacking on this feature.
Reply all
Reply to author
Forward
0 new messages