Tag: android-fragments

Android: OnClickListener unresponsive on Initial Load?

I’m facing a weird issue and I’m not sure what’s causing it. Basically, I’m using the ErrorFragment class to display an error, simple right? The problem has to do with setting the button click listener using setButtonClickListener. When MainFragment is initially loaded, the button does not register any clicks with my Android TV remote. However, […]

Two panel UI with Fragments vs Separate activities

I am starting a Honeycomb application that will have a basic two panel layout, one panel on the left for the menu and one on the right for the main functionality of each section. Contrary to the available samples of the Fragments API the content displayed on the right panel consists of a completely different […]

Android Studio default “Tabbed Activity”, how to swipe through fragments?

Complete beginner here.. I have used the “Tabbed Activity” default from the New Project Wizard. I am trying to get it to swipe through 3 different fragments, however I simply cant see where to tell the program to do it. Do I load them in as an array, if yes where should I do it […]

DataPicker looks like old design on new API's as well

So the problem is very simple: I have integrated a DatePicker in my application. Not as a DialogDatePicker but as a View component (more precisely a View inside of a Fragment that is dynamically shown and removed from a FrameLayout contained in my main FragmentActiviy layout.). now my problem is that this DataPicker looks like […]

Why my facebook android sdk login called two times?

I am working with the Facebook SDK, the problem is the FormSubmit function has run two times. It is called by the getView function which is called by onCreateView and by the statusCallback, how to fix it? public class Home extends Fragment implements LoginListener { public View rootView; public ImageView HomeBg; public ImageView buttonLoginLogout; public […]

Skip some fragments onBackPressed

I am fairly new with android fragments so please bear with me. I have a bunch of fragments using a single activity as host. In my mind, my fragments are grouped by sections although they are still modular/reusable by code. Consider this desired scenario: Frag1 -> (Press Next) -> Frag2 -> (Press Next) -> Frag3 […]

Why it's recommended not to retain fragment with UI?

I read that retaining fragment with ui and references on views can cause memory leaks. Than I create test app with fragment where I store some references on views and set setRetaineInstance(true), but several screen rotation does not cause any leaks. MAT says that I have only one instance of parent activity. What I’m doing […]

Android managing fragments from activity elegantly

Description of what I’m trying to accomplish: I have an app that uses a FragmentActivity with a LinearLayout as a container for the fragments. I click different buttons on the FragmentActivity UI and add and remove Fragments to the container in the FragmentActivity. In addition to clicking buttons on the FragmentActivity UI, each Fragment also […]

Programatically add fragments to viewgroup

basically this is my app(idea) for a tablet landscape orientation: Two Fragments, left fragment is a listfragment populated by a resource.xml file (Got that working). Right fragment is supposed to dynamically change fragment and layout based on which list item the user clicks. Googling so far told me that I need to programatically add and […]

RecyclerView inside SwipeRefreshLayout inside NestedScrollViewLayout cannot scroll

I have an activity with collapsing toolbar and a nested scroll view with a FrameLayout that I place the fragments in it. Initially, I place in it a FragmentA with a CardView . Works great. When I click a button though I replace that FragmentB with another one containing a RecyclerView . When I add […]

Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.