Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2010-07

Android NDK

14 messages · 6 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Michael Schnell

Android allows for doing "native" applications for Android powered devices (insted of doing APPs in Java)

http://developer.android.com/sdk/ndk/index.html

Does this mean we can already do such applications with Lazarus ?

Or does it mean that Lazarus eventually could / needs to be enhanced by a "Android Wiget Type" to do just this.

-Michael

Sven Barth
to Michael Schnell

Hi!

Michael Schnell wrote 9 lines
Android allows for doing "native" applications for Android powered devices (insted of doing APPs in Java) http://developer.android.com/sdk/ndk/index.html Does this mean we can already do such applications with Lazarus ? Or does it mean that Lazarus eventually could / needs to be enhanced by a "Android Wiget Type" to do just this.

If I understand this NDK thing right, you can build native libraries that are loaded by your Java application to do some performance critical stuff.
You can't access Android's GUI library without going somehow through the Darvik VM (the JVM of Android) though. Someone was working on getting Mono and C# running on Android, so it might be possible with FPC as well, but we'll need to use Java Native Interface for that.

Regards,
Sven

Reimar Grabowski
to Sven Barth
If I understand this NDK thing right, you can build native libraries that are loaded by your Java application to do some performance critical stuff.

You absolutely do understand this right.

You can't access Android's GUI library without going somehow through the Darvik VM (the JVM of Android) though.

The VM is called Dalvik, but you are right that the GUI can only be accessed via Java. And you cannot start non-Java programs on unrooted devices (it's no good idea to tell your customer to hack his/her phone).

so it might be possible with FPC as well, but we'll need to use Java Native Interface for that.

Has been done, is possible, but of course no GUI stuff. But OpenGL works.

R.

A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing? A: Top-posting. Q: What is the most annoying thing in e-mail?
Felipe Monteiro de Carvalho
to Reimar Grabowski

It looks to me that a workable solution for Lazarus would be building the GUI application as a library, and then we would have a generic Java application which loads that library and communicates with it.

Felipe Monteiro de Carvalho
Reimar Grabowski
to Felipe Monteiro de Carvalho
It looks to me that a workable solution for Lazarus would be building the GUI application as a library, and then we would have a generic Java application which loads that library and communicates with it.

I don't think I can follow you.
In Adroid you don't write programs but activities. The main thread of such an activity is the UI thread. It does the painting and eventhandling and all that stuff. AFAIK there is no X and no known widgetset, to see how Android does it's drawing one would have to look at the source and find out how they do it. I don't think what you propose is possible with the current LCL, I may be wrong. But at least we would need a new widgetset as backend. The only one working I know of is qt. But this needs a special NDK and Google says that it may break at any time (update) because it uses more than the stable marked C-libs and advices against distributing qt progs. I am sure lacking knowledge, as up to now I only use Java to code for Android, but I think someone has to dive deep into the Android code to make GUI development with Lazarus for Android possible.

R.

A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing? A: Top-posting. Q: What is the most annoying thing in e-mail?
Felipe Monteiro de Carvalho
to Reimar Grabowski

My idea does not use X11, but directly the Java API.

For example, we would have a Java app like this:

Java_paint_method ()
{

  LCL_paint_message_arrived(formX, canvasY);

}

And the LCL-Android would export this routine and do just like in all other widgetsets: execute DoPaint, call OnPaint, etc. At various points we would call functions from this Java generic application, which would the actual drawing.

The only problem is transforming a program into a library. Here Build modes would help a lot, so you could have a customized Android mode which uses a different main source file to build the library.

Reimar Grabowski wrote
I don't think what you propose is possible with the current LCL, I may be wrong. But at least we would need a new widgetset as backend.

yep, new backend.

Felipe Monteiro de Carvalho
Mark Morgan Lloyd
to Felipe Monteiro de Carvalho
Felipe Monteiro de Carvalho wrote
The only problem is transforming a program into a library. Here Build modes would help a lot, so you could have a customized Android mode which uses a different main source file to build the library.

It's worth wondering whether there are other Java-based platforms which could benefit from this approach, and whether their users could see any benefit to having Lazarus available.

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]
Felipe Monteiro de Carvalho
to Mark Morgan Lloyd
Mark Morgan Lloyd wrote
It's worth wondering whether there are other Java-based platforms which could benefit from this approach, and whether their users could see any benefit to having Lazarus available.

No, I don't know any other Java platform which falls in this pattern. There are some platforms which only run Java, like Blackberry, but there you can't load a native library.

Felipe Monteiro de Carvalho
Mark Morgan Lloyd
to Felipe Monteiro de Carvalho
Felipe Monteiro de Carvalho wrote 9 lines
On Tue, Jul 27, 2010 at 9:54 AM, Mark Morgan Lloyd wrote: > It's worth wondering whether there are other Java-based platforms which > could benefit from this approach, and whether their users could see any > benefit to having Lazarus available. No, I don't know any other Java platform which falls in this pattern. There are some platforms which only run Java, like Blackberry, but there you can't load a native library.

Ah of course- the native library issue. That would probably rule out larger systems (IBM using PPC, Sun using SPARC, everybody using x86 or x64) which is what I was thinking about.

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]
Felipe Monteiro de Carvalho
to Michael Schnell
Michael Schnell wrote
Would that not be "starting non-Java code" which the framework does not allow ?

This works. I've already seen Android apps which bind Java and C++ like that, although not in a generic way like I proposed.

Felipe Monteiro de Carvalho
Michael Schnell
to Felipe Monteiro de Carvalho
Felipe Monteiro de Carvalho wrote
This works. I've already seen Android apps which bind Java and C++ like that, although not in a generic way like I proposed.

Thus in theory, a special Lazarus "Android" Widget Type and Application Type could create a Java application that calls the Lazarus program as a library and same performs GUI functions by doing calling Java callbacks.

-Michael

Terry A. Haimann
to Felipe Monteiro de Carvalho: It looks to me that a workable solution for Lazarus would be building the GUI application…

I have Lazarus 0.9.29 installed on a FC12 Laptop, with Zeos 6.6.6 installed. What do I need to do to connect to a MySQL 5.1 Server?

I have gone in and added "/usr/lib/mysql to my path

I have dropped a Zconnection on my form and set values for Database, user, & password.
I then set protocal to one of the following:

mysql
mysql-5
mysqld-5

and then tried to change Connected to true and got the following error messages.

mysql: None of the dynamic libraries can be found: libmysqlclient.so.15, libmysqlclient.so
mysql-5: None of the dynamic libraries can be found: libmysqlclient.so.15, libmysqlclient.so
mysqld-5: None of the dynamic libraries can be found: libmysqld.so

I don't know what is wrong, but Zeos 6.6.6 is suppposed to be able to connect to this server.

These libraries are what yum says I have installed:

yum list installed | grep mysql

mysql.i686 5.1.47-1.fc12 @updates

mysql-devel.i686 5.1.47-1.fc12 @updates

mysql-embedded.i686 5.1.42-7.fc12 @updates

mysql-libs.i686 5.1.47-1.fc12 @updates

mysql-server.i686 5.1.47-1.fc12 @updates

php-mysql.i686 5.3.2-1.fc12 @updates

qt-mysql.i686 1:4.6.2-20.fc12 @updates

And just because I kknow you are going to ask is a listing of my /usr/lib/mysql dir:

ls -l /usr/lib/mysql

total 20600

-rw-r--r-- 1 root root 1704 2010-05-24 14:57 libdbug.a

-rw-r--r-- 1 root root 111898 2010-05-24 14:57 libheap.a

-rw-r--r-- 1 root root 516440 2010-05-24 14:57 libmyisam.a

-rw-r--r-- 1 root root 96874 2010-05-24 14:57 libmyisammrg.a

-rw-r--r-- 1 root root 1787660 2010-05-24 14:57 libmysqlclient.a

-rw-r--r-- 1 root root 1800900 2010-05-24 14:57 libmysqlclient_r.a

lrwxrwxrwx 1 root root 26 2010-07-30 11:10 libmysqlclient_r.so -> libmysqlclient_r.so.16.0.0

lrwxrwxrwx 1 root root 26 2010-07-25 19:38 libmysqlclient_r.so.16 -> libmysqlclient_r.so.16.0.0

-rwxr-xr-x 1 root root 1531076 2010-05-24 14:57 libmysqlclient_r.so.16.0.0

lrwxrwxrwx 1 root root 24 2010-07-30 11:10 libmysqlclient.so -> libmysqlclient.so.16.0.0

lrwxrwxrwx 1 root root 24 2010-07-25 19:38 libmysqlclient.so.16 -> libmysqlclient.so.16.0.0

-rwxr-xr-x 1 root root 1525280 2010-05-24 14:57 libmysqlclient.so.16.0.0

lrwxrwxrwx 1 root root 18 2010-02-20 16:28 libmysqld.so.0 -> libmysqld.so.0.0.1

-rwxr-xr-x 1 root root 8882504 2010-01-29 12:08 libmysqld.so.0.0.1

-rw-r--r-- 1 root root 1445228 2010-05-24 14:57 libmystrings.a

-rw-r--r-- 1 root root 422116 2010-05-24 14:57 libmysys.a

-rw-r--r-- 1 root root 1821650 2010-05-24 14:57 libndbclient.a

lrwxrwxrwx 1 root root 21 2010-07-30 11:10 libndbclient.so -> libndbclient.so.3.0.0

lrwxrwxrwx 1 root root 21 2010-07-25 19:38 libndbclient.so.3 -> libndbclient.so.3.0.0

-rwxr-xr-x 1 root root 1075896 2010-05-24 14:57 libndbclient.so.3.0.0

-rw-r--r-- 1 root root 18080 2010-05-24 14:57 libvio.a

-rwxr-xr-x 1 root root 13128 2010-05-24 14:57 mysqlbug

-rwxr-xr-x 1 root root 6356 2010-05-24 14:57 mysql_config

drwxr-xr-x 2 root root 4096 2010-07-25 19:38 plugin

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20100730/3fb4f567/attachment-0001.html>