There are several ways you could do this. One way for instance is to
try to load a class that exists only in Android.
Class.forName("android.view.View") will throw a ClassNotFoundException
on a Java SE environment. Just catch that exception to know that
you're not on Android.

You can also use "standard" properties. For instance if you use
System.getProperty("java.vendor"), you will get something like Sun
Microsystems Inc. or Apple Inc. or IBM with Java SE, but with Android
you current get "The Android Project".

On Sun, Jun 29, 2008 at 3:15 PM, kobica <[EMAIL PROTECTED]> wrote:
>
>
> On Jun 27, 10:07 am, Josh Guilfoyle <[EMAIL PROTECTED]> wrote:
>> Under what condition would you not be running an Android app on
>> Dalvik?  The emulator doesn't use your native JVM, it uses Dalvik as
>> well.
>
> It's a bit more complicated than that. I would like to create a common
> code to run on Android and Sun JVM.
> Android UI and swing UI Apps would be using that common code.
> Inside that common code, at time of init, I would like to know what is
> the VM type in order to instantiate the right objects from a specific
> factory.
> Some objects are Android specific and some are not.
> Life in a cross platform env ain't easy these days. (even not in
> Java ...)
>
> Thanks,
> Kobi.
> >
>



-- 
Romain Guy
www.curious-creature.org

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to