Category Archives: Fragment

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 »

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 »

Using DialogFragments in Android – A Simple example.

By | February 14, 2013

A little on Dialog Fragments A fragment that displays a dialog window, floating on top of its activity’s window. This fragment contains a Dialog object, which it displays as appropriate based on the fragment’s state. Control of the dialog (deciding when to show, hide, dismiss it) should be done through the API here, not with… Read More »