I am planning to port an android app to IOS (ipad etc...) and during research on google I found j2objc. There are a lot of discussions on j2objc and I can't figure out how it works and what is possible. (I know, that it would be probably the best to port an app from scratch, then to believe on a magical converter, which does the job. But I also want to have a look on this :-) )
I like to understand on a showcase how it would work. (abstract level)
Would the converter help/work for the following case ?
I have javacode which accesses a SQLite database and loads data into an ArrayList JavaClass Instances (Tasks.java): - Procedure loaddata(); (loader.java)
ArrayList<Task> alTask=new ArrayList<Task>();
Cursor c = sqlitedatabase.rawQuery(sSQL, null);
c.moveToFirst();
while (!c.isAfterLast()) {
Task t=new Task();
t.setname(c.getString(0));
..
..
alTask.add(t);
}
return alTask;
Class Task (Task.java)
Class Task{ String sName=""; .. .. ArrayList alSubtasks; }
If I would like to show the tasks in a list of a IOS App, could I just convert my java classes, bind them into my IOS app somehow and just use the converted loaddata() to use the new Array(IOS Syntax) to show it in the IOS UI-List ? (The UI-List I woulc code in IOS from scratch.)
You have the general idea right, but unfortunately SQLite is a poor example since you're using the android.database API, which isn't portable.
There's a request for a portable SQLite library, which hasn't been implemented yet. Click the star icon if you wish to be notified when it is available.
The problem is that a fully featured library requires a lot of native code, but in practice, most apps only use a few methods. Here's an email thread on a way for a developer to implement just the necessary SQLite support methods.