package com.karan.android.activity;

import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;

import com.karan.android.fragments.ContactListFragment;
import com.karan.android.R;
import com.karan.android.fragments.SearchFragment;

public class MainActivity extends FragmentActivity implements SearchFragment.onSearchListener {

	ContactListFragment mContactsListFragment;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		mContactsListFragment = getContactListFragment();
	}

	private ContactListFragment getContactListFragment() {
		
		if( mContactsListFragment == null ) {
			FragmentManager fragmentManager = getSupportFragmentManager();
			mContactsListFragment = (ContactListFragment)
	                fragmentManager.findFragmentById(R.id.contactListFragment);
			
		}
		return mContactsListFragment;
	}

	/**
	 * SearchFragment.onSearchListener
	 * */
	@Override
	public void queryByString(String searchString) {
		
		mContactsListFragment = getContactListFragment();
		/**
		 * One pane fragment - 2 Fragments are in same screen
		 * */
		if( mContactsListFragment != null ) {
			mContactsListFragment.searchForContact(ContactListFragment.SEARCH_QUERY_MODE, searchString);
		}
			
	}
	
	/**
	 * SearchFragment.onSearchListener
	 * */
	@Override
	public void queryByAlphabet(String alphabet) {
		
		mContactsListFragment = getContactListFragment();
		/**
		 * One pane fragment - 2 Fragments are in same screen
		 * */
		if( mContactsListFragment != null ) {
			mContactsListFragment.searchForContact(ContactListFragment.SEARCH_ALPHABET_MODE, alphabet);
		}
		
	}

	
}
@@ -384,17 +384,16 @@
 tener %7B%0A
-%0A
 %09Contact
@@ -687,19 +687,16 @@
 ent() %7B%0A
-%09%09%0A
 %09%09if( mC
@@ -919,20 +919,16 @@
 gment);%0A
-%09%09%09%0A
 %09%09%7D%0A%09%09re
@@ -1067,18 +1067,16 @@
 tring) %7B
-%0A%09
 %09%0A%09%09mCon
@@ -1330,18 +1330,16 @@
 ng);%0A%09%09%7D
-%0A%09
 %09%09%0A%09%7D%0A%09%0A
@@ -1445,19 +1445,16 @@
 abet) %7B%0A
-%09%09%0A
 %09%09mConta
@@ -1711,13 +1711,8 @@
 %09%7D%0A%09
-%09%0A%09%7D%0A%0A%09%0A%7D
+%7D%0A%7D%0A

Update MainActivity