Top "Android-fragments" questions

Fragments represent reusable behaviors or portions of the user interface in an Android app.

findViewById in Fragment

I am trying to create an ImageView in a Fragment which will refer to the ImageView element which I have …

android android-fragments android-imageview findviewbyid
Android Fragment handle back button press

I have some fragments in my activity [1], [2], [3], [4], [5], [6] And on Back Button Press I must to return from [2] to [1] if current …

android android-fragments
Using context in a fragment

How can I get the context in a fragment? I need to use my database whose constructor takes in the …

java android android-fragments android-context
How to implement onBackPressed() in Fragments?

Is there a way in which we can implement onBackPressed() in Android Fragment similar to the way in which we …

android android-fragments onbackpressed
Send data from activity to fragment in Android

I have two classes. First is activity, second is a fragment where I have some EditText. In activity I have …

android android-fragments
How do I add a Fragment to an Activity with a programmatically created content view

I want to add a Fragment to an Activity that implements its layout programmatically. I looked over the Fragment documentation …

android android-3.0-honeycomb android-fragments
How do I get the currently displayed fragment?

I am playing with fragments in Android. I know I can change a fragment by using the following code: FragmentManager …

android android-layout android-intent android-fragments
onActivityResult is not being called in Fragment

The activity hosting this fragment has its onActivityResult called when the camera activity returns. My fragment starts an activity for …

android android-fragments android-activity
Best practice for instantiating a new Android Fragment

I have seen two general practices to instantiate a new Fragment in an application: Fragment newFragment = new MyFragment(); and Fragment …

android android-fragments
IllegalStateException: Can not perform this action after onSaveInstanceState with ViewPager

I'm getting user reports from my app in the market, delivering the following exception: java.lang.IllegalStateException: Can not perform …

android android-fragments android-viewpager illegalstateexception fragmenttransaction