Posts

Showing posts from August, 2012

Log in Android

Trace Android Issues

Log:

The Android logging system provides a mechanism for collecting and viewing system debug output. Logcat dumps a log of system messages, which include things such as stack traces when the emulator throws an error and messages that you have written from your application by using the Log class. You can run LogCat through ADB or from DDMS, which allows you to read the messages in real time.


This is like System.out in java or printf in C language.

Where ever you want to trace the values you can use this.

Types of logs:

* Verbose - v(String , String)
* Debug    - d(String , String)
* Info        - i(String , String)
* Warning - w(String , String)
* Error      - e(String , String)

We can also able to filter them.

Example:


int A = 10;
Log.d(this.toString,"Current Value of A "+ A);

The above code will produce 10 as answer.


Fundamentals of Android

Fundamentals of Android

These are the basic building blocks for android  

 * Activity
* Service
* Broadcast Receiver
* Content Provider.


Activity An activity represents a single screen with a user interface. The user can interact with the activity i.e. click the button.
Service A service is a component that runs in the background to perform long-running operations or to perform work for remote processes. A service does not provide a user interface.
Example:        Listening Music is the service. Because no user interaction is neccessary to play music. Once you start it will playing all the songs. Content Provider A content provider manages a shared set of application data. You can store the data in the file system, an SQLite database, on the web, or any other persistent storage location your application can access. 
Example:        Consider that you are going to develop message sending application. For choosing the contacts you need to add contacts one by one in your application.     …