Category Archives: Fragments

Custom Transitions in ANDROID.

By | February 5, 2016

Here we are going to create custom transitions for a fragment. We will create transitions using Java classes by extending the Transition Class in Android. ChangeColor.java is the java class that extends transition. ChangeColor.java CustomTransitionFragment is the Fragment to which we are going to apply the transition. The MainActivity that adds the fragment. Download the… Read More »

How to handle configuration change in an activity using Fragments in android?

By | October 6, 2013

Here is a simple example in which we will save or retain the state of the progress using fragments. Note : We have handle a configuration by another way – by ignoring the change i.e using this property in the activity tag android:configChanges=”” By using this android ignores the configuration change and will never try… Read More »

FlipCard animation using Fragments in Android.

By | August 17, 2013

Hello all I am back with fragments again. I know you have seen a lot of posts on fragments and fragment animation. This one will be another useful post for you. This post helps you to show a FlipCard animation using Fragments. Let us see how can we do this. At first I will show… Read More »

How to get a return value from a DialogFragment? or Using DialogFragments in android.

By | July 1, 2013

Hello all…… This post examples how to get an edittext value from a dialog fragment. You can use the same method to get a button click from a dialog or events like that. You can click on the download link to get the source code. At first we will create a layout for the Dialog… Read More »

Use of custom animations in a FragmentTransaction when pushing and popping a stack. or How to apply animations in Fragments when pushing on to a stack?

By | June 13, 2013

Hello all We have seen many examples of how to use fragments in android. You can search coderzheaven for all types of transactions using Fragments. Today in this post we will see how we can apply animations to Fragments when pushing on to a stack. This is fairly a long example. I will try to… Read More »

How to display a context menu from a fragment?

By | June 9, 2013

Hello all I think you all know about the context menu in android. It appears as a popup when you long press something. Fragment also provides some methods for registering with the contextmenu and showing it. Let’s see how we can do it. You can click on the download links to download the source code.… Read More »

How to initialize a Fragements with attributes as a Bundle at runtime and from attributes in a layout?

By | June 6, 2013

This post Demonstrates a fragment that can be configured through both Bundle arguments and layout attributes. You can click on the links to download the source code. Here there are two fragments in the layout, one is directly in the layout and the other is created dynamically with arguments at runtime. Here is how we… Read More »

How to hide and show a Fragment with animation in Android? and How to retain a state in a Fragment in Android?

By | June 5, 2013

Hello everyone This posts helps you to hide and show a fragment with animation (without XML files animation). And also it shows how to retain a saved state(for eg: a value in a textview). A little about Fragments A Fragments is an independent component which can be connected to an activity. A Fragment typically defines… Read More »

How to create layouts that change according to the phone and Tablet in Android Using Fragments in SDK Less than HoneyComb?

By | February 19, 2013

Hello all….. This is a simple tutorial to show how to create a FLEXIBLE UI for both Phone and Tablets in Android. In the figure below you can see the result after running this tutorial. Tablet in LANDSCAPE MODE TABLET IN PORTRAIT MODE TABLET IN PORTRAIT MODE – AFTER CLICKING THE LIST. PHONE IN PORTRAIT… Read More »

How to create layouts that change according to the phone and Tablet in Android Using Fragments?

By | February 17, 2013

Hello all….. This is a simple tutorial to show how to create a FLEXIBLE UI for both Phone and Tablets in Android. In the figure below you can see the result after running this tutorial. Tablet in LANDSCAPE MODE TABLET IN PORTRAIT MODE TABLET IN PORTRAIT MODE – AFTER CLICKING THE LIST. PHONE IN PORTRAIT… Read More »

How to create Swiping Windows in Android from Android 2.1 onwards?

By | November 28, 2012

Have you seen the Google Play application in your Android phone. Wondered about how they implemented swiping windows in it. Don’t Worry, Here is an example which implements it. Here we will create three pages which can be swiped to access it. These are the three layouts for the three sections. section1.xml section2.xml section3.xml Now… Read More »