0

Possible Duplicate:
How to determine if my app is running on Android

I am going to write a library which will be imported in both desktop and android system.

I would like the library to use different class depending on the system.

I am pretty sure there is a way to check it, but couldn't find.

Any help will be appreciated.

Community
  • 1
  • 1
tompal18
  • 984
  • 1
  • 16
  • 39
  • See if it helps: [How to determine if my app is running on Android][1] [1]: http://stackoverflow.com/questions/4519556/how-to-determine-if-my-app-is-running-on-android – Tommy Siu Mar 22 '11 at 08:45

1 Answers1

2

You can try to look for android.app.Activity class through reflection. If it is present - Android system libraries is in your classpath and, thus, you are in Android.

Olegas
  • 10,009
  • 7
  • 49
  • 72