Need suggestion for porting from C to Java app
I've programmed in c/c++ in the last 15 years but I've little
experience in Java (and Android), so I would like a suggestion
on how to structure a very simple (but computationally intensive)
app which has the following general characteristics (no details needed).
The app has some data (say 2MB) statically stored.
When the app starts this data is preprocessed and
a large structure of about 40Mb is created.
After the initialization, the app has one text field
for input, one for output and a button (for start/stop).
The user enters a query then press the start button.
The app computes a result using the large array.
If the calculation on the input takes too long,
the user can stop the processing with the stop button and
start again with a new input.
When I was doing this under windows/linux with C/C++, I had
no problems: I used a large global array and two threads,
one to draw interface and respond to user
(mouse, clicks, etc.) and one to perform the computation.
Which is the standard (best) way to structure this kind of app
in Java/Android ?
Should I use an Activity for the graphic interface and a
Service for the computation ? Can I build the large array in the
Activity when the app starts and pass a reference to it to the Service every time Start button is pushed ?
I just need to be pointed in the right direction, to avoid
some blind alleys.
In a sense using c/c++ would be better, but I read that
developing in Java (for Android) is much easier so I will
try first with Java and revert to C only if the app will turn out
to be too slow.