Archive for 'Applications'

Android uses Uri (Uniform Resource Identifier) objects to identify the unique location of a piece of data. Uri objects are often used to specify the data that an Intent is supposed to use. In this case, we will create a Uri object from a web URL using the parse() method:

 
 

Uri uriUrl = Uri.parse(“http://www.schogini.com/”);  

 
 

You can view HTML content using the following Intent: android.content.Intent.ACTION_VIEW. Begin by creating an Intent of this type and specifying the URI you created above, as follows, within your Button click handler:

 
 

Intent launchBrowser = new Intent(Intent.ACTION_VIEW, uriUrl);  

 
 

When you launch this Intent, any applications that can display web will be able to handle this request. Once you have set the type data for the Intent, you can call the startActivity() method, passing in your Intent:

startActivity(launchBrowser);  

 
 

When you click on this button, the Browser application (which generally handles HTML content display) is launched to the website you provided.

Logging Options in Android applications.

The Android SDK includes a useful logging utility class called android.util.Log. Logging messages are categorized by severity, with errors being the most severe, then warnings, informational messages, debug messages and verbose messages being the least severe. Each type of logging message has its own method. Simply call the method and a log message is created. The message types, and their related method calls are:

 
 

  • The Log.e() method is used to log errors.
  • The Log.w() method is used to log warnings.
  • The Log.i() method is used to log informational messages.
  • The Log.d() method is used to log debug messages.
  • The Log.v() method is used to log verbose messages.
  • The Log.wtf() method is used to log terrible failures that should never happen.

     
     

    Syntax

    Log.i(TAG, ”Informational message!”);  

     
     

    The first parameter of each Log method is a string called a tag. Common practice is to define a global static string to represent the overall application or the specific activity within the application such that log filters can be created to limit the log output to specific data. For example, you could define a string called TAG, as follows:

    private static final String TAG = ”MyTAG”;  

     
     

    Now anytime you use a Log method, you supply this tag. An informational logging message might look like this:

     
     

    You can also pass a Throwable object, usually on Exception, that will allow the Log to print a stack trace or other useful information.

     

    • try {  
    • // …  
    • catch (Exception exception) {  
    •     Log.e(TAG, ”An Exception Encountered. Application Exits.”, exception);  
    • }  

     

     
     

Incoming search terms:

  • ios throwable object

Android manifest permissions

 

Declares a security permission that can be used to limit access to specific components or features of this or other applications.

Reference:

http://developer.android.com/reference/android/content/Intent.html#setClassName%28java.lang.String,%20java.lang.String%29

Display Units in android

Android is an Operating System with high degree of diversity. It has many dives in many forms and sizes. Coding for them is simple if the following units are clearly understood.

px - Pixels – corresponds to actual pixels on the screen.

in - Inches – based on the physical size of the screen.

mm - Millimeters – based on the physical size of the screen.

pt - Points – 1/72 of an inch based on the physical size of the screen.

dp - Density-independent Pixels – an abstract unit that is based on the physical density of the screen. These units are relative to a 160 dpi screen, so one dp is one pixel on a 160 dpi screen. The ratio of dp-to-pixel will change with the screen density, but not necessarily in direct proportion. Note: The compiler accepts both “dip” and “dp”, though “dp” is more consistent with “sp”.

sp - Scale-independent Pixels – this is like the dp unit, but it is also scaled by the user’s font size preference. It is recommend you use this unit when specifying font sizes, so they will be adjusted for both the screen density and user’s preference.

To make it absolutely clear – never use any of the above but sp or dp unless you absolutely have to. Using sp / dp will make your Android applications compatible with multiple screen densities and resolutions.

Reference:
http://developer.android.com/guide/topics/resources/more-resources.html#Dimension

Incoming search terms:

  • android pc
  • display unit in sem

We often do release updates to our Applications. While releasing updates there are several things to be considered.

When installed as an update to a previous version, the following scenario might Occur,

shortcuts break
widgets disappear
App can’t even be installed at all.

There are certain parts of an application that are edited only once ie) during the first time of app creation. Once you publish an app, these has to be unaltered. This helps in avoiding surprises by understanding them. Here are a few important Points,

Package name
The package name should never be changed during an update. It causes the Android System to treat the new update application as an entirely new Application.
Possible Issues – Broken Widget and Shortcuts
Developer Certificate and Key
The developer’s certificate and key must be the same as the previous issue. This causes the Signature Mismatch error and fails the new update. It doesn’t allow to install the update at all.

Robolectric is a unit test framework that de-fangs the Android SDK jar so you can test-drive the development of your Android app. Tests run inside the JVM on your workstation in seconds. With Robolectric you can write test simple and efficient

Advantages:
Fast and responsive
Easier testing just using the JVM
Highly efficient and productive

http://pivotal.github.com/robolectric/user-guide.html

KinetaMap

KinetaMap is a combination of technologies that allow datalogging and transmission of GPS location and accelerometer data. Kinesiology is a growing field of research where human movement and motion can be analyzed for various applications. KinetaMap has the ability to capture things like pedestrian gait, vehicle braking, or package handling. The logs give you GPS location and the raw acceleration readings – it’s up to you to decipher what they mean!

KinetaMap comes with basic firmware that currently supports acceleration and GPS logging. Flip the power switch and GPS will be logged once per second, accelerometer readings (X/Y/Z) at ten times per second. We designed KinetaMap to be as flexible and hackable as possible. It has the LPC2148 USB bootloader built-in which allows updates to the firmware easily and quickly over USB.

more…

Fixing Classpath Error in Eclipse.

I want to share the solution for classpath error when developing Android applications in Eclipse. Though I was not able to find the exact cause behind this issue, I found an effective way to fix it, which I’m sharing, so that it will be of use to someone who’s desperately searching the net to find a solution! :)

 

If you try to configure build path by adding a jar file from the ‘/libs‘ folder and you encounter the following error,


 

OR

When you try to add a jar file directly to build path (kept in your “/libs/” folder) and you get the following error,

 


 

THEN,

Try the following steps to fix it.

 

1)Clean your project, build and run again.

2)If step 1 didn’t work, then Go to Eclipse Workspace, open your project folder and edit .classpath file in a text editor and add the following line,

<classpathentry kind=”lib” path=”libs/<your_file.jar>”/>

Here, I’m assuming that the jar file is in your “/libs/” folder.

 

Restart Eclipse, and build and run your project.. that’s it!

 

Incoming search terms:

  • android classpath error
  • classpath error eclipse
  • eclipse classpath error
  • eclipse correct error classpath file
  • smart way to fix classpath errors in eclipse

Some of the App analytics services that help you track your application rankings and performance are -

http://flurry.com

http://AppFigures.com

http://AppViz.com

http://www.heartbeatapp.com/

Page 1 of 212