Wednesday, April 24, 2013

Runtastic PRO v3.6.5 Apk Android


Your personal tracking app for running, biking and other sports activities! Take your fitness to a new level with runtastic.
runtastic uses GPS to map your fitness activities - running, biking, walking - and track your progress (distance, speed, calories, and more). Be part of a global fitness community that is both fun and motivational.


PRO features:
* Voice feedback during a workout: Get audio feedback for each mile or kilometer
* Live tracking: Show your friends and family where you are
* Cheering: Hear cheers and receive messages live from your friends and be motivated to go even further
* Auto pause: Session is paused automatically when you stop movement (e.g. at a red light or tying your shoe). Works for running, biking, skating, cross-country skiing and handbiking.
* runtastic Earth View: Watch your workouts in 3D, including mountains, monuments and buildings (free Google Earth App required)
* Heart rate support: runtastic chest strap
* Heart rate zone training and analysis: Choose a heart rate zone to monitor and optimize your training (i.e. fat-burning zone)
* Split table with dynamic mile and kilometer split
* Calorie goal: Set a specific calorie goal and use the voice feedback to reach your workout goal
* Pace goal: Define your favorite pace
* Geotagging: Take pictures during a workout and see these pictures online at your map trace
* Weather and Temperature: Receive live weather information and save weather data automatically after a workout
* Prediction of sunset and sunrise
* Ad free
Features:
* Map your workouts in real-time with built-in GPS and monitor your progress (time, distance, speed, pace, calories, altitude, etc.)
* Personal workout diary and metrics
* Mapping: Detailed live mapping and historic mapping of previous sessions (Google maps)
* Dashboard configuration: Display preferred statistics
* Graphs: Get charts with altitude, pace, speed and heart rate information
* Performance analysis with lap times
* Enjoy your workouts with the integrated music player
* Set goals for time and distance
* Accurate calculation of elevation gain and loss
* Manual entry of workouts: Add treadmill, spinning and weight lifting workouts
* Monthly and overall metrics for distance, number of workouts, duration and calories
* Share your activities on Google+, Facebook and Twitter

You can save all your workouts at runtastic.com. Using the online community you’ll get further analysis, metrics and comparisons to your friends. Additionally, you can choose a training plan and track your body statistics.

Lucky Pather needed to Remove Verification

Click Here To Download
Direct Download Link - Direct Download Link


WWF Rhino Raid v1.0.1 Apk Android


It's about the most Rad-ical rhino to run across your screen - ever!
And he's on a mission for good - to save the rhinos of Southern Africa. Brought to you by the World Wide Fund for Nature (WWF) South Africa. Play now and save the rhinos.


Rad keeps up a running charge against poachers and their arsenal of weapons. With the help of his trusted ally, Horn Bill, Rad has to dodge the flying hand grenades and automatic rifle fire; jump over exploding barrels... then thump the poachers as you chase after their getaway trucks and get one charge closer to Mr Big, kingpin behind the international rhino poaching syndicates.

Rad's adventure across the African savannah is punctuated by WWF's key insights into facts about rhinos and the truth behind the rhino poaching scourge. Rhino Raid aims to create awareness of WWF's rhino conservation projects in South Africa. It's fun, it's for good ...and it's RAD!


HIGHLIGHTS:
- Educational content
- 9 Levels + 3 Boss battles
- 3 Comic strips
- Easy to learn one-touch gameplay
- Jump to catch Horn Bill for a power-up
- Share on Facebook and Twitter
- WWF link to rhino information and donation

Click Here To Download
Direct Download Link - Direct Download Link


implements OnBackStackChangedListener to display UP icon, automatically by getBackStackEntryCount()

Last exercise handle UP icon for Fragment navigation in hard code; call setDisplayHomeAsUpEnabled(true) when switch to MyDetailFragment, and call setDisplayHomeAsUpEnabled(false) when switch back to MyListFragment(). In case you have many Fragment Transaction, it's not a good approach to display the UP icon.

Alternatively, we can implements OnBackStackChangedListener, add it in FragmentManager by calling addOnBackStackChangedListener(), and override onBackStackChanged() method to check emptiness of back stack entry by calling getBackStackEntryCount(), then call setDisplayHomeAsUpEnabled() accordingly.

implements OnBackStackChangedListener to display UP icon, automatically by getBackStackEntryCount()


package com.example.androiddualmode;

import android.os.Bundle;
import android.app.Activity;
import android.app.Fragment;
import android.app.FragmentManager.OnBackStackChangedListener;
import android.app.FragmentTransaction;
import android.app.ListFragment;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.TextView;

public class MainActivity extends Activity implements OnBackStackChangedListener{

// if run on phone, isSinglePane = true
// if run on tablet, isSinglePane = false
static boolean isSinglePane;

static String[] month ={
"January", "February", "March", "April",
"May", "June", "July", "August",
"September", "October", "November", "December"};

public static class MyListFragment extends ListFragment {

@Override
public void onActivityCreated(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onActivityCreated(savedInstanceState);

ListAdapter myArrayAdapter =
new ArrayAdapter<String>(
getActivity(), android.R.layout.simple_list_item_1, month);
setListAdapter(myArrayAdapter);

}

@Override
public void onListItemClick(ListView l, View v, int position, long id) {

String clickedDetail = (String)l.getItemAtPosition(position);

if(isSinglePane == true){
/*
* The second fragment not yet loaded.
* Load MyDetailFragment by FragmentTransaction, and pass
* data from current fragment to second fragment via bundle.
*/
MyDetailFragment myDetailFragment = new MyDetailFragment();
Bundle bundle = new Bundle();
bundle.putString("KEY_DETAIL", clickedDetail);
myDetailFragment.setArguments(bundle);
FragmentTransaction fragmentTransaction =
getActivity().getFragmentManager().beginTransaction();
fragmentTransaction.replace(R.id.phone_container, myDetailFragment);

/*
* Add this transaction to the back stack.
* This means that the transaction will be remembered after it is
* committed, and will reverse its operation when later popped off
* the stack.
*/
fragmentTransaction.addToBackStack(null);

fragmentTransaction.commit();

//getActivity().getActionBar().setDisplayHomeAsUpEnabled(true);

}else{
/*
* Activity have two fragments. Pass data between fragments
* via reference to fragment
*/

//get reference to MyDetailFragment
MyDetailFragment myDetailFragment =
(MyDetailFragment)getFragmentManager().findFragmentById(R.id.detail_fragment);
myDetailFragment.updateDetail(clickedDetail);

}
}

}

public static class MyDetailFragment extends Fragment {

TextView textDetail;

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// TODO Auto-generated method stub
View view = inflater.inflate(R.layout.layout_detailfragment, null);
textDetail = (TextView)view.findViewById(R.id.text_detail);

Bundle bundle = getArguments();
if(bundle != null){
String detail = bundle.getString("KEY_DETAIL", "no argument pass");
textDetail.setText(detail);
}

return view;
}

public void updateDetail(String detail) {
textDetail.setText(detail);
}

}

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

View v = findViewById(R.id.phone_container);
if(v == null){
//it's run on tablet
isSinglePane = false;
/*
* MyListFragment and MyDetailFragment have been loaded in XML,
* no need load.
*/

}else{
//it's run on phone
//Load MyListFragment programmatically
isSinglePane = true;

if(savedInstanceState == null){
//if's the first time created
MyListFragment myListFragment = new MyListFragment();
FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
fragmentTransaction.add(R.id.phone_container, myListFragment);
fragmentTransaction.commit();
}
}

getFragmentManager().addOnBackStackChangedListener(this);
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
getFragmentManager().popBackStack();
//getActionBar().setDisplayHomeAsUpEnabled(false);
return true;
}

return super.onOptionsItemSelected(item);
}

final static String KEY_DISPLAY_OPT = "KEY_Display_Option";

@Override
protected void onSaveInstanceState(Bundle outState) {
// TODO Auto-generated method stub
super.onSaveInstanceState(outState);
outState.putInt(KEY_DISPLAY_OPT, getActionBar().getDisplayOptions());
}

@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onRestoreInstanceState(savedInstanceState);
int savedDisplayOpt = savedInstanceState.getInt(KEY_DISPLAY_OPT);
if(savedDisplayOpt != 0){
getActionBar().setDisplayOptions(savedDisplayOpt);
}
}

@Override
public void onBackStackChanged() {
int backStackEntryCount = getFragmentManager().getBackStackEntryCount();
if(backStackEntryCount > 0){
getActionBar().setDisplayHomeAsUpEnabled(true);
}else{
getActionBar().setDisplayHomeAsUpEnabled(false);
}
}

}


download filesDownload the files.

Next:
- Implement animation in FragmentTransaction


Tuesday, April 23, 2013

A.I.type Keyboard Plus v1.9.9.0 Apk Android


A.I.type's revolutionary keyboard will help you type faster and better! The best keyboard on the Android Market!
So, what makes A.I.type Keyboards simply THE BEST?
* It’s smart! The keyboard suggests your next word, completes your current word and corrects your typos based on the context of what you are writing.


* It gets smarter! As you type, the keyboard learns your common words, phrases and style, and improves its text prediction accordingly. We call it – MyType.

* It’s accurate! You don’t have to be very precise with the keys you hit. Even if you miss keys frequently, the keyboard will understand and correct you.

* It’s coooooool! You can change colors, themes, background images, fonts! You can resize the keyboard by dragging the resize key! You can make you keyboard look exactly like iPhone4, Windows Phone 7 or ICS (and more!)…

* It’s efficient! You have navigation buttons, you can undo and redo your changes, copy, cut and paste from the keyboard and more. ***And the newest feature: just swipe up to get a numeric / navigation / symbols row!***

* It supports so many languages! The keyboard has over 35 keyboard layouts, and other than in English, text prediction is provided in Spanish, German, French, Italian, Arabic, Russian, Dutch, Korean, Greek, Swedish and Hebrew.

* It’s safe! A.I.type never collects, analyzes or sends your personal information, passwords, credit card numbers etc.

* It warns you when it corrects your text! Well, it may sound trivial, but getting corrected without a notice is so annoying… So you get a visual indication before auto-correction is applied, and a beep after the correction.


A.I.type is the next word in predicting your next word!

Privacy notice: while installing A.I.type Keyboard, you will receive a warning message about collecting sensitive data. This is the standard general-purpose Android message issued for any downloaded keyboard and it does not pertain to A.I.type. Our keyboard DOES NOT COLLECT YOUR SENSITIVE DATA.

Psychic word completions and predictions are generated by A.I.type’s servers on the Cloud. When the device is offline or Internet connection is too slow, or if you disabled Cloud-based prediction, word suggestions will be generated by the device only.

Tags: keyboards best android gingerbread texting pro T9 compact better than multiling touchpal go hackers swiftkey
slideit smart perfect Ice Cream Sandwich ICS Thumb

If the cracked version does not work try following APK
Install APK and run with modded Google play by ChelpuS
If you have installed any Predictionary Pack or plugin outside from Google play remove them before install original APK

Click Here To Download
Direct Download Link - Direct Download Link


NotifierPro Plus v7.8 Apk Android


NotifierPro greatly improves the way your device displays notifications. With NotifierPro ( Notifier Pro ) you can greatly improve the way your device displays notifications.
This app provides banner notifications for any app installed on your phone.


Support :
* If you have any question or suggestion, please use our feedback page here : https://getsatisfaction.com/productigeeky.

The service :
* To work properly, NotifierPro requires that you activate the accessibility service "NotifierPro" (accessibility services are currently the only way to process user notifications on the Android OS).
* You then have to use the "Monitoring" section to choose which apps should raise notifications, and how.
* Status bar notifications must be enabled in the monitored apps for the banners to appear properly.

How to use it :
* Click the notification to launch it
* Swipe to the right to dismiss it
* Swipe to the left to dismiss notifications coming from the same app/contact

Important information :
* Note that dismissing the notification won’t remove it from the status bar (the Android OS doesn’t currently allow to manually remove 3rd party apps notifications from the status bar).
* If you use a custom lockscreen app such as MagicLocker or WidgetLocker, or if you use the stock Android 4 lockscreen, banners will show above your lockscreen.
* As a default, notifications will be enabled for SMS, MMS, missed calls, GMail, Talk, WhatsApp, Facebook, Twitter, Skype, etc...
* NotifierPro will notify you even if you're in a fullscreen app

Plus version :
* You can set individual settings for each app
* You can set a custom ringtone for each app
* You have access to 5 exclusives themes
* You can disable notifications during a call
* You can set banners to appear only when the screen is off
* You can choose the text position
* You can hide the icon
* You can choose the size for the banner
* You can set custom vibration patterns
* You can choose the action when you do a left or right swipe on the banner
* You can set quiet hours
* You can use reminders
* You can use privacy options
* You can display the contact picture for any app (experimental)

Click Here To Download
Direct Download Link - Direct Download Link


Display UP icon on action bar and implement BACK navigation in Fragment Transaction

Follow the exercise "Allow navigate BACK through FragmentTransaction, by calling addToBackStack()", we are going to add a UP icon on non-home fragment, MyDetailFragment, to navigate BACK in the task history.

UP icon on action bar


  • To display/hide the UP icon, call getActionBar().setDisplayHomeAsUpEnabled(true/false) method.
  • Handle MenuItem of android.R.id.home in onOptionsItemSelected() to detect the UP icon clicked event.
  • To navigate back, call getFragmentManager().popBackStack().
  • Save and restore DisplayOptions of ActionBar in onSaveInstanceState() and onRestoreInstanceState(). Otherwise, the UP icon will disappear after orientation changed.

Modify MainActivity.java in "Allow navigate BACK through FragmentTransaction, by calling addToBackStack()".

package com.example.androiddualmode;

import android.os.Bundle;
import android.app.Activity;
import android.app.Fragment;
import android.app.FragmentTransaction;
import android.app.ListFragment;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.TextView;

public class MainActivity extends Activity {

// if run on phone, isSinglePane = true
// if run on tablet, isSinglePane = false
static boolean isSinglePane;

static String[] month ={
"January", "February", "March", "April",
"May", "June", "July", "August",
"September", "October", "November", "December"};

public static class MyListFragment extends ListFragment {

@Override
public void onActivityCreated(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onActivityCreated(savedInstanceState);

ListAdapter myArrayAdapter =
new ArrayAdapter<String>(
getActivity(), android.R.layout.simple_list_item_1, month);
setListAdapter(myArrayAdapter);

}

@Override
public void onListItemClick(ListView l, View v, int position, long id) {

String clickedDetail = (String)l.getItemAtPosition(position);

if(isSinglePane == true){
/*
* The second fragment not yet loaded.
* Load MyDetailFragment by FragmentTransaction, and pass
* data from current fragment to second fragment via bundle.
*/
MyDetailFragment myDetailFragment = new MyDetailFragment();
Bundle bundle = new Bundle();
bundle.putString("KEY_DETAIL", clickedDetail);
myDetailFragment.setArguments(bundle);
FragmentTransaction fragmentTransaction =
getActivity().getFragmentManager().beginTransaction();
fragmentTransaction.replace(R.id.phone_container, myDetailFragment);

/*
* Add this transaction to the back stack.
* This means that the transaction will be remembered after it is
* committed, and will reverse its operation when later popped off
* the stack.
*/
fragmentTransaction.addToBackStack(null);

fragmentTransaction.commit();

getActivity().getActionBar().setDisplayHomeAsUpEnabled(true);

}else{
/*
* Activity have two fragments. Pass data between fragments
* via reference to fragment
*/

//get reference to MyDetailFragment
MyDetailFragment myDetailFragment =
(MyDetailFragment)getFragmentManager().findFragmentById(R.id.detail_fragment);
myDetailFragment.updateDetail(clickedDetail);

}
}

}

public static class MyDetailFragment extends Fragment {

TextView textDetail;

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// TODO Auto-generated method stub
View view = inflater.inflate(R.layout.layout_detailfragment, null);
textDetail = (TextView)view.findViewById(R.id.text_detail);

Bundle bundle = getArguments();
if(bundle != null){
String detail = bundle.getString("KEY_DETAIL", "no argument pass");
textDetail.setText(detail);
}

return view;
}

public void updateDetail(String detail) {
textDetail.setText(detail);
}

}

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

View v = findViewById(R.id.phone_container);
if(v == null){
//it's run on tablet
isSinglePane = false;
/*
* MyListFragment and MyDetailFragment have been loaded in XML,
* no need load.
*/

}else{
//it's run on phone
//Load MyListFragment programmatically
isSinglePane = true;

if(savedInstanceState == null){
//if's the first time created
MyListFragment myListFragment = new MyListFragment();
FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
fragmentTransaction.add(R.id.phone_container, myListFragment);
fragmentTransaction.commit();
}
}
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
getFragmentManager().popBackStack();
getActionBar().setDisplayHomeAsUpEnabled(false);
return true;
}

return super.onOptionsItemSelected(item);
}

final static String KEY_DISPLAY_OPT = "KEY_Display_Option";

@Override
protected void onSaveInstanceState(Bundle outState) {
// TODO Auto-generated method stub
super.onSaveInstanceState(outState);
outState.putInt(KEY_DISPLAY_OPT, getActionBar().getDisplayOptions());
}


@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onRestoreInstanceState(savedInstanceState);
int savedDisplayOpt = savedInstanceState.getInt(KEY_DISPLAY_OPT);
if(savedDisplayOpt != 0){
getActionBar().setDisplayOptions(savedDisplayOpt);
}
}

}


download filesDownload the files.

Next:
- implements OnBackStackChangedListener to display UP icon, automatically by getBackStackEntryCount()


Replace Fragment

In this exercise, we are doing Fragment replacement by Java code. There are three button on the main layout to select fragment to display, a container of FrameLayout to load fragments dynamically.

Replace Fragment dynamically


Main layout, activity_main.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:orientation="vertical"
tools:context=".MainActivity" >

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_world" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<Button
android:id="@+id/button1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Fragment 1"/>
<Button
android:id="@+id/button2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Fragment 2"/>
<Button
android:id="@+id/button3"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Fragment 3"/>

</LinearLayout>
<FrameLayout
android:id="@+id/maincontainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
>

</FrameLayout>

</LinearLayout>


The layouts of the fragments.

fragmentlayout_01.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:id="@+id/container1" >

<TextView
android:id="@+id/textmsg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Fragment 1" />
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/ic_launcher" />

</LinearLayout>


fragmentlayout_02.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:id="@+id/container2" >

<TextView
android:id="@+id/textmsg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Fragment 2" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_launcher" />

</LinearLayout>


fragmentlayout_03.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:id="@+id/container3" >

<TextView
android:id="@+id/textmsg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Fragment 3" />
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="center"
android:src="@drawable/ic_launcher" />

</LinearLayout>


Main code, MainActivity.java
package com.example.androidreplacefragment;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.TextView;

public class MainActivity extends FragmentActivity {

public static class MyFragment1 extends Fragment {

TextView textMsg;

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragmentlayout_01, null);
textMsg = (TextView)view.findViewById(R.id.textmsg);

Bundle bundle = getArguments();
if(bundle != null){
String msg = bundle.getString(KEY_MSG_1);
if(msg != null){
textMsg.setText(msg);
}
}

return view;
}

public void setMsg(String msg){
textMsg.setText(msg);
}

}

public static class MyFragment2 extends Fragment {

TextView textMsg;

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragmentlayout_02, null);
textMsg = (TextView)view.findViewById(R.id.textmsg);

Bundle bundle = getArguments();
if(bundle != null){
String msg = bundle.getString(KEY_MSG_2);
if(msg != null){
textMsg.setText(msg);
}
}

return view;
}

public void setMsg(String msg){
textMsg.setText(msg);
}

}

public static class MyFragment3 extends Fragment {

TextView textMsg;

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragmentlayout_03, null);
textMsg = (TextView)view.findViewById(R.id.textmsg);

Bundle bundle = getArguments();
if(bundle != null){
String msg = bundle.getString(KEY_MSG_3);
if(msg != null){
textMsg.setText(msg);
}
}

return view;
}

public void setMsg(String msg){
textMsg.setText(msg);
}

}

FrameLayout container;
FragmentManager myFragmentManager;
MyFragment1 myFragment1;
MyFragment2 myFragment2;
MyFragment3 myFragment3;
final static String TAG_1 = "FRAGMENT_1";
final static String TAG_2 = "FRAGMENT_2";
final static String TAG_3 = "FRAGMENT_3";
final static String KEY_MSG_1 = "FRAGMENT1_MSG";
final static String KEY_MSG_2 = "FRAGMENT2_MSG";
final static String KEY_MSG_3 = "FRAGMENT3_MSG";

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
container = (FrameLayout)findViewById(R.id.maincontainer);

Button button1 = (Button)findViewById(R.id.button1);
Button button2 = (Button)findViewById(R.id.button2);
Button button3 = (Button)findViewById(R.id.button3);

button1.setOnClickListener(new OnClickListener(){

@Override
public void onClick(View arg0) {

MyFragment1 fragment = (MyFragment1)myFragmentManager.findFragmentByTag(TAG_1);

if (fragment == null) {

Bundle bundle = new Bundle();
bundle.putString(KEY_MSG_1, "Replace MyFragment1");
myFragment1.setArguments(bundle);

FragmentTransaction fragmentTransaction = myFragmentManager.beginTransaction();
fragmentTransaction.replace(R.id.maincontainer, myFragment1, TAG_1);
fragmentTransaction.commit();

}else{

fragment.setMsg("MyFragment1 already loaded");
}
}});

button2.setOnClickListener(new OnClickListener(){

@Override
public void onClick(View arg0) {

MyFragment2 fragment = (MyFragment2)myFragmentManager.findFragmentByTag(TAG_2);

if (fragment == null) {

Bundle bundle = new Bundle();
bundle.putString(KEY_MSG_2, "Replace MyFragment2");
myFragment2.setArguments(bundle);

FragmentTransaction fragmentTransaction = myFragmentManager.beginTransaction();
fragmentTransaction.replace(R.id.maincontainer, myFragment2, TAG_2);
fragmentTransaction.commit();

}else{
fragment.setMsg("MyFragment2 already loaded");
}
}});

button3.setOnClickListener(new OnClickListener(){

@Override
public void onClick(View arg0) {

MyFragment3 fragment = (MyFragment3)myFragmentManager.findFragmentByTag(TAG_3);

if (fragment == null) {

Bundle bundle = new Bundle();
bundle.putString(KEY_MSG_3, "Replace MyFragment3");
myFragment3.setArguments(bundle);

FragmentTransaction fragmentTransaction = myFragmentManager.beginTransaction();
fragmentTransaction.replace(R.id.maincontainer, myFragment3, TAG_3);
fragmentTransaction.commit();

}else{
fragment.setMsg("MyFragment3 already loaded");
}
}});

myFragmentManager = getSupportFragmentManager();
myFragment1 = new MyFragment1();
myFragment2 = new MyFragment2();
myFragment3 = new MyFragment3();

if(savedInstanceState == null){
//if's the first time created

FragmentTransaction fragmentTransaction = myFragmentManager.beginTransaction();
fragmentTransaction.add(R.id.maincontainer, myFragment1, TAG_1);
fragmentTransaction.commit();
}
}

}


download filesDownload the files.



Related:
- Dual display mode using Fragment step-by-step - one-pane with fragment transaction for phone, two-pane for tablet