[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Orekit Developers] Status of the Android application -- 2
- To: orekit-developers@orekit.org
- Subject: [Orekit Developers] Status of the Android application -- 2
- From: Alexis ROBERT <alexis.robert@gmail.com>
- Date: Wed, 10 Aug 2011 14:09:35 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:from:date:message-id:subject:to:content-type; bh=VnOIMkmLdB3w7NRqfpT6eiJzDvncaACV4V81FmW4x3c=; b=BQxy++4xGK6SXtDENEdo9vrVdB0081xTmibRlsaOlrPz8N1Vs0ulq8UFS3j7thhJ6U T5UlEIUhQQQfR8QY13KRVbqPpyYHoNoeaot858QW1ttk+tJ8o4AIEDoOQhm00Gn5Qe+x WtAiiyfwDAbXwX4AclNi9mUSM3ekvqsJ+c64Y=
Hi,
I've just published a new snapshot on the forge, available here :
https://www.orekit.org/forge/attachments/download/56/orekit-20110810.apk
It should now handle Frame conversion as well as Orbit conversion
(with TLE support).
About the changes since the last snapshot :
* All the work is now being done in a background worker thread with a
ProgressDialog. It means you will not have your UI becoming
unresponsive with a black screen and a "Application non responsive"
dialog as soon as you hit the "Compute" button, but you'll have a
dialog telling you that it's "Working ..."
Just a word about how I did this. The main problem of having a
ProgressDialog with a background worker thread is handling rotation.
In fact as soon as you rotate, Android will remove the current
instance of your Activity (Activity is the Android term for a window)
and will recreate it with the new orientation. It means that if you
have a worker thread, your thread will continue to work but is not
attached to the new activity so :
1. As you're not be able to know you have a worker thread currently
working, the new Activity creates a new worker thread and you'll end
up with a bunch of worker threads in parallel if you rotate multiple
times
2. When any worker thread which is attached to a removed Activity
finishes his work, he pushes the result to the removed Activity and
not to the new one
3. When any worker thread which is attached to a removed Activity
finishes his work, it will try to close a ProgressDialog which is
unattached to a screen so your application will crash.
The idea is to make the Thread instance as a static member and update
the thread's "instance" member as soon as you create an activity (as
well as some other stuff for the ProgressDialog, because it needs to
be recreated with the new Activity). This is the purpose of the class
ProgressAsyncTask which extends AsyncTask (which is a class present in
the Android API which is here to help executing tasks in background)
but takes care of all the ProgressDialog stuff. Basically, if you use
ProgressAsyncTask, you'll just need 2 lines in your onCreate() method
to add a ProgressDialog with all the rotation handling part :)
* I also catch the exceptions Orekit returns me and output an
AlertDialog so the user can know what's going on instead of having a
"Force close" dialog, that means the application should be far more
stable now (or at least looks to be :) )
Although, I'm sure I'm doing things wrong, but I have some problems
with Orekit throwing exceptions it doesn't claim to throw. For
instance in the Android application if you make an incorrectly
formatted TLE, Orekit will return a
java.lang.StringIndexOutOfBoundsException which will be never catched
and so the application crashes. I also have an other example of a
conversion from a Cartesian orbit with all coordinates set to 0 to a
Keplerian orbit (with a
org.apache.commons.math.exception.MathArithmeticException: zero norm
-- coming from Vector3D.angle).
* I've tweaked the fields which require to enter double value to show
a numerical keypad (if you use a virtual keyboard) instead of the full
alphabetical keyboard, which could save some time entering the values.
* Also, I don't know what you think of them but I'm not very proud of
the dialogs for entering the orbit details
(cartesian/keplerian/circular/equinoctial/except TLE). I think asking
them as a list is not very great and having a standard tabular form
could be better to type the orbit details faster (like the Frame
conversion dialog with the position/velocity entries), but that's my
taste :)
* By default, there is some TLE data when you want to enter the
details of a TLE orbit, but that's temporary, it's just because
entering a TLE orbit by hand on the virtual keyboard is *very*
annoying. (it's the ISS orbit data I found on celestrak :) ). A known
issue is that when you rotate, you'll have the same sample TLE data
again, that's because I put this hack a line too far on
TLESelector.java :)
If you have any comments, suggestions or questions, I'll be happy to
answer them :)
Have a nice day,
Alexis