Activity/Fragments & Action Bar - android

I'm really new to Android and I want to implement listview and tab action bar:
Home page:
A list that has action bar on top with two tabs (swipe left/right).
The items in the list are clickable.
Detail page:
One of the tab will just have some content
The other is another list with unclickable items
What should I use?
A listview activity or a listview fragment for the home page?
Or does anyone know of an example that is similar to this?
I don't care about backwards compatibility (for now)
Thanks in advance!!

I think this Android Developers' tutorial is pretty self explanatory. You should be able to figure it out from that.
I'd suggest you go with fragments as they're the newest way; whereas activities are getting old now. This will make it easier for your application to accommodate future Android updates.
This may also help you out regarding Fragments.

Related

android adding a second tab bar

i am developing an android application that contains tabs. my application is like this:
Please notice that I have an action bar that contains many tabs.
Now I want to add an extra tab bar. what i mean is: in the players activity i want to have anotion action bar. for example players under 21 years and players above 21 years
how can i do that please?
what i have tried
i tried manking many bottons with view pager. and when the user press on any button, i slide the view pager. it works good. but i would like to know if there is a standard solution.
hint
i think that action bar at the top and ation bar at the botton will help. but i don't know if this is available.
thank u very mush.
The framework provides TabHost, which you can bind to the ViewPager from by setting an OnTabChangedListener and changing the current page based on the selection. It's slightly more complicated than just using buttons, but you get the tab theme

Android ActionBar Sherlock Swipe Gesture Recogniser

I have an application that has action bar sherlock and SlidingMenu integrated in it, the application has only 3 pages, and they're static pages, so no big deal about them. I have one activity and 3 fragments that i am changing when using the sliding menu.
What i want to achieve is something like this image
I want the user to be able to swipe with his finger on the ActionBar, and when that happens i change the fragment that is being displayed.
Note: i got the gesture recogniser from this awesome answer, but i can't seem to find a way to attach it to the ActionBar.
If i could put a View on the action bar and detect swipe on it, that would be great, but how can i do that ?!?
One last thing, how to implement this "Page Control" in android ?!?
So the answer to my question is that i simply created a custom_actionbar.xml, and then i used this to do the following:
View custom = LayoutInflater.from(this).inflate(R.layout.actionbar_custom, null);
getActionBar().setCustomView(custom);
// and you can use the things in the custom action bar like following !!
Button btnLeft = (Button) custom.findViewById(R.id.btnMenu);
Hope it helps someone :)

create app with menu at the bottom (like many iphone apps), how to organize activity / fragments

I want to create a app with a menu at the bottom of the screen. This menu should be visible any time the app is started.
Im working with fragments, so the menu is one fragment.
So I have only one Activity as controller which loads different fragments above the menu fragment.
Because I want to create clean code, i dont know how to solve the problem that the Activity class is too big.
In other words, i want to create different controller within the same activity. How to do that?
Is there another approach to solve this issue?
You should be using the split action bar This allows you to put the Actions and overflow menu on the bottom of the screen. I believe you can use Action Bar Sherlock for backwards compatibility to older versions of Android. See their site for detail.
Another possibility is to look into using fragments with the ViewPager . Here is a library that works with compatability as well ViewPageIndicator . Here is a blog post , like I indicated in my comment I got this working with the tabs showing at the bottom and the pages above.

ActionBarSherlock Tab, ViewPager and MultiFragments like Foursquare

I want to create an ActionBarSherlock with tab navigation and ViewPager like Foursquare. I'm using the code located in this page. What I want is in the first tab (Friends tab in printscreen), I want to create new Fragment from main Fragment. Briefly, in Foursquare, Friends tab has a timeline that shows check-ins of your friends and if you click a check-in row, it goes to detail of this check-in. My desire is the same as Foursquare did. How can I manage this operation (creating new window -Fragment or Activity-) using ActionBarSherlock with tab navigation and ViewPager?
I have the same problem, that´s the menu I want to create with two bars but, for the moment, I can´t.
I found this article in Android developers forum http://developer.android.com/design/patterns/actionbar.html they talk about different Action Bars under the title Layout Considerations for Split Action Bars:
The top would be the Main action bar. In your example: foursqare, refresh and set place
Top bar: for the tabs. Friends, explore, me
Bottom bar: at the bottom of the screen
I don´t if someone solved your problem if so please tell me if you used this
Thanks

Show tab bar and listIn Actionbar at same time. (Android Honeycomb)

There is a situation in which I want to use Tab bar as well as List navigation, Both at same time in Action bar.
Documentation says 'we can put Actionbar in to list navigation mode or tabs navigation mode'.
Is there any way to use both at same time. Any pointers, help. Thank you in Advance.
Sorry, you can only have one or the other.
That being said, you can use android:actionLayout to convert an options menu item into a custom inflated layout in the action bar. You might be able to use the "tabs navigation mode" while putting your own Spinner to the right of the tabs this way. Personally, I would find this confusing as a user, but perhaps it will work for your use case.
a very late answer, but this is possible by a simple hack. You just have to replace (programatically) the view that is pointed by android.R.id.action_bar_title with a Spinner. I wrote a blog about it. Here's the link

Categories

Resources