[Android Software/Hacking General [Developers Only]] Androguide.fr:
Yeah I work in Eclipse.

To make a tabs + swipe navigation like in PmR it's pretty simple, you just need to setup a ViewPager and change your activities to fragments, but in order to make it compatible with froyo & gb you want to use a library called ActionBarSherlock, which is basically an extension of the v4 support library.

So now you need to add ABS as a library to your app. I'll try to do it step by step :

So first, go ahead and download ActionBarSherlock

Then open Eclipse and do "File/Import/Existing code into workspace", this will import the library to your workspace (obviously)

Do a right-click on your app's folder in eclipse and go to Properties --> Android

In the Android section of the properties, you'll see a box (the lower one) that says "Libraries", click on "Add" and select ActionBarSherlock

Ok now, how to setup the actual swipe-able ViewPager with actionbar tabs :

Create a new layout xml file (right-click your app -> new -> Android XML Layout File, let's call it main.xml

Paste this code into it :

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >

<android.support.v4.view.ViewPager
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</android.support.v4.view.ViewPager>
</LinearLayout>

Now create a new class (right-click your app -> new -> Class), let's call it ViewPager.java

Paste this code into it :

package com.yourapp.mbqsniper;

import java.util.ArrayList;

import com.yourapp.mbqsniper.R;
import android.content.Context;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.view.ViewPager;
import android.widget.TextView;

import com.actionbarsherlock.app.ActionBar;
import com.actionbarsherlock.app.ActionBar.Tab;
import com.actionbarsherlock.app.SherlockFragmentActivity;

public class ViewPagerMainMenu extends SherlockFragmentActivity {

ViewPager mViewPager;
TabsAdapter mTabsAdapter;
TextView tabCenter;
TextView tabText;

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

mViewPager = new ViewPager(this);
mViewPager.setId(R.id.pager);

setContentView(mViewPager);
ActionBar bar = getSupportActionBar();
bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

mTabsAdapter = new TabsAdapter(this, mViewPager);

mTabsAdapter.addTab(bar.newTab().setText("Main Menu"), MainMenu.class,
null);
mTabsAdapter.addTab(bar.newTab().setText("Tools"), Tools.class, null);
mTabsAdapter.addTab(bar.newTab().setText("Tweaks"), Tweaks.class, null);
mTabsAdapter.addTab(bar.newTab().setText("Apps & Mods"),
AppsMods.class, null);
mTabsAdapter.addTab(bar.newTab().setText("Extras"), Extras.class, null);
mTabsAdapter.addTab(bar.newTab().setText("About"), About.class, null);
mTabsAdapter.addTab(bar.newTab().setText("Help Center"),
HelpCenter.class, null);

}

public static class TabsAdapter extends FragmentPagerAdapter implements
ActionBar.TabListener, ViewPager.OnPageChangeListener {
private final Context mContext;
private final ActionBar mActionBar;
private final ViewPager mViewPager;
private final ArrayList<TabInfo> mTabs = new ArrayList<TabInfo>();

static final class TabInfo {
private final Class<?> clss;
private final Bundle args;

TabInfo(Class<?> _class, Bundle _args) {
clss = _class;
args = _args;
}
}

public TabsAdapter(SherlockFragmentActivity activity, ViewPager pager) {
super(activity.getSupportFragmentManager());
mContext = activity;
mActionBar = activity.getSupportActionBar();
mViewPager = pager;
mViewPager.setAdapter(this);
mViewPager.setOnPageChangeListener(this);
}

public void addTab(ActionBar.Tab tab, Class<?> clss, Bundle args) {
TabInfo info = new TabInfo(clss, args);
tab.setTag(info);
tab.setTabListener(this);
mTabs.add(info);
mActionBar.addTab(tab);
notifyDataSetChanged();
}

@Override
public int getCount() {
return mTabs.size();
}

@Override
public Fragment getItem(int position) {
TabInfo info = mTabs.get(position);
return Fragment.instantiate(mContext, info.clss.getName(),
info.args);
}

public void onPageScrolled(int position, float positionOffset,
int positionOffsetPixels) {
}

public void onPageSelected(int position) {
mActionBar.setSelectedNavigationItem(position);
}

public void onPageScrollStateChanged(int state) {
}

public void onTabSelected(Tab tab, FragmentTransaction ft) {
Object tag = tab.getTag();
for (int i = 0; i < mTabs.size(); i++) {
if (mTabs.get(i) == tag) {
mViewPager.setCurrentItem(i);
}
}
}

public void onTabUnselected(Tab tab, FragmentTransaction ft) {
}

public void onTabReselected(Tab tab, FragmentTransaction ft) {
}
}
}

Where you replace

mTabsAdapter.addTab(bar.newTab().setText("Main Menu"), MainMenu.class,
null);

With the actual name of the tabs (here "Main Menu" and the class where your fragment is (here MainMenu.class) (we'll get to fragments in a minute)

Now we need to add this to our AndroidManifest.xml to make the ViewPager.java an activity, here it's going to be the launcher activity (the first thing the user sees when he opens your app) :

<activity
android:name="com.androguide.pimp.my.rom.ViewPager"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

Now the tabs & swipe UI is set up, but we need to get it to display the actual UI of your app.

We're going to take PmR's welcome page as an example.

Here's the layout (mainMenu.xml) :

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >

<ImageView
android:id="@+id/imageView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitXY"
android:src="@drawable/pimp_bg" />

<ImageView
android:id="@+id/imageView2"
android:layout_width="115dp"
android:layout_height="115dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:src="@drawable/pmr_logo_white" />

<ImageView
android:id="@+id/imageView3"
android:layout_width="278dp"
android:layout_height="50dp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="33dp"
android:src="@drawable/pmr_aio_app" />

<ImageView
android:id="@+id/imageView4"
android:layout_width="222dp"
android:layout_height="60dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="20dp"
android:src="@drawable/pmr_to_navigate" />

</RelativeLayout>

MainMenu.java :

package com.androguide.pimp.my.rom;

import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.content.pm.PackageInfo;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RelativeLayout;
import android.widget.Toast;

import com.actionbarsherlock.app.SherlockFragment;
import com.actionbarsherlock.app.SherlockFragmentActivity;
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuInflater;
import com.actionbarsherlock.view.MenuItem;
import com.stericson.RootTools.RootTools;

public class MainMenu extends SherlockFragment {

private static final String PRIVATE_PREF = "myapp";
private static final String VERSION_KEY = "version_number";
private static final String BACKUP_KEY = "backup_toggle";

private SherlockFragmentActivity fa;
private RelativeLayout rl;

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
setHasOptionsMenu(true);

fa = super.getSherlockActivity();
rl = (RelativeLayout) inflater.inflate(R.layout.main_menu, container,
false);

init();

if (RootTools.isBusyboxAvailable()) {
// busybox exists, do something

if (RootTools.isRootAvailable()) {
// su exists, do something

} else {
Context context = fa.getApplicationContext();
CharSequence txt = "Do you have root permissions ?";
int duration = Toast.LENGTH_LONG;
Toast toast = Toast.makeText(context, txt, duration);
toast.show();
RootTools.offerSuperUser(fa);
}

} else {
Context context = fa.getApplicationContext();
CharSequence txt = "Busybox not found ! Please install it !";
int duration = Toast.LENGTH_LONG;
Toast toast = Toast.makeText(context, txt, duration);
toast.show();
RootTools.offerBusyBox(fa);
}

return rl;
}

private void init() {
SharedPreferences sharedPref = fa.getSharedPreferences(PRIVATE_PREF,
Context.MODE_PRIVATE);
int currentVersionNumber = 0;

int savedVersionNumber = sharedPref.getInt(VERSION_KEY, 0);
int backup = sharedPref.getInt(BACKUP_KEY, 0);

try {
PackageInfo pi = fa.getPackageManager().getPackageInfo(
fa.getPackageName(), 0);
currentVersionNumber = pi.versionCode;
} catch (Exception e) {
}

if (currentVersionNumber > savedVersionNumber) {
showWhatsNewDialog();

Editor editor = sharedPref.edit();

editor.putInt(VERSION_KEY, currentVersionNumber);
editor.commit();
}
}

private void showWhatsNewDialog() {
LayoutInflater inflater = LayoutInflater.from(fa);

View view = inflater.inflate(R.layout.dialog_whatsnew, null);

Builder builder = new AlertDialog.Builder(fa);

builder.setView(view).setTitle("Changelog")
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
});

builder.create().show();
}

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
inflater.inflate(R.menu.main, menu);

}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle item selection
switch (item.getItemId()) {
case R.id.main_menu:
Intent MainIntent = new Intent(fa.getBaseContext(),
ViewPagerMainMenu.class);
startActivity(MainIntent);
return true;

case R.id.tools:
Intent ToolsIntent = new Intent(fa.getBaseContext(),
ViewPagerMainTools.class);
startActivity(ToolsIntent);
return true;

case R.id.tweaks:
Intent TweaksIntent = new Intent(fa.getBaseContext(),
ViewPagerMainTweaks.class);
startActivity(TweaksIntent);
return true;

case R.id.mods:
Intent ModsIntent = new Intent(fa.getBaseContext(),
ViewPagerMainMods.class);
startActivity(ModsIntent);
return true;

case R.id.extras:
Intent ExtrasIntent = new Intent(fa.getBaseContext(),
ViewPagerMainExtras.class);
startActivity(ExtrasIntent);
return true;

case R.id.help:
Intent HelpIntent = new Intent(fa.getBaseContext(),
ViewPagerMainHelp.class);
startActivity(HelpIntent);
return true;

case R.id.about:
Intent AboutIntent = new Intent(fa.getBaseContext(),
ViewPagerMainAbout.class);
startActivity(AboutIntent);
return true;

case R.id.settings:
Intent SettingsIntent = new Intent(fa.getBaseContext(),
Settings.class);
startActivity(SettingsIntent);
return true;

default:
return super.onOptionsItemSelected(item);
}
}

}

Don't attach too much importance to the actual code here, what I want to show you is how to transform your current activities to fragments so that they can be used with the ViewPager so you actually get the swipe-able tabs UI.

First, after the imports, I guess you currently have something like :

public class MainMenu extends Activity {

You need to change it to extend the SherlockFragment class, like so :

public class MainMenu extends SherlockFragment {

Now, we're going to initialize 2 variables that you're going to need to include in pretty much all your fragments in order to get the right context. So, after the "{" of what we just wrote, you wanna add this (replace RelativeLayout with the type of the upmost element of your layout) :

private SherlockFragmentActivity fa;
private RelativeLayout rl;

Now, in the onCreate() method of your activity, add this (change R.layout.mainMenu with the actual name of your layout) :

//This is the onCreate()
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
setHasOptionsMenu(true);

//This is what you wanna add :
fa = super.getSherlockActivity();
ll = (RelativeLayout) inflater.inflate(R.layout.mainMenu, container,
false);

Now, it's kinda hard to explain, but the code I link should help you figure it out.

The "fa" variable we just initialized is going to be your Context pretty much, so you're going to replace most of the "this" in your activity with "fa", and most of the methods that start with "get" are going to need "fa." before them (i.e : getBaseContext() becomes fa.getBaseContext())

The "rl" variable we created is going to be used for all variables initialisations that refer to your layout, for example let's say you have a button in your layout :

<Button
android:id="@+id/button1"
style="?android:attr/buttonStyleSmall"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/apply_selected_button"/>

and you want to refer to this button in your java code :

in an Activity :

Button b = (Button) findViewById(R.id.button1);

in a Fragment :

Button b = (Button) rl.findViewById(R.id.button1);

Refer to this code and to the errors Eclipse will throw.

It would be easier for me to explain if I could see your actual current code, so you can see what needs to be done, really.

Pm me the code of one of your activities if you mind posting it here, I'll change it to a fragment so you can refer to it for your other ones.

Hope this helps you figure it out, sorry if it's unclear.