The Artima Developer Community
Sponsored Link

Java Buzz Forum
Android Notebook, page 2

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Elliotte Rusty Harold

Posts: 1573
Nickname: elharo
Registered: Apr, 2003

Elliotte Rusty Harold is an author, developer, and general kibitzer.
Android Notebook, page 2 Posted: Jan 19, 2009 9:38 AM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by Elliotte Rusty Harold.
Original Post: Android Notebook, page 2
Feed Title: Mokka mit Schlag
Feed URL: http://www.elharo.com/blog/feed/atom/?
Feed Description: Ranting and Raving
Latest Java Buzz Posts
Latest Java Buzz Posts by Elliotte Rusty Harold
Latest Posts From Mokka mit Schlag

Advertisement

There’s a tab character in the Notepadv1.java sample file. Tab characters should not be used.

Android has an embedded SQL database, Useful.

I wish XML layout files would open in XML view by default rather than layout view.

The tutorial is a little flaky with XML terms. It’s an XML declaration, not an “XML header”.

Some things that look like XPath expressions at first glance, aren’t.

Trying to read a tutorial in one window and use Eclipse in the other is painful. Maybe if I put my laptop on the desk?

The tutorial’s naming conventions aren’t following Java standards. Someone likes to put “m” in front of all the instance fields.

XML localization and UI construction: nice.


There’s something about GUIs that just makes people fill methods with illegible arguments:

menu.add(0, INSERT_ID, 0, R.string.menu_insert);

It isn’t obvious, but that’s four ints in a row. I guarantee a lot of bugs when the argument order is swapped. In fact, perhaps I’m noticing a general design principle here:

Do not design method signatures such that more than two values of the same type must be passed, especially in consecutive positions.

A more fluent interface might be helpful here, as would a language (not Java) which allowed named argument lists. Hmm, it also occurs to me that this is another reason to prefer GUI construction in XML instead of code. Each value is identified by name, not by positions. Sure it’s verbose and redundant, but humans need verbosity and redundancy to help us out.


OK. This is weird. This compiles:

    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
            case INSERT_ID:
                createNote();
                return true;
        }
        return super.onOptionsItemSelected(item);
    }

But this does not:

    public boolean onOptionsItemSelected(MenuItem item) {
        switch item.getItemId() {
            case INSERT_ID:
                createNote();
                return true;
        }
        return super.onOptionsItemSelected(item);
    }

Why are the parentheses necessary? Oh wait. I’ve been writing too much Haskell lately. Parentheses are always necessary for switch in Java, just like for if and while.


I wish Eclipse had a “Run as Android Application…” menu item in the context menu.

Read: Android Notebook, page 2

Topic: Alertpedia email alerts: World of Alerts in a Single Place Previous Topic   Next Topic Topic: Yahoo Search ends: New CEO Carol Bartz

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use