Archive

Posts Tagged ‘Java’

Android App Developer Guide – My Own Beginner Notes

January 30, 2017 Leave a comment

Various notes (adapted) from the Android SDK Developer Docs (for creating one’s first App):

The at sign (@) is required when you’re referring to any resource object from XML. It is followed by the resource type (id in this case), a slash, then the resource name (edit_message). [Source]

The plus sign (+) before the resource type is needed only when you’re defining a resource ID for the first time. When you compile the app, the SDK tools use the ID name to create a new resource ID in your project’s R.java file that refers to the EditText element. With the resource ID declared once this way, other references to the ID do not need the plus sign. Using the plus sign is necessary only when specifying a new resource ID and not needed for concrete resources such as strings or layouts. See the sidebox for more information about resource objects. [Source]

The default weight for all Views is 0, so if you specify any weight value greater than 0 to only one View, then that view fills whatever space remains after all Views are given the space they require. [Source]

It’s a good practice to define keys for Intent “extras” using your app’s package name as a prefix. This ensures the keys are unique, in case your app interacts with other apps [Source]

The XML layout generated by previous versions of Android Studio might not include the android:id attribute. The call findViewById() will fail if the layout does not have the android:id attribute. If this is the case, open the relevant .xml file in the /res/layout directory (in this case activity_display_message ) and add the attribute android:id="@+id/activity_display_message" to the layout element. [Source]

Android categorizes device screens using two general properties: size and density. [Source]

  • There are 4 generalized sizes: small, normal, large, xlarge
  • And 4 generalized densities: low (ldpi), medium (mdpi), high (hdpi), extra high (xhdpi)
  • Also be aware that the screens orientation (landscape or portrait) is considered a variation of screen size, so many apps should revise the layout to optimize the user experience in each orientation.

Information about the relative number of devices that share a certain characteristic, such as Android version or screen size [Source]

Using the appcompat Toolbar makes it easy to set up an app bar that works on the widest range of devices, and also gives you room to customize your app bar later on as your app develops [Source]

You should always externalize application resources such as images and strings from your code, so that you can maintain them independently. You should also provide alternative resources for specific device configurations, by grouping them in specially-named resource directories [Source]

 

Advertisements

Which Programming Language?

May 15, 2010 1 comment

Copied from a number of different blogs … so i have no idea where they found it … but anyhow it’s funny/interesting/quite true …

In response to the question “Which programming language should I learn first?” – one user responds:

Depends.

To program in an expressive and powerful language: Python
To get a website up quickly: PHP
To mingle with programmers who call themselves “rockstars”: Ruby.
To really learn to program: C.
To achieve enlightenment: Scheme.
To feel depressed: SQL
To drop a chromosome: Microsoft Visual Basic
To get a guaranteed, mediocre, but well paying job writing financial applications in a cubicle under fluorescent lights: Java.
To do the same thing with certifications and letters after your name: C#
To achieve a magical sense of childlike wonder that you have a hard time differentiating from megalomania: Objective C

Categories: Uncategorized Tags: , , , ,