Tag: android-fragments

DrawerLayout – Exception dispatching input event

I recently started using the DrawerLayout in a new project about a week ago and it’s all working fine. Apart from the odd times when swiping it in and out with my finger it’ll crash. If I use the ActionBar Up/Home MenuItem though, it’ll work fine every time. In LogCat i get two stacktraces that […]

Android Actionbar Sherlock with Tabs

I am trying to implement ActionBar Sherlock with Tabs below that as shown in the above wire-frame. Should i use TabActivity ? – since i saw that it is deprecated. Which is the best way to achieve the same.

Can I create Fragment ListActivity with compatibility package v4?

I’ve been trying to complete tutorial “Working with fragments” which was designed for android 3.0+ To acomplish that I’m using compatibility package v4 (since my API is 7). However I’m stuck on the lists. I couldn’t find straight answer. I’m getting a ClassNotFoundException. I inherited fragment class from FragmentActivity but what about my ListActivity? There […]

Android fragment show as dialogfragment or usual fragment

What I am trying to achieve is to have a fragment that on tablet it shows as a DialogFragment, while on smartphone it would be shown as a regular fragment. I am aware there is already a similar post, but I am not able to make that work – apply the style to fragment. To […]

Fragments, with the same menu, on the same layout cause duplicated menuitem

I have a layout which has 2 fragments. These fragments uses the same menu, because I have another layouts that has only one of these (used in small screen device). My problem is menu items of each fragments shows in the menu, and since they’re from the same menu, they are duplicated to each others. […]

Fragments seems to be overkill? No MVC architecture possible?

i started with fragments a few days ago, but it seems wired for me. I dont see the justified advantage for the heavy increase of complexity. I dont know, if i should implement the functionality in my Activity or in my Fragment. First, i tried to put it in the fragments but that often seems […]

Call fragment from fragment

i have an activity with button on it and when a click i call the fragment with another button on fragment. but when click on fragment’s button i cant call a second fragment. this is my source, pretty simple: activity_main.xml: <LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android” xmlns:tools=”http://schemas.android.com/tools” android:layout_width=”match_parent” android:layout_height=”match_parent” android:orientation=”horizontal” tools:context=”.MainActivity” > <Button android:id=”@+id/btn_click” android:text=”Call Fragment” android:layout_height=”wrap_content” android:layout_width=”fill_parent” android:onClick=”onClick” […]

DrawerLayout with Admob ad

I am using Navigation-Drawer in my application.So I have created single activity with navigation_drawer layout.I am using fragments to change main content area(@+id/content_frame) data whenever user chooses a menu option from navigation drawer menu.Now my problem is that I want to show admob ad on every screen.I could used fragments to initialize ad layout and […]

Android mapview with fragments can't be added twice?

I am using the android compatibility class with the hack for using mapviews in a fragment found here: https://github.com/petedoyle/android-support-v4-googlemaps Unfortunately, what I am finding is that if the mapfragment gets removed from the activity, and then readded, I get the “You are only allowed to have a single MapView in a MapActivity” error.” I understand […]

ViewPager inside ScrollView – vertical scroll doesn't work

So, I have this ScrollView with one child – a LinearLayout that has two children: a TextView and a ViewPager. ViewPager contains layout with many elements, that’s why i need the ability to scroll vertically. Only pages in ViewPager may be scrolled horizontally (that is: I’d like to swipe horizontally only within the ViewPager). That […]

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