When you mention the term transaction the first thing that probably comes to mind is finance. Making financial transactions in your bank or something like that.

The noun transaction_ comes from the verb transact. The verb transact was based on the Latin language term transigere which is dated 1500-1600 and means to drive throgh or to carry to completion or to finish according to Merriam-Webster’s Collegiate Dictionary.

However that term is not limited to business or financial transaction only.

We can also transact fragments, or do a Fragment Transaction instead of a Business Transaction. And this basically means carrying a set of operations on Fragments.

Android Framework provides us with a set of APIs that allow us to complete these Fragment Transactions.

These APIs are encapuslated in a class called FragmentTransaction. FragmentTransaction was added in API level 1 of android. That class is class. This basically means that it provides generalizations to it’s subclasses and is not exactly a concrete class itself.


Variations of FragmentTransaction class.

Android as a Framework loves to support older devices hence it provides variations of various APIs common known as support libraries that can provide compatibility with those devices as old as methuselah.

FragmentTransaction is no exception and provides with :

  1. android.app.FragmentTransaction
  2. android.support.v4.app.FragmentTransaction – supports platforms prior to Android 3.0.

FragmentTransaction Programmatic Definition

Let’s now see it’s programmatic definition using code as opposed to words.

First it’s a class. A class is blueprint for creation of objects:

..class FragmentTransaction..{..}

As a class it resides in a package like all other classes in java.

package android.app;

The above is the FragmentTransaction defined in the Framework.
However there is also the second variation defined in the support framework to target devices prior to Android 3.0:

package android.support.v4.app;

It’s a public class meaning that it’s visible to classes within it’s or other packages:

public class FragmentTransaction..{}

However it’s also an abstract class:

public abstract class FragmentTransaction ..{}

Lastly it derives from java.lang.Object like all other classes in java.

public abstract class FragmentTransaction extends Object {}