Category Archives: Android

2017-07-24 Update

I got a book on Android and Kotlin by a guy in Spain named Antonio Leiva. I started going through it. I don’t know too much Kotlin or much about Android, do it is a bit of a hard slog sometimes. Here is his github repo for the book. The Android meetup will have a meeting about it on August 1. I plan on being ready.

I have to learn more about Android. What is an Activity? What is an Adapter? I will have to figure this out.

Here is the Android javadoc.

I think Kotlin will be huge. I think making Kotlin an official Android language will change the JVM language landscape. I have a feeling I will not be doing a lot of Groovy in the future.

When Ceylon came out, I did not see what the point of it was. It did not fill a niche that was not filled by Java, Groovy Clojure or Scala. So another JVM language gaining momentum is a bit surprising.

You’re welcome.

2017-05-21 Update

The big news in the JDK space this week is that Android now supports Kotlin. See this page, on the Android site and this post on Hacker News. So I will start learning Kotlin.

I don’t want to turn into one of those Scala weenies who goes on about how much they hate Java (see Note 1 below), but Android development was always pretty ghastly. Lots of XML, lots of anonymous inner classes (at least the last time I looked).

When Java started, it was basically: We took C++, and removed the hard parts you don’t like. Android is pretty much: We are using Java, but mostly the hard parts you don’t like.

I might look into React Native and ClojureScript at some point. But for now I am going through the Kotlin koans. Back when I was living in Chicago (back when Google told you to use Eclipse for Android), I spoke to a mobile developer who wrote apps for both Android and iDrone. He did not use any of the Javascript wrappers. He said the best way to do it was to just do it the way Google and Apple tell you to do it.

Maybe I will love Kotlin, but to be upfront I am not too happy with it at the moment. It is kind of a competitor to Groovy. I have spent a lot of time with Groovy, and I wish that it had more traction. But the world isn’t going to change for me. A lot of people at my job think every gosh darn thing has to be in a Word file. We make a web app for our client, why not make one for ourselves? But whatever.

There is no Kotlin group in Austin at the moment. Officially, there is a Groovy group, but there hasn’t been a meeting since January. The past two companies that hosted are no longer give the group the space. The group organizer works for OCI, the company that supports Grails. He works with clients all over Texas. I guess there is more Groovy out there than people think. Groovy is one of those languages where the user group is full of people who think the language is great, but their companies won’t even look at it. At the last meetup when he said he works with companies large and small all over Texas,  everyone got pretty excited. But he couldn’t give out any more info because of NDAs.

I know this sounds like I am not oozing with enthusiasm about leaving a language I like for one that I do not know very well. Frankly, at this point, I am not. But it looks like this is where the world is going. Kotlin had already gained a lot of momentum on Android before this (more than Groovy, certainly). If Google is willing to listen to its developers, then maybe Google is a vendor to pay attention to. Unlike Shiny-Wrapper-Microsoft (aka Apple).

Kotlin does have some similarities to Scala, which I do not like, so we will see how this all goes.

So, not a whole lot on the Clojure front.

I am still going through Simply Scheme.

You’re welcome.

Note 1: I always found Scala developers’ hatred of Java odd for two reasons: 1. The language you say you love was/is implemented in the language you say you hate, and 2. Why does Javascript get a complete pass from everybody?

Notes On LambdaNative

Looking into Scheme, I found out about a project called LambdaNative.

It lets you write an app in Scheme, and compile it into a phone app (Android, iClone, Blackberry) or a desktop app (Linux, Windows, OSX, BSD).

I downloaded it to my Linux laptop, and I was able to compile an Android app. I think I also got it working for the desktop. I took some notes as I was going along, partially because I had to install some packages along the way to get it to work. The wiki for LambdaNative was not as helpful as it should be.

I am not too sure if I got the Windows app to work or not. This is just here for my own reference.

You’re welcome.

New Groovy/Grails Group In Austin

There is now a Groovy and Grails group here in Austin. I went to the first meeting. I may or may not go to more in the future; it might conflict with the Android group.

The guy who started it has big plans. He eventually wants to put on a Groovy/Grails conference in Austin. He also wants the group to contribute to something to help put Austin on the Groovy/Grails map. Quite a few people suggested improving the documentation for several libraries. I suggested there should be a better tutorial. The Grails site has a link to a PDF file on InfoQ  that is a couple of years old and a few versions behind. Grails could use something like the Rails tutorial by Michael Hartl. In the Rails community, you say “Rails tutorial”, and everybody knows what you are talking about.

I also suggested they could make something that allows Groovy to build Android apps, sort of like what RubyMotion does. For some reason, when you mention “Android” and “$SOME LANGUAGE OTHER THAN JAVA”, a lot of people think you mean running that language on an Android device, even if your question is explicitly about using that language to develop applications and you say nothing about running that language on an Android device. I am not clear why that is, or why you would want to run the Groovy shell or the Clojure REPL on an Android device to begin with. If it is impossible for Groovy or Clojure to spit out an Android app, fine. It would be nice if people would say that before talking about running a REPL or shell on the phone.

I mentioned that the amazing Cedric Hurst would be willing to come down and speak sometime. He is very interested in building a strong Groovy/Grails community everywhere.

Austin Update and Thoughts on Android

I am now in Austin, TX. I accepted a job offer for a Rails position.

Last week, I blogged that I thought Android was going to be huge since there are cheap tablets starting to be manufactured. If you run a company and you want your employees to have tablets, why give them iPads when you can get a device you can control for half the price?

On the drive down, I saw a CVS advertising a 7″ Android tablet for $100. I think the beginning of the end for Apple might be here.

 

 

I Think Android Will Be Huuuuuuge

I subscribe to Hacker News. About a week ago they had a link to a story in Venture Beat by a guy who was finding sub-$100 tablets in China. It had a link to a story saying that when the world has a lot of cheap tablets, then tablets will really change things. Just like cel phones, and laptops, etc, etc.

Apple would never let IOS on a device that cheap. So all these devices that will come on the market soon will be running Android. So I think that in a few years Android is going to be huuuuuuuge. Sure, the Chinese government could come up with a competing tablet OS. But would anybody use it? I doubt it.

Ruby And Android

I have been thinking about getting more into Android. I have looked at the tutorials, and it looks like a laborious process to get anything done.

I was speaking with a local mobile developer who develops for just about every type of phone (Android, iPhone, Windows and BlackBerry). The guy owns 40 phones. He said that you should just do things in the standard way laid out by Google.

Sometimes I wonder if that is the best idea.

Android development seems like a step backwards. You can think of Java as C++ without the hard stuff. Android is Java with an emphasis on the hard stuff. There is a lot of XML, and a lot of anonymous inner classes. A lot of the reasons that people have been leaving Java are all over Android.

I am looking at RhoMobile and Ruboto to do Android development with Ruby.

 

My Android Presentation

Here is information from the slides from my presentation on Android that I gave at the Chicago Java Users Group on March 15, 2011. I think a lot of it is still valid.

The first slide was just the title.

2. The Clint Eastwood Slide

  • The Good: Gives Java a shot in the ARM (**rimshot**) and the iPhone some competition
  • The Bad: Fragmentation, 2 current releases, some people’s Reality Distortion Field is thicker than Kool Aid
  • The Ugly: Potential legal issues, huge API (1504 classes in SDK), kind of clunky (575 of those are nested classes, and you will make some inner classes)

3. Android & Java

  • It does not run Java, but you develop apps with Java
  • Your Java bytecode gets translated into bytecode the Dalvik Virtual Machine can run
  • Oracle’s Lawsuit: Big Mistake?

4. Anatomy of an App

  • You get an Activity class
  • /gen with R.java (created for you)
  • /res/drawable
  • /res/layout/main.xml (maps UI for the main Activity, usually made with a designer, other Activity classes get XML files as well)
  • /res/values/strings.xml (gives ID’s and aliases for some variables)
  • AndroidManifest.xml (what binds it all together)

5. Components

  • Activities
  • Services
  • Content Providers
  • Broadcast Receivers
  • Intents
  • Views

6. Activity

  • Class android.app.Activity
  • Each Activity represents a screen for the user
  • An app can have multiple Activities, and must have a main Activity
  • You must override the onCreate method

7. Services

  • Class android.app.Service
  • “A Service is an application component representing either an application’s desire to perform a longer-running operation while not interacting with the user or to supply functionality for other applications to use.”
  • Kind of what it sounds like: Runs in the background

8. ContentProvider

  • Class android.content.ContentProvider
  • Used to send data between apps
  • Data can be in files, RDBMS, or on a server
  • Class uses URIs to send data
  • Similar to REST

9. Broadcast Receiver

  • Class android.content.BroadcastReceiver
  • Used to receive messages sent via Intents

10. Intents

  • Class android.content.Intent
  • A class that other classes use to send messages to each other
  • Not to be confused with android.os.Message
  • Used by Activity classes, Services and BroadcastReceivers
  • Asynchronous, loosely-coupled

11. Intents II

  • Can be explicit (you specify what should respond to your Intent)
  • Or implicit (the system decides how to handle it)

Then I showed screenshots of the SDK installation and went through building a quick app.

At one point I said that there needs to be a translator between Android and English. Each screen is handled by a class that extends “Activity” (why can’t they call it screen?) and instead of sending messages to each other or making requests, you send an Intent.

CJUG Meeting 2011-03-15

I gave the presentation earlier tonight at the CJUG Meeting. We had nothing else lined up, so I did one on Android.

I was looking for a new place to live for the past few months, and that took up a lot of time. So I was not able to put as much time into my presentation as I was hoping. So the presentation was pretty short. I learned about Android doing it, and nobody threw anything at me or walked out.

CME provided space and food. You can find my contact on Twitter. I think next month we will have someone come in and talk about Groovy on Grails. I was contacted by someone who could talk about JMS. There might be a Mongo Java API one in the works. I would also like to do one on Akka. There is an Akka API for Java. I think the Actor model of concurrency will displace the threading model over time.