A sub-minimum viable Android app

In my last post, I set up a minimal (and I mean minimal) backend server. All it does is provide the temperature for a given city. I actually went ahead and set up this little Go server on Heroku; I just like having things running in production, no matter how insignificant they may be.

Anyways, what good is a service if nothing is using it, right? On that note, today I’d like to make a little Android app to utilize the server and display the temperature. At this point, I would say I am familiar with Android development, I haven’t made anything, but have dug around some code and checked things out. So, I think this will be an enjoyable learning experience. So, let’s get started!

The user interface

I’m a sucker for making user interfaces. I enjoy the psychology that’s involved, and I’m just a big fan of stuff looking pretty. Now, just because I enjoy all that, doesn’t mean I’m good at it. Here’s what I whipped up in Android Studio:

UI Screenshot

Yeah, not pretty. Nor really functional. But let’s make it work first, and then we’ll see about making it more useable.

As a prototype, the use case is this: user enters a zip code and presses “Get Weather” and then the temperature for that zip shows up in center. That’s it.


private class GetWeatherTask extends AsyncTask<String, Void, Forecast> {
  protected Forecast doInBackground(String... zips) {
    try {
	  return getForecast(zips[0]);
    } catch (IOException e) {
	  return new Forecast();

  protected void onPostExecute(Forecast result) {
    TextView textView = (TextView) findViewById(R.id.temp_text_view);
	  getString(R.string.temperature_display), result.getTemperature()));

This GetWeatherTask thread is started if the zip code is deemed valid after the button is pressed. I won’t even bother showing you getForecast because it just makes an HttpsURLConnection and then reads the JSON from my Go server using a JSONReader, and frankly, it’s uninteresting. Ultimately, it’s going to be tossed and redone anyways.

Until next time, I’m going to be working to make this into an app that someone would actually maybe want to use.


comments powered by Disqus