android app development tips

Post on 13-Apr-2017

27 Views

Category:

Technology

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Android Development Tips

By Srinivas

Zoftino.com

Exception Handling

Android application exceptions can be handled like other Java based applications.

While developing apps, you can check console output from logcat monitor to find out exceptions and take appropriate action like fixing code, showing a message to user.

Exception Handling Unhandled exceptions in your app,

thrown when your app runs on user device, causes your app to crash.

To analyze and fix these issues, you need crash report from the device on which your app is crashed.

Exception Handling You can add global exception

handler to each component to catch unhandled exceptions and send it your server or to you via email for analysis

Or You can use libraries to handle exceptions and get crash reports, like ACRA library.

Logging

You can use Log class to log messages.

Log class has several methods to log different level of information, for debug Log.d,Log.e for error, Log.i for information etc.

It is a good practice to make sure that debug statements are used only in development.

Android Studio Tips

To import classes, press Alt + Enter pointing to the unresolved class.

To remove unused imports, you can use Ctrl + Alt + Enter.

Use refactoring options to make code changes like class signature, method signature changes, parameter renaming etc. 

Testing

You can test android apps on mobile devices connected to computer via USB or using android emulator. 

To create virtual device you can use Android emulator tool (Tools > Android > AVD Manager)

Setup hardware acceleration to improve the performance of virtual device

Thank You

Visit http://www.zoftino.com/ for more info.

top related