Saturday, June 23, 2012

Everyday Eclipse For Android Developers ? Pt.2 ?Best? Practices

LogCat
- Log.d(TAG, ?Debug Info?);
- Don?t use System.out.println, You will lose highlighting and ability to filter messages by TAG
- Most useful place to do logging is to display a network request and the corresponding network result
- Use LogCat filter to identify the logs you want

Quick Comments
- Think first
- Briefly describe what you need to do in one line as a comment
- Write implementation

Android Lint

What is Lint?
- Scans your project for common errors in your project
- Provides automatic fixes for most warnings via Quick Fix
- Has a dedicated Lint view that lists problems and lets your jump to where the probe is
- Problems are organized by issue type

XML
- Annoy you that string literal ought to be moved into the Strings resource
- If you use a Edit Text field, if you don?t specify a type, it will nag you to define one

Java
- Toast.makeText(context, ?My Toast Msg?, Toast.LENGTH_LONG);
- Forgetting to call .show() method on Toast instance.

When is it run?
- In ADT 16-19, when an .apk is being exported OR Updating an XML file OR Using the visual layout editor
- >= ADT 20, during save of both .java or .xml
- Incremental check , not project wide check

Where is Lint?
- It?s integrated into ADT for Eclipse

Where to learn more about Lint?
http://tools.android.com/tips/lint

What value does lint provide?
- Makes your life miserable? for the better

How to get it?
- Included in >=ADT 16

How can I Lint run manually?
- Run Lint in Toolbar Above

How can I make Lint go away?
- Preferences -> Android -> Lint Checking

Pro Tip: Avoid creating short-term temporary objects if you can. Fewer objects created will result in less Garbage Collection?

lollapalooza fbi most wanted list stuttering james van der beek dyngus day indonesia quake stephen strasburg

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.