15
May

As the smart phone market continues to boom and witnesses serious growth, the phone makers expand their line of devices to counter the growing competition. Not just following but leading the smartphone growth story is the Android platform, the Android mobile phone market is growing at an impressive rate with new handsets being released all the time.

According to a Google executive, 90,000 Android devices are activated everyday.Almost all new entrants in the smartphone business along with established ones are exploring Android platform for their low to high end phones. These plethora of devices come with different screen sizes, resolution, pixel density, etc. making it challenging for app developers to develop a quality app for these. This makes the testing activity all the more important and key in order to be able to publish a quality app to the market.

This post has targeted different devices which has a distinct combination of the said parameters and would list the important areas of QA and tools used in these scenarios.

Testing on multiple devices 
With the growing end user computation options, compatibility testing is becoming very important. This is not an easy scenario to handle from a software testing angle though, because of the number of combinations in which the application needs to be verified, in the limited resources and time on hand.

Problem:
The scale of Android market penetration makes it difficult and impractical, if not impossible, to execute all tests across all combinations. The application that runs on an Android device could run on any platform, firmware, and phone. However, often times it is only a subset of these combinations and tests that yield maximum returns in terms of bugs found.
Solution – To identify the appropriate device factors: The crucial element to restrict the list of devices is to recognize the factors that might affect the application and make sure to cover all possible combinations of such factors. Dealing with factors instead of devices will empower you to scale down the list of covered devices to a manageable subset that will provide coverage for a large portion of relevant scenarios.

Listed below are some such factors to keep in mind in determining the optimization matrix:

  • Screen Size: Smart phones or tablet applications are typically developed not for GUI (Graphical User Interface) but for NUI (Natural User Interface) which involves multiple touch gestures such as scrolling, tap to click, shaking, pinching and providing other finger-touch inputs. The main concern is the screen size of the devices, on which the application will run. One of the challenges of framing an application is how to frame a view layout so it will furnish the screen size. The screen size can differ from QVGA (240×320), WVGA (480×800), HVGA (320×480), FWVGA (480×854), tablets (1024×600) and standard for tablets (1280×800). So one of the challenges is to run the same application on 240×320 and also on 1280×800.
  • Android OS versions: The android platform is rapidly evolving. The diversification from version 1.5 to version 4.2 is huge. There are lots of features that can affect the application under test.
  • Mobile processor: Mobile devices are very sensitive to processing power. Devices could run at single core at 600 MHz or dual core at 1200 MHz.

Strategies to mitigate the risk factors:

  •  Edge: Select those factors that are at the edges of the scale, such as minimum and maximum screen size, OS versions at the lowest and highest end with minimum and maximum CPU power.
    We can consider 2 devices when we combine influencing factors:
    Lower scale: HTC Hero: Android version 1.5, HVGA (320×480) screen size and 528 MHz Qualcomm CPU
    Higher scale: Galaxy Tab 10.1v: Android version 3.1, 1280×800 screen size and 1000MHz dual core
  • Commonality:Keep tab on market device penetration and usage patterns to select the most popular devices. Such cases alone help make your prioritization task easier.
  • Simultaneous execution of test cases: Once a matrix has been finalized, as much as possible have testers run the same test across combinations simultaneously. This helps the tester evaluate and compare application performance across variables at the same time; this often helps to get better feedback than if the tests were run at separate times, and also makes the test setup process more efficient
  • Testing across combinations: Encourage testers to test across combinations, even when they are using the application in an ad-hoc fashion. Encourage cross discipline testers, who may not be directly working on project.
  • Testing using Track ball: A lot of HTC’s touch screen smart phones have the trackball. It lets you fine-tune your selection, which is very useful in text areas when you want to move the cursor to a specific spot. If phone includes a trackball (or similar navigating device you can use to select items on screen), you may find some actions are easier using it than using your finger, such as”
    • Opening an event in a crowded calendar
    • Selecting a link or form field on page
    • Selecting text to edit

This is for what we cover in this blog post, check this space for more insights to ensure your Android app is ready for the target audience and of course, the target devices.

20
Mar

Introduction

As more and more organizations are looking to develop a mobile solution for their applications, delivering a quality mobile application in a short span has become all the more important. Also with the constant state of flux and the dynamic nature of the business, first mover provides a big advantage for consumer mobile apps.

An important part of the mobile app development cycle is the mobile app testing. There are plethora of mobile devices, multiple platforms, and networks available in the market, thereby increasing the importance of device testing to ensure the applications performs consistently. Not to mention the various types of standard and specialized testing – Functional, User Experience, Performance, Memory optimization etc.

This post is a part of the App testing blog post series and covers one of the aspects of app testing.

“Stub” Concept Applied To Mobile Apps Testing

In many cases, the interaction between mobile app and its server counterpart uses the JSON format, thereby, shifting a significant onus of testing to the client side. During one of our assignments, we realized that we were required to test a large number of scenarios, which were essentially driven by data and it was not feasible to change either the server side code or the data. So we devised a different way to test the app and used the concept of “stubs”.

We analyzed the app was making only three important server calls in the entire lifecycle wherein the request call was based on REST protocols and the response was in JSON. Since the request and response formats were well defined at the start of project, we created a few sample responses for each of the three interactions, as ASCII files. To perform unit testing for all scenarios, we had only two choices.Either (a) do not touch the code and keep making server calls or (b) change the code to read the files. 

The second option was unmanageable as we were delivering incremental builds in agile mode and the client-ready builds were expected to connect to live servers.

That’s when we evaluated options to set up a quick network-stub. After evaluating options, we decided to build a stub server in GO.

The GO Server

We built a small server in GO language and installed it on a local Windows machine. The Android app and the server were able to communicate with each other, with the help of Wi-Fi/Ethernet LAN connectivity.  As a result of this, we were able to achieve the following benefits –

  • The stub server was built in a short time with very small code base
  • The server has a very small footprint and is quick to install / run.
  • Each developer was able to install his own server and unit test his own code for various scenarios.
  • This avoided making any calls to the client’s server, thereby reducing testing time.
  • No code change.

Conclusion

By using appropriate open source technologies and formats, even a complex scenario like mobile applications testing, can be managed and therefore, helps software developers to deliver good quality products to clients.

References

  1. http://www.businessinsider.com/bii-mobile-insights-mobile-app-sales-to-exceed-30b-this-year-2012-11
  2. http://mobilegovwiki.howto.gov/Mobile+First
  3. http://en.wikipedia.org/wiki/Mobile_application_testing
06
Feb

In an ideal world, tablet selection would be simple. A battle over specs is usually all that’s needed to grab an avid tech lover’s attention, but what about programmers? With the introduction of so many types of tablets, it begs the question, which is better for programmers and app developers – MSFT Surface tablet, iPad or Android tablet? Which is better for developing apps? Which has the best UI? The below post will examine the differences between the three.

iPad:Apple struck gold when they created the iPad. App developers worldwide continue to enjoy the  creation of apps on this iOS run device, no matter how many versions crop up

  • App Development – More and more app developers are choosing to create apps for iOS powered devices over Android or Windows powered devices.  An infograph published in CNET news shows that 27 percent of programmers prefer Android while 73% percent prefer iOS. Tech experts lend this to better pay for a iOS powered apps and a better looking platform.
  • Programming Language – If you’re looking to develop apps for the iPad, you are restricted to only using apps within the apple app bundle (objective C and C, C++ and Java Script). However, Apple recently made changes to its policy, allowing the use of any interpreted language so long as the interpreter is embedded.
  • UI Design Paradigm - Most iOS powered apps use HTML for the UI.
  • Speed – Quad-core video processing combined with LTE connectivity improved the speed at which users can consume video and other data-intensive content
  • Integration – The improved integration of cloud services makes productivity applications more useful
  •  Display – New retina display provides much improved resolution to deliver high definition entertainment and gaming content to consumers.

However, to update existing apps for the new iPad, graphics must be up converted to a much higher resolution. This will result in larger graphic files, nearly doubling the overall size of many apps. Apps over 20MB in size can only be purchased through a WiFi connection, not through 3G or LTE networks.Most developers prefer developing iOS apps due to the monetary value and the ease of using Java script.

Android Tablet:Android tablets were once dubbed the poor man’s iPad, but not anymore. The price and popularity of Android powered-devices have skyrocketed, making it impossible to go anywhere without seeing someone holding one. But are they good for programmers?

  • App Development – Although most app designers prefer to create iOS apps over Android apps, Android dominates the mobile market; and since many mobile phone companies are offering tablets powered by sim cards, app developers are starting to lean towards Android powered tablets.
  • Programming Language – Java is the main programming language used to create apps on Android power tablets.  Unlike Windowa-powered tablets or iOS powered tablets, Android allows developers to write applications for and on the device.  Currently, programmers use SL4A, python, LUA, JavaScript, PHP, Perl, Ruby, TCL and more. All of these languages share common API.
  • UI Design Paradigm – There are dozens of differences between the Android UI in comparison to Windows or iOS, but the main difference is in the system and action bars.  Android also incorporated the “holographic UI visual language” to pick up actions such as option selecting, controlling the volume and selecting the date.
  • OS Updation- The Android OS is frequently updated and highly customizable – which is good if you like to alter the look and feel of your tablet interface. You are free to move your apps about, make major changes to the look of your home screens and enable things like shortcut access to your email.
  • Security – Google Play store does not vet apps in the same way as Apple. Therefore it is possible (although unlikely) to download a malicious app when using an Android tablet.

Developers prefer creating Android powered apps because of the various programming languages and the familiarity with the products.

Windows MSFT Surface Tablet:The MSFT Surface Tablet has been nicknamed the mystery device.  When it was first revealed, no one knew whether it was a media device (like an e-reader or mp4 player) or a tablet with a kick stand. There’s still no definitive answer as to what exactly the MSFT Surface Tablet is, which could be why ZDNET stated that it was in low demand.  However, programmers are more interested in the technical specs of the tablet, which are as follows:

  • App Development – The MSFT Surface Tablet contains the MSOffice home and student 2013 app, Windows mail and messaging apps, IE10 app, Xbox music app as well as games and video apps such as Netflix.  .
  • Programming Language – Depending on which tablet you choose, Surface runs on either Windows 8 or Windows RT.  Windows uses C based languages for programming (C, C++ and C#).  Both Windows tablets use C ++.
  • UI Design Paradigm  - The UI for MSFT Surface tablet is designed more for  a Windows based PC and not a tablet, which makes it popular among PC users and not tablet enthusiasts.  Windows has described the user interface as Metro, but is now calling it “Windows 8 UI.” When it comes to apps, the UI is simply Windows apps are Windows 8 apps.
  • Security – Windows 8 will feature security enhancements such as Secure Boot, BitLocker and AppLocker to encrypt the device and prevent malware and the unauthorized use of apps and software.
  • Platform Alignment –Alignment with Windows 8 PCs and Windows Phone 8 Smartphones. Microsoft will be the only company to offer the same platform across the PC, tablet and phone. This will potentially make life easier for developers, IT professionals and business users.
  • Lack of compatibility with legacy Windows APIs on Windows RT based surface devices.
  • The ability to run Windows 7 and Vista legacy apps (this applies to Windows 8 Pro, not Windows RT)

Developers who are used to programming on Windows PCs can transition smoothly into programming on the Surface Tablet. Although the Windows 8 interface offers a bit of a challenge to those who aren’t familiar with it.

References:

http://techcrunch.com/2012/10/24/clearing-up-the-confusion-its-the-new-Windows-8-ui-not-metro-ui/

http://thenextweb.com/apple/2012/03/06/why-do-developers-prefer-ios-over-android-try-75-adoption-of-ios-5-while-ics-is-stuck-at-1/

By

Team Member - Administrator

03
Mar

Overview

Phonegap is an open-source hybrid framework built on HTML5 platform to create cross domain mobile applications and to publish the app in the respective app stores. It allows you to author native applications with web technologies and get access to APIs and app stores. Framework provides an interface to the device-specific features such as camera, geo location, accelerometer, sound etc.

Need for Organization

Organizations can invest in developing applications in Phonegap with rich HTML, CSS features and can use the same code base for cross domain like iOS and Android. Phonegap works almost on all mobile platforms such as Apple iOS, Google Android, Windows Phone 7, Palm, Symbian, and Blackberry. It has recently started supporting Window Phone 7 platform as well. This makes the re-utilization of the code and contribution to easy monetization.

“Build once run everywhere” methodology

Phonegap allows the developer to reuse the HTML, CSS and JavaScript for creating rich and innovative apps wrapped inside the native application shell, which can be published as a native application with few easy steps:

  • Implement the app logic using HTML, CSS and JavaScript.
  • The UI can be implemented in HTML, jQuery, Sencha-touch or any HTML based framework.
  • Upload the files/source to Phonegap On-Cloud build service.
  • Create the binaries for Apple iOS, Google Android, Windows Phone 7, Palm, Symbian and Blackberry.
  • Distribute the application on App Store and get it available to the market.

In a typical Phonegap app, HTML5 and CSS3 features are used with JavaScript to hold the application data. The app can be developed on all Phonegap supported major mobile platforms. The same code base can be used, with some changes for Blackberry and Windows Phone 7, to build the respective binaries.

Refer to Phonegap On-Cloud builder to create the binaries.

The files from the device can be accessed with APIs provided in the Phonegap framework. It also provides an interface to invoke the camera and also the device photo gallery as well. Phonegap framework internally manages to invoke the respective native module. Any feature which mobile SDK provides can be bridged to the HTML/JavaScript interface. This features differs the application from a conventional browser based application.

Extending the basic Phonegap application

The framework allows the developers to use the native features and controls by implementing the custom plug-in. Xoriant has developed the plugin to upload and download the files over the Cloud storage. The REST API call is done through the native iOS interface which is invoked through the Phonegap plugin architecture.

Following below steps help to create the plugin:

  • Created a JavaScript interface to queue up the events to the native classes.
  • The native functions have been implemented to route the event to the web-view via Phonegap.
  • Register the native extension with the iOS native project by adding an entry in the Phonegap .plist file.

For details, please refer to the link: http://www.adobe.com/devnet/html5/articles/extending-phonegap-with-native-plugins-for-ios.html

Merits and Demerits of the framework

Merits:

  • The developer who has knowledge of HTML, CSS and bit of JavaScript can create a native application without having an exposure to the native framework.
  • The hybrid based architecture allows user to access features of both web and native applications.
  • Code can be reused which contributes to easy monetization and common codebase.
  • The application can be easily distributed via application stores.
  • The performance of the application depends on the native Webkit rendering engine which differs on each platform.
  • The look and feel of the Phonegap cannot be extended with the native interface. One can invoke the native code bypassing the Phonegap code.

Demerits:

Thus, Phonegap can be considered as a precursor of emanating W3C device standards. The framework makes it possible to use different technologies which are fundamentally altogether different thereby saving time and cost.

By

Team Member - Administrator

21
Feb

Apple claims iPhone 4S to be the most amazing iPhone yet. Nokia collaborating with Microsoft claims Nokia Lumia 800 as easier, faster and fun. With iPhone 4S sales touching record breaking numbers and Nokia with its windows powered Nokia Lumia 800 are pushing the Smartphone’s market to a new a high. It’s the users who are surely to be benefitted with choices of a wide range of features and capabilities through their mobile devices.

Yet, the launch of these Smart Phones drive people to loggerheads when its time to decide on one phone.But with so much said and heard ,how a user should make the best choice among these two super phones.

You can have look at comprehensive feature comparison here.

Operating System:

  • With iOS 5 the latest major up-gradation to earlier version of iOS, over 200 new features have been added to the iPhone 4S adding the WOW factors to the device.
  • With Windows Phone Mango 7.5 OS, which is the latest version of Microsoft phone OS, Nokia Lumia 800 looks beautiful and appealing.

Processor:

  • Apple iPhose 4S operates on lesser frequency of 1.0 GHZ but has a dual core A5 processor which helps double the power efficiency.
  • Nokia Lumia 800 is powered by Single core 1.4GHz processor which is one of the most powerful single core processors available on mobile.

Display:

  • Apple iPhone 4S on one hand has a 3.5inch retina display screen and on other hand Nokia Lumia 800 has a bigger LCD screen of 3.7inch.
  • If bigger sounds better to you then Nokia Lumia 800 is the sure bet here.

Camera:

  • With 8 MP resolution primary camera housed on both the phones, it’s the video quality which is the distinguishing factor.
  • iPhone 4S comes with 1080p recording whereas Nokia Lumia 800 has 720p. Also iPhone 4S has a secondary VGA camera which is missing in the Nokia Lumia 800.

Graphics:

iPhone 4s has better looking graphics in Games as well as in-phone. However with high processing speed, Graphics loads faster on Nokia Lumia 800.

Sensors:

  • Apple iphone 4S has multiple sensors like Accelerometer, proximity, ambient light, GPS, Three-axis gyro.
  • Nokia Lumia 800 also has multiple sensors like 3D Accelerometer, proximity, ambient light, GPS, magnetometer.

Storage:

  • Both the phones come with in-built storage and have no option to expand memory using an external card.
  • Nokia Lumia has 16 GB storage whereas iPhone 4S comes with three variations of 16GB, 32 GB and 64 GB storage.

Apps:

  • Built in Apps for iPhone 4S: Siri, FaceTime, Reminders, Maps+Compass, Game Center, Calendars, Chat.
  • Built in Apps for Nokia Lumia 800: Business apps, Reminders, Maps, calendar, Chat.

With iPhone already having over 500,000 applications already on their apple app store, windows marketplace is comparatively very new, applications will be seen flooding on the marketplace as well. You may want to view a few of our iPhone and other smartphone apps here.

Pricing:

iPhone 4S is priced at approx Rs. 45,000 for 16 GB model and approx Rs. 51,000 for 32 GB model in India. Where as in UK it is approx $499 and in US market it sells for approx $399. (Note: Prices will vary depending on data plans and network operators selected)

On other hand Nokia Lumia 800 approx cost in India is Rs.29,999. In UK it is priced at around $440 whereas in US markets it is available for around $580

All in all, seems like it might be a good reason for buying Nokia Lumia 800 phone for those who are still waiting to choose between Android, iPhone and other Smart Phones. It would be great if you can leave your opinion here. Looking forward to having an open discussion on this very interesting piece.

By

Team Member - Administrator

16
Aug

So far with all the previous blogs we have been quite familiar to various aspects like Dashboard and Action bar for a user friendly Interface for Android mobile application.

In this post we shall discuss about the Quick Action design pattern in more detail with which you will be  have a clear understanding of the significant parts of a typical user friendly interface.

Introduction:

As previously mentioned, Quick Actions are basically actions/functions in a popup bar that are triggered by specific visual elements/buttons/items on the screen. Quick Actions are used to display contextual actions typically used in list views but not limited to it. You can imagine a phone-book or contact list on the phone. Now, there are certain set of actions that will be common to all contacts in the views like; make a call, send message, edit contact or may be even transfer files by  Email, Bluetooth etc. Basically these functions that are common to items in a context can be put in the Quick Action bar. This way the screen is uncluttered and simple and more importantly we needn’t sacrifice on the actions needed.

After having learnt about  detailed source code for an Action bar, next let us begin with the creation of the Quick Actions bar. We will make this short and simple, so just follow on…

To begin with, the demo snaps look like this:

Step 1. Create Actionable Items

The below code snippet is used to create an actionable item i.e. the actions you would want to place in the quick action bar. Creating an actionable item involves specifying the title, setting an icon that represents the item which will help you relate to the action, and finally set a Listener for the action. The term itself is self-explanatory. Yes, it is used to determine the action to be performed when clicked or pressed. As far as the icon /image goes, it can be easily set by referring to it from the resources as is the case with any external resource set in android which you would aware of, I am most certain.


final QuickActionIcons edit = new QuickActionIcons();;

 edit.setTitle("Edit");
 edit.setIcon(getResources().getDrawable(R.drawable.edit));
 edit.setOnClickListener(new OnClickListener()
 {
 public void onClick(View v)
 {
 Toast.makeText(QuickActionSampleAppActivity.this,"Edit Contact",Toast.LENGTH_SHORT).show();
 }

 });]

The above actions can be repeated depending upon the number of actions to be put in.

With this, you have successfully created your actions. Next we shall create the quick action dialog that should be displayed on clicking some button or tab.

Step 2: Create Quick Action Dialog

This part is even simpler. Like in this example, when an item in the list view is clicked / pressed, a new quick action bar/dialog is created. Then all the actionable items that you have created in the previous step are appended one by one to the quick action bar. After this you simply have to specify the animation style i.e. how do you want the dialog to be displayed on screen.


resultPane.setOnItemClickListener(new OnItemClickListener() 
    {
		public void onItemClick(AdapterView<?> parent, View view, int position, long id)
		{
			QuickActionBar qab = new QuickActionBar(view);
			
			qab.addItem(edit);
			qab.addItem(call);
			qab.addItem(send_data);
			qab.setAnimationStyle(QuickActionBar.GROW_FROM_LEFT);
			
			qab.show();
		}
    });	

And then finally you display the created quick action bar.

Step 3: Create Animation Files

All animations that you specify will have to be supported by corresponding XML files that allow the animation to play out. These XML files will form a part of your resources. It‘s really not that difficult to create these animation files. Have a look at a sample below.

<strong></strong>

<set xmlns:android="http://schemas.android.com/apk/res/android">
 <scale
 android:fromXScale="0.3" android:toXScale="1.0"
 android:fromYScale="0.3" android:toYScale="1.0"
 android:pivotX="50%" android:pivotY="100%"
 android:duration="@android:integer/config_shortAnimTime"
 />
 <alpha
 android:interpolator="@android:anim/decelerate_interpolator"
 android:fromAlpha="0.0" android:toAlpha="1.0"
 android:duration="@android:integer/config_shortAnimTime"
 />
</set>


Step 4: Create Layouts for actionable Items and Quick Action Bar

Some additional things that you would have to do are create layouts for the quick action dialog and the actionable items. It’s as simple as the layouts that you are so used to creating in android day in and day out. Go on and have a look at the snippet for the quick action items any way.


<LinearLayout
 xmlns:android="http://schemas.android.com/apk/res/android"
 android:orientation="vertical"
 android:layout_width="fill_parent"
 android:layout_height="wrap_content"
 android:gravity="center_vertical|center_horizontal"
 android:paddingTop="0dip"
 android:paddingBottom="0dip"
 android:paddingLeft="20dip"
 android:paddingRight="20dip"
 android:clickable="true"
 android:background="@drawable/button_state">

 <ImageView
 android:id="@+id/image"
 android:layout_width="fill_parent"
 android:layout_height="wrap_content"/>

 <TextView
 android:id="@+id/caption"
 android:layout_width="fill_parent"
 android:layout_height="fill_parent"
 android:gravity="center_vertical"
 android:textSize="12sp"
 android:textColor="#ff000000"/>

</LinearLayout>

You may try out the quick action dialog layout by yourself. If you’re stuck you can refer to the complete source code on Quick Action that is available anyway.

By following these 4 simple steps , you are all set and ready to have quick action dialogs zooming around in your app. So go on and try them out.

With a few design guidelines on User Friendly Interface for Android followed by:

I am most certain that you can now design and develop an efficient interface. Should you have any questions on any topic, I would be pleased to answer them.

03
Aug

The previous posts on User Interface tips and Dashboard design pattern gave you a fair idea on how to get going with your User Interface.

In this post, we shall look at the Action Bar design pattern in more detail which will enable you to better understand and execute Action Bars on your user interface.

Introduction:

As previously mentioned, action bar is a bar placed atop the screen that houses all the essential actions used in an application. It contains only those actions that are common to the entire application, and not activity specific ones. It is very commonly used in most applications, some even before it was introduced as a design pattern.

The Twitter Application for Android is a prime example. It has an action bar that provides actions like refresh, search, messages etc. The Facebook app is another common app that uses this pattern. Imagine if every app had an action bar, how useful and user friendly it would be. Navigation can also be added there. For now, this should suffice. Let us take a look at how do you actually go about creating it. Of the 3 patterns this is the easiest pattern to implement. So let us try and implement this step by step in the same manner as described in Dashboard Design pattern. Please refer -Xoriant Source Code for Android Dashboard UI Pattern

Take a look at the images below :

Follow these few simple steps to get going with your Action Bar:

Step 1: Create Action Bar Class

First of all, you need to create an abstract base class that houses all the common functionalities like the lifecycle method and the” onClick” handlers similar to the dashboard. In this, “onClick” handlers refer to actions that need to be triggered when the actions on the action bar are clicked. This should be pretty simple, especially after doing it for the dashboard. But as always the sample snippet is available for your reference.

public abstract class ActionBarAppActivity extends Activity
{
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        //setContentView(R.layout.main);
    }

    public void onSearch(View v)
    {
    	startActivity (new Intent(getApplicationContext(), SearchActivity.class));
    }

    public void onHome (View v)
    {
    	return2Home(this);
    }

    public void return2Home(Context context)
    {
        final Intent intent = new Intent(context, HomeActivity.class);
        intent.setFlags (Intent.FLAG_ACTIVITY_CLEAR_TOP);
        context.startActivity (intent);
    }
}

Step 2: Create Layout For Action Bar

You have got your base class ready. That means half the job is done. Now simply create the layout for the home screen along with the action bar. Remember the title bar will not be present in the application. It will be replaced by the action bar. The layout must include an icon for home, the title of the current view and other options to be displayed on the bar. Don’t include more than 3 options as it looks cluttered. Creating layouts by now won’t be a hurdle. All you need is a couple of image views and text views. The necessary icons/images may be stored in the resources and referred to in the usual way. With the hints I have given you the layout shouldn’t take long to make. Anyhow a sample snippet is always there at your disposal. Take a look at the sample above. Just to remind you; it is only a snippet not the entire code.

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
			  android:orientation="horizontal"
			  android:layout_width = "fill_parent"
			  android:layout_height="wrap_content"
			  android:gravity="right"
			  android:layout_gravity="right">

			   <ImageButton style="@style/TitleBarOperation"
            			   android:src="@drawable/about_click"
            			   android:onClick="onAbout"
            			   android:layout_marginTop = "6dip"
            			   android:layout_marginBottom = "4dip"
            			   android:layout_marginLeft="5dip"
            			   android:background="@null"
            			   android:layout_marginRight="5dip"/>

			  <ImageView android:layout_width="1px"
			   android:layout_height="fill_parent"
			   android:background="@drawable/separator"
			   android:layout_marginLeft = "5dip"
			   android:layout_marginRight="5dip"
			   />

			  <ImageButton style="@style/TitleBarOperation"
            			   android:src="@drawable/search"
            			   android:layout_marginTop = "6dip"
            			   android:layout_marginBottom = "4dip"
            			   android:onClick="onSearch"
            			   android:background="@drawable/home_bg"
            			   android:layout_marginRight="5dip"/>
	</LinearLayout>

Step 3: Append Action Bar to all Activities and create layouts (Modify action bar in case of search)

Now all that remains is replicating the same layout of the home screen action bar across all the other activities. That is simple replication of the code. Also generate the layout for the remaining activities. In case of the search activity, only a slight modification will be needed to the action bar to include a search box as well. That is as simple as appending an edit text to the layout. Have a look at the code snippet below.

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
			  android:orientation="horizontal"
			  android:layout_width = "wrap_content"
			  android:layout_height="wrap_content"
			  android:gravity="left|center_vertical"
			  android:layout_gravity="left">

			  <ImageButton style="@style/TitleBarOperation"
            			   android:src="@drawable/home_def"
            			   android:background="@drawable/home_bg"
            			   android:onClick="onHome"
            			   android:layout_marginTop = "5dip"
            			   android:layout_marginRight="5dip"
            			   android:paddingBottom="3dip"
            			   android:layout_marginLeft = "4dip"
            			   android:layout_marginBottom = "4dip"
            			   android:layout_gravity="center"/>

              <ImageView android:layout_width="1px"
			   android:layout_height="fill_parent"
			   android:background="@drawable/separator"
			   android:layout_marginRight="5dip"/>

              <TextView style="@style/TitleBarText"
              			android:id = "@+id/title_text"
              			android:text = "Action Bar Sample"
              			/>

              <ImageView android:layout_width="1px"
			   android:layout_height="fill_parent"
			   android:background="@drawable/separator"
			   android:layout_marginLeft="5dip"
			   />

              <EditText android:id="@+id/input_text"
              			android:layout_height="fill_parent"
              			android:layout_width="100dip"
              			android:layout_marginTop="2dip"
              			android:layout_gravity="center"
              			android:textSize="10sp"
              			android:text = "search here..."
              			android:layout_marginLeft="5dip"
              			android:layout_marginRight="5dip"/>

			<ImageView android:layout_width="1px"
			   android:layout_height="fill_parent"
			   android:background="@drawable/separator"
			   android:layout_marginLeft="2dip"/>

Step 4: Modifying styles.xml

With this, your Action Bar is ready. All that remains is adding a few lines of code to your styles.xml file. This style must be appended to the manifest as a theme in the application tag. Basically these lines specify that there will be no title bar in the application, and instead will be overlaid by our own custom action bar. See the sample code to understand.

<style name="Theme.D1" parent="android:style/Theme.Light">
        <item name="android:windowNoTitle">true</item>
        <item name="android:windowContentOverlay">@null</item>
    </style>

We have successfully implemented the Action Bar by following these 4 simple steps. Now you can create your very own action bar with actions of your choice. With this we have completed 2 of  the 3 design patterns. The third pattern will soon follow. Only if could imagine how attractive your UI would be if you were to use all 3 patterns in an app. Hopefully you have understood and enjoyed learning these patterns as much as I  am pleased to share them.

Source Code

Should you require full source code for Action Bar, please refer Xoriant-Source Code for Android Action Bar.Like always you can leave your comments here and I will look forward to answering them.

There will be the next blog on design patterns for Quick Actions soon. So watch out for the space to complete your User Interface with third and final design pattern!!

28
Jul

The earlier post here has covered the importance and the basics of developing a user friendly UI, taking this further we will be presenting to you a detailed view of the design patterns discussed. The following post will cover the ‘Dashboard ‘ design pattern along with a step by step process to help you develop a dashboard yourself. The code snippets attached will allow you to learn and build the dashboard in no time.

Introduction:

Trust me when I say it’s too easy. Have you seen the Facebook application for Android? You will see the home screen has image icons for all major features of the application like messages, wall posts, friends, albums etc. This is exactly what a dashboard is. You might have actually used this before without even knowing it is a design pattern. The dashboard lets you highlight key/new features and provide easy navigation to various parts of the app. A detailed description of the same was given in my blog on User Interface Design Tips which I trust you would have read. Even if you haven’t, I would suggest going back to that article and reading it to get a clear picture of the dashboard design pattern. This will make this article a better read for you as it provides simple steps for creating your very own dashboard. So let’s begin!!!

A typical dashboard for any application may look like this:

Full source code for this sample application is available on xoriant’s public github repo - https://github.com/github-xoriant/Android-Dashboard-UI-Pattern

Listed are a few steps for creating a typical dashboard with precise detailing. Follow them to have a clear understanding

Step 1: Create Home Screen

Follow these codes to get your Home Screen in simplest possible way.

<LinearLayout android:orientation="vertical"
      				  android:layout_width="wrap_content"
      				  android:layout_height="wrap_content"
      				  android:layout_marginTop="60dip"
      				  android:layout_marginLeft="40dip" android:layout_marginBottom="40dip">

        	<ImageView android:id="@+id/photoAlbum"
            			 style="@style/Home"
            			 android:onClick="onPhotoAlbum"
           				 android:src="@drawable/photoalbum"/>

        	<TextView style="@style/HomeText"
        			  android:id="@+id/ph1"
        			  android:text="@string/photoAlbum"
        		  	  android:layout_marginTop="10dip"/>
</LinearLayout>
<LinearLayout style="@style/TitleBar"
    			  android:id="@+id/layout1">

       <ImageView style="@style/TitleBarLogo"
       			  android:id="@+id/img1"
                  android:src="@drawable/dashboard"
                  android:onClick="onHome"
            	  android:layout_marginTop = "5dip"
            	  android:layout_marginRight="5dip"
            	  android:layout_marginLeft="5dip"
            	  android:layout_marginBottom = "5dip"
            	  android:paddingBottom = "5dip"
            	  android:background="@null"
            	  android:layout_gravity="center"
            	  android:paddingLeft="5dip"
            	  android:paddingRight="7dip" />

        <ImageView android:layout_width="1px"
        		   android:layout_height="fill_parent"
        		   android:id="@+id/sep"
			       android:background="@drawable/separator"
			       android:layout_marginRight="7dip"
			   />

        <TextView style="@style/TitleBarText"
        		  android:id="@+id/tv1"
        		  android:paddingLeft = "8dip"
        		  android:text="@string/home"/>
</LinearLayout>

The first step is to create a simple layout for the home screen that will house the image buttons. As the name itself says these are simply buttons, which are represented by icons/images present in the resources folder. The layout must have a custom title bar at the top that displays the current location/screen that the user is on, along with a straight link to reach the home screen or the dashboard. All you have to use is the “onClick” attribute of the image view to direct the user to the respective location. The layout is very simple, and all you require is basic knowledge of layout creation which you must be an expert on by this time!!!  Anyway to make it easy have a look at the code snippet for creating an image view for the image icon and the title bar given above. Keep in mind this has to be done in a proper layout.

Step 2:Create Dashboard Abstract Class

Follow these codes to create your own Dashboard Abstract Class.

public abstract class DashboardAppActivity extends Activity
{
    /** Called when the activity is first created. */
    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
    }

    //Lifecycle Methods

    //App Click Methods

    public void onSearch(View v)
    {
    	startActivity (new Intent(getApplicationContext(), SearchActivity.class));
    }

    public void onAbout(View v)
    {
    	startActivity (new Intent(getApplicationContext(), AboutActivity.class));
    }

    public void return2Home(Context context)
    {
        final Intent intent = new Intent(context, HomeActivity.class);
        intent.setFlags (Intent.FLAG_ACTIVITY_CLEAR_TOP);
        context.startActivity (intent);
    }

    public void onHome (View v)
    {
    	return2Home(this);
    }
}

By now you will have your home screen ready with you. Now we just need to define the “On Click” handlers that will trigger the necessary action which could be starting a new activity or simply a toast. For this purpose all you need to do is simply define an abstract class, that will contain all the common code like lifecycle methods, On Click handlers for the icons on the dashboard and the title bar(home) as well. In our app we will have to define the handlers to redirect the user to new activities associated with the appropriate image icon. Once done, all your other activities in the application that have representations on the home page will inherit this abstract class. It’s very simple and I am pretty sure you can do this on your own. Just in case, a sample code snippet is available at your disposal as always!!!

Step 3:Create Activities and Layouts

Following are a few codes to help you create your Activities and Layouts.

public class AboutActivity extends DashboardAppActivity
{
	public void onCreate(Bundle savedInstanceState)
	{
	    super.onCreate(savedInstanceState);

	    setContentView (R.layout.about);
	    TextView tv = (TextView) findViewById (R.id.title_text);
	    if (tv != null)
	    {
	    	tv.setText(getTitle());
	    }
	}
}

So now your Dashboard is nearly done. All you need to do is create the activities for all functions that you have listed in the dashboard. Along with the activities you will need the XML Layouts as is the case with any basic activity in Android. These activities must extend the dashboard abstract class. Also, you need to write a few lines of code to display the name of the activity in the title bar.  You can have a look at the sample code given above.

Step 4:Understanding Styles

Finally, refer to the below given codes to Understand Styles.

<style name="TitleBar">
        <item name="android:id">@id/title_container</item>
        <item name="android:layout_width">fill_parent</item>
        <item name="android:layout_height">45dip</item>
        <item name="android:orientation">horizontal</item>
        <item name="android:background">@color/title_background</item>
    </style>

    <style name="TitleBarOperation">
        <item name="android:layout_width">45dip</item>
        <item name="android:layout_height">fill_parent</item>
    </style>

    <style name="TitleBarLogo">
        <item name="android:id">@id/title_logo</item>
        <item name="android:layout_width">wrap_content</item>
        <item name="android:layout_height">fill_parent</item>
 </style>

So now your dashboard is finally up and running.  Something that you will come across while going through the code is the regular use of styles. These styles are nothing new, and are very similar to style sheets used for  developing web pages. These styles have been defined in the styles.xml file, which is then referred in the app using their ids. A sample of the styles.xml file is given above.

So 4 simple steps and you have your dashboard set up. Now that was unbelievably easy as I had said. Hopefully this tutorial would have provided all the assistance that was required to create your very own creative dashboard.

Source Code

If there are still any problems you always have the complete source code of the app to fall back on Xoriant’s git hub repository. Xoriant- Source code for Android Dashboard UI Pattern

Also you can post your comments here and I will be more than happy to answer them.

I will soon be writing about yet another effective and easy design pattern, “The Action Bar” in my next blog. But till then keep experimenting with your dashboards!!!!

25
Jul

As most of you all know, the two key candidates for personal Git servers are gitosis and gitolite. The major differentiator between the two is the language in which they are written and the way they handle repo permissions.

The primary focus of this blog will revolve around how to setup a central server for git using gitolite to get started with project development. It is a Perl-based rewrite of Gitosis, is a more sophisticated Git server with more powerful features that has a lot more configuration options. With Gitolite, it’s possible to specify who is able to force a push to a Git branch, an operation that perhaps is challenging when working in teams.

Items that will be covered are:-

  1. Git server setup
  2. Contributors’ and Repository creation.

Git Sever setup:

Using Ubuntu and Gitolite to do the server setup and my workstation is a laptop running Windows 7 OS, let’s get started by following a few simple steps..

Step 1.

Logon to server and add gitolite on the server, you must be in the list of sudoers. If not ask your system administrator or the person who is having sudo rights.

sudo adduser  --system   --shell /bin/bash  --home /home/gitolite gitolite
sudo passwd gitolite
exit

Step2:

Install msygit on your windows workstation from – http://code.google.com/p/msysgit/ .  I have picked up a portable installation and changed my home folder to point somewhere in E:, I didn’t like everything to be in my default windows home folder. I followed this blog – http://markashleybell.com/articles/portable-git-windows-setting-home-environment-variable

It is not necessary though, a standard install will also work.

Once you Fire the git bash shell and run git –version; you should see something like this

Step 3:

Create the ssh public/private keypair on your workstation. This will required a password less login into remote system. As of now do not put a passphrase. Hit enter key for an empty passphrase.

ssh-keygen

Step 4:

Now go to your home directory by typing the following command

cd ~

Step 5:

Copy the public key to remote server into gitolite account, key in password when asked. The key will get saved as pradeep.pub on server in /home/gitolite

scp .ssh/id_rsa.pub gitolite@ubuntu:~/pradeep.pub

Step 6:

Logon to ubuntu as gitolite

git clone git://github.com/sitaramc/gitolite
cd gitolite
src/gl-system-install
cd
echo 'export PATH=$PATH:$HOME/bin' >> $HOME/.bashrc
. $HOME/.bashrc
echo $PATH
gl-setup $HOME/pradeep.pub

Step 7:

Finally  go to git bash shell on your workstation and clone gitolite

git clone gitolite@ubuntu:gitolite-admin

Contributors’ and Repository creation.

After having set up the git server on your workstation let’s move further to create a repository.

  • The admin is already set with userid pradeep. So will now try to add a user who is having only read/write access to one of the repositories .
  • Ask your team member, in this case Fahim, to send his public key over email or you can take it on a pen drive.
  • Put the key inside gitolite-admin keydir and edit the conf/gitolite.conf to make an entry for the user. Here, I am going to create a helloworld repo and add Fahim to have RW access to it. We just need to edit the conf/gitolite.conf file. Put a new line
  • Once you check status of the repo, it should show you: git status

  • Commit and push it to central server.
git add conf/gitolite.conf
git add keydir/fahim.pub
git commit –m ‘adding new user having read/write access to helloworld repo’
git push –all gitolite@ubuntu:gitolite-admin

So, It’s done ! We got our repository created and added to Gitolite with the help of these simple steps. Hope this serves as a complete guide to setup a git server.

20
Jul

The user interface plays one of the most important roles in determining how successfully you can attract and retain the users by making the UI easy to use, efficient and enjoyable. With decision making being increasingly influenced by the online medium, it’s scope is extended to mobile internet. So, it is required to enhance the user experience by developing user friendly interfaces for the apps on the go.

We all are well aware of what all features will be available on the mobile version of a product at hand.  But we are usually not sure about how to arrange them on screen(s), or decide on what framework controls to use to optimize the full potential of a particular product feature. At the end, the most important thing that must not be lost in the process is the simplicity, elegance and the vision, which invariably determines the success or failure of the application i.e. the application rank  in the market(read: popularity).

A good user experience is critical to any application, more so for mobile applications. A good UI will lead to better quality and user experience, eventually translating to popularity and profits. In such a scenario where the users are of utmost consideration in the design and planning of your application, a clean user friendly, simple and yet an innovative UI might just turn a whole lot of users to your application.  Doesn’t it sound appealing as to how something as simple as the aesthetics of an application can do?

Now, this is what we call as “Need of the hour”-But here comes the problem, does anyone know – what is a good UI? How should it look? What should it do? What should it not do, not contain!!!

In such a scenario where you know the problem but not the apt solution, it is always good to have a quick research on how others  got it right.  Abstraction of the problem statement and its respective solution when accepted by a community becomes a pattern. Earlier we had Design patterns for solving design problems of application architecture. “Evolution happened in UI” and now we have a similar set of patterns for the UI. Patterns have emerged as a natural by-product of the design process. Like Software Design Patterns, they too provide a solution to a common/recurring problem. Developing a good and an effective UI requires usage and understanding of these Design Patterns. The best of applications, , are focusing on the use of these design patterns including Twitter Apps, Facebook apps etc.

In this article I shall mainly be discussing these design patterns along with their applications and advantages in use for Android applications and in subsequent ones we shall have a look on how to go about actually creating them.

Dashboard

It has been used in applications even before it was officially introduced as a design pattern. For example, Facebook application has been providing a dashboard of its key functions before it was officially recognized as a design pattern. The Dashboard can be used in apps to highlight the key features of the application. In essence, it is an introduction to the application.  It can be used to reveal new content and capabilities to the user. The dashboard typically occupies the full screen to ensure that it stays out of the way, i.e. the user’s attention is not diverted to any other aspect of the screen/app. The Dashboard may be organized as:

  • Accounts
  • Features
  • Categories

The secondary functionality may be reserved for the Menu options. Thus by making the most common/important operations visible, it ensures that the right things are made visible to the user.

The Good

  • Highlight key features to user
  • Provide one stop access to all the major functions
  • Draw user attention to new capabilities or features introduced
  • Easy navigation around the app.

The Bad

  • All features cannot be represented on the dashboard
  • Some lesser known features not represented, may not get the desired user attention
  • Some represented features may not actually interest user, leading to loss in popularity.

Quick Actions

Quick Actions are basically actions/functions in a popup bar that are triggered by specific visual elements/buttons/items on the screen. They have minimal disruptive influences on the screen context. Quick actions ensure that the screen is not cluttered too much with icons and buttons, and at the same time these options are available to the user only when required. They are very straightforward, can be fast and fun to use. Only the most important and obvious options must be presented in the quick action view. When Items have competing internal options, quick items are typically used. In case of contexts that can/may have multiple selections, quick actions must not be used.

The Good

  • Uncluttered screen, free of too many icons and buttons
  • Minimal disruptive influence on the screen
  • Ensures that key functions can be present when needed
  • All operations/functions common to multiple items on a given screen can be placed in quick action bars.

The Bad

  • It cannot be used if context allows multiple options to be selected at once
  • Operations in the quick action bar are specific to one activity only.

Action Bar

The Action bar is typically located at the top of the screen, used to provide support for all the operations that are frequently used in the application and common to all aspects of the application. Navigation options are also provided in the action bar. It may include a home option to return to the dashboard activity or the main screen. It typically replaces the Title bar in an application. The action bar may be used to bring key actions on screen. Commonly used options present in the action bar include:

  • Search
  • New
  • Refresh
  • Stop
  • Back
  • Forward
  • Undo/Redo etc.

The Good

  • Uncluttered screen, free of too many icons
  • Easy access to key features at all times
  • Easy navigation
  • Indicates current location/state of the app.

The Bad

  • It is always present on top of the screen, taking up valuable space
  • It cannot include all functions of the application, jus t the important ones
  • Too many options (>5) in the action bar might make it clunky and heavy.

Thus ,we can summarize that the design patterns is the need of the hour which  will go a long way in providing a unified and consistent methodology for developing UI’s that will create a lasting impression on the users.

Keeping these fundamental points in mind while designing any user interface, you can get a kick start to your dream to develop the most user friendly interface.  But what about the design patters for Dashboards, Quick Actions and Action Bar?  I am looking forward to soon share these design patterns. So stay connected to have an interactive information sharing.

For more information, you may want to refer to Google’s session on Android UI Design Patterns