Friday, October 30, 2009

Blogaway 1.0 for Android Phones

A simple blogger client to read, post and manage your blogspot account feeds. A convenient way to keep you connected. This initial version is still under active development. More and more features will get added so that you can have a real Blogging experience. Features for 1.0 - Multiple blog account support - Multiple feeds under one account - Create, publish or save as drafts - Blogroll to read public Blogspot feeds - Captcha unlock account - Set default account to create new post, comments etc. Future improvements - View Comments - Post Comments - Add pictures/videos to posts - Manage your accounts - Delete feeds and accounts - Support for other blog feeds other than Blogspot I will be updating this application at regular intervals with more features. Currently, adding tags to your posts is not supported. I suppose this feature is one of the most important feature for such a client.

Wednesday, October 28, 2009

Android 2.0 !! Overview

Here is a list of apps that have been removed from the emulator. 1. Calendar 2. Camcorder 3. Google Maps The icons now have a new look and feel. Though I like the Donut icons, I guess, icons will keep changing. One issue with the default-email client that is supposed to support Exchange. I have successfully added an exchange account. But I am not able to see any new mails, and also, the mails I sent are still in the Outbox. When I go to contacts to add contacts from my Exchange Account, the application crashed. I couldn't test if the Contact's application can really synchronize with the exchange server. As for Google Maps, I think it will be shipped with the handsets only, as a separate application, and your code that uses Google Maps features will work on handsets, but as of now, there is no way to test such applications, unless you get it installed on your emulator. A lot of animated transitions when you switch between screens. And the new "Unlock" feature to unlock the key pad looks cool, but I guess, it would be a bit uncomfortable to use. You should need minimum effort to unlock your keypad. On the surface, you will basically find a complete UI change. I haven't yet digged into the new APIs. Have an Eclair !!!!! :)

Android 2.0 !!! Where is Google Maps

Just saw Android 2.0 (Eclairs) and downloaded it. Started the emulator, and compiled my project with 2.0 settings. I was surprised to see red marks all over the place. After looking at the console, I figured out that Android 2.0 doesn't have in-built Maps API. If your application uses the Google Maps API, then you are in for a surprise. Read on. Now what? In the emulator too, I didn't find the Google Maps application. Damn. But, just to test if my other functionalities were intact with the new Android 2.0, I added the maps.jar avaialble in the Android SDK as an external jar. I thought this would solve the problem. All compile errors vanished. But when I tried to install my app, the console said, "Installation error: INSTALL_FAILED_MISSING_SHARED_LIBRARY" To avoid this installation error, you have to remove this line from the manifest file so that Android detects the maps.jar as an external API and not an internal one. uses-library android:name="com.google.android.maps" Now, your app will be installed without any errors. But, since there is no Google Maps application, you cannot launch or test any Google Maps feature that you application depends on. Needless to say, it will of course be available on our handsets, but this is very disappointing.

Wednesday, October 21, 2009

Orientation independent applications

The Android phones detect orientation changes when you tilt yourIMG_0570 phone from landscape to portrait or vice-versa. It’s a cute feature. Well, most of the time you would be using your phone in the portrait mode. But for the phones that have a full QWERTY keyboard, the orientation automatically changes to landscape mode when you slide out your keyboard. If your application is not designed to handle such orientation changes, the usability of your application might decrease to an extent at which it might get completely unusable, or at the least, very inconvenient for the user.

How to handle it? It is actually very simple. You would have put all your layout xml files in a folder called “res/layout. This is the default location from where the layout files are picked up, i.e , when your phone is in portrait mode. You just need to create one more folder “res/layout-land” where you put you xml files, with the same name, but with a different layout, which would be convenient for the user to view when in portrait mode. This is all you have to do.

Next time, when the orientation is changed, your layout files will be picked up from the layout-land folder, and will be applied to your UI.

Enjoy….

Monday, October 5, 2009

Gesture Detection on Android

I just got my gesture detection code working. It's a fun way and a convenient way as well to enhance the usability of your application. So, here is the code that gets you going. First, for the Activity that you want to detect gestures, the OnGestureListener interface has to be implemented. Then, you need to override the methods and implement them. And finally, you need to implement the onTouchEvent method of the activity that will trigger the gesture listener code.

   1: package com.beanie.androidco;
   2:  
   3: import android.app.Activity;
   4: import android.os.Bundle;
   5: import android.view.GestureDetector;
   6: import android.view.MotionEvent;
   7: import android.view.GestureDetector.OnGestureListener;
   8:  
   9: public class GestureDemo extends Activity implements OnGestureListener {
  10:     private GestureDetector gestureDetector;
  11:     @Override
  12:     public void onCreate(Bundle savedInstanceState) {
  13:         super.onCreate(savedInstanceState);
  14:         setContentView(R.layout.main);
  15:         gestureDetector = new GestureDetector(this);
  16:     }
  17:  
  18:     @Override
  19:     public boolean onTouchEvent(MotionEvent event) {
  20:         return gestureDetector.onTouchEvent(event);
  21:     }
  22:  
  23:     @Override
  24:     public boolean onDown(MotionEvent e) {
  25:         // Do something
  26:         return false;
  27:     }
  28:  
  29:     @Override
  30:     public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,
  31:             float velocityY) {
  32:         // Do something
  33:         return false;
  34:     }
  35:  
  36:     @Override
  37:     public void onLongPress(MotionEvent e) { 
  38:         // Do something
  39:     }
  40:  
  41:     @Override
  42:     public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX,
  43:             float distanceY) {
  44:         // Do something
  45:         return false;
  46:     }
  47:  
  48:     @Override
  49:     public void onShowPress(MotionEvent e) { 
  50:         // Do something
  51:     }
  52:  
  53:     @Override
  54:     public boolean onSingleTapUp(MotionEvent e) { 
  55:         // Do something 
  56:         return false;
  57:     }
  58: }

The most commonly used method would probably be the onFling method, where you have to check for a threshold velocity and displacement before you would want to trigger an action. For detecting Left Fling, Right Fling, Scroll down/up, you will need to write some extra code in the corresponding methods. Enjoy...