2

I am planning to do a project on Peer to Peer photo sharing on Android. My professor wants me to do that using some language other than Java or C/C++. Is any of Erlang, Haskell, Ocaml, Scala, Go helpful to build an android app with following functionality?

  1. Ability to design a GUI for android to view the pictures to be shared
  2. Support for socket communications to transfer the pictures?
Jonas
  • 121,568
  • 97
  • 310
  • 388

4 Answers4

9

Since Android relies heavily on Java, Scala would be a good choice here. Scala makes interoperating with Java code easy and runs on the JVM. On top of this, it is a nice functional language with an interesting type system, so it will be a good learning experience. (So will your other languages, but Scala is probably easier to use on Android.)

Check out Scala Programming for Android, which describes how you can make Android applications in Scala.

Community
  • 1
  • 1
Tikhon Jelvis
  • 67,485
  • 18
  • 177
  • 214
  • 5
    If you don't mind using a really, really new and probably underfeatured and buggy JVM language, you could try [Frege](http://code.google.com/p/frege/) which is "in the spirit of Haskell". I'm not saying that to be rude to Frege; I think the idea is really cool, but like I said, it's quite new and experimental right now. – Dan Burton Feb 15 '12 at 19:30
  • http://stackoverflow.com/questions/7697153/scala-android-and-eclipse. These indicate you'd have to use 2.8 releaes scala: http://stackoverflow.com/questions/7672484/what-languages-are-mature-to-develop-native-apps-in-android-except-java – Gene T Feb 16 '12 at 02:47
6

You can compile and execute Go programs on Android (or ARM in general), but you can't actually use the Android libraries. So, writing services or GUI applications for Android in Go is currently not that easy. I am not sure about the other languages, but I think Erlang, Haskell, Ocaml, etc. have similar problems (if they even provide an ARM compiler).

Therefore it's probably best to focus on a JVM based language. Most of the examples and other applications are written in Java, but Scala is also able to access all those APIs. So, I would either use Java or Scala.

tux21b
  • 90,183
  • 16
  • 117
  • 101
2

There's also this JVM-based functional, dynamic, lisp-like language Clojure, which some people seem to like a lot. It should be possible to use it to write Android Apps.

Community
  • 1
  • 1
ziggystar
  • 28,410
  • 9
  • 72
  • 124
  • 1
    People definitely are writing android apps in clojure, download size is an issue, http://groups.google.com/group/clojure-android/msg/e27d26918cb69d97?pli=1 – Gene T Feb 16 '12 at 02:55
2

Well, in my view, it depends on what you want to really use the language for as regards your project. Photo Sharing: are you planning on using Web based tools for the client, i.e. JavaScript, HTML5, CSS3, JQuery Mobile (http://jquerymobile.com/), sencha Touch (http://www.sencha.com/products/touch), Phone Gap (http://phonegap.com/),Titanium Appcelerator OR you want to use native stuff like Java, J2ME, e.t.c. Then if its web based (which would make things easier in my view), the language you are referring to in this case would be on the Server side.

So in my view if you just need the language to web-serve photos and stuff, then it would not matter which one you use: really depends on your liking. I am pretty sure that Erlang, Scala, Java and the others all have capability for developing great web services. However, the conditions you put as below:

1) Ability to design a GUI for android to view the pictures to be shared 
2) Support for socket communications to transfer the pictures?
Suggest that you were referring to a Front-End technology to use. You cannot use Erlang to create GUIs on Android, if i am right, you may not also be able to use Haskell and OcamL as well because these technologies cannot run on the device. For GUIs on Android, you can only use Java, OR you can use Widget Technologies like Opera Widgets OR you use Web based stuff like i mentioned above.

However, you should know that using JavaScript Libraries, HTML5, CSS3, e.t.c. is the quickest and more manageable way of developing Apps on any Device. I even wonder why you are talking of Socket Communications !! Am i getting you right ? you want to develop a Photo Sharing App which transfers Photos over raw Socket Communications ? Well, i am NOT sure how many apps out there for Android are doing raw Socket stuff, but i am pretty sure that many (http://androidapplications.com/) are using HTTP Protocol, as in Web Services.

Consider looking into web services than raw Sockets. I am pretty sure that even apps developed using native Java, uses HTTP (Web Services like SOAP) to communicate with a remote Server, be it weather apps, location-based stuff e.t.c. Otherwise i guess you should concentrate on Java, for now.
Muzaaya Joshua
  • 7,736
  • 3
  • 47
  • 86