Keep footer for multiple activities - android

I'm creating an app which requires the footer to remain constant among various activities. That is, when animating to another activity, the footer doesn't animate with it - it stays there. Here is an example of what I mean: http://www.youtube.com/watch?v=EwXjdTvVXHQ&feature=related
I know it's an awesome app, but please don't forget my question ;)

Use Fragments to switch out your content, then you can keep one activity with the same footer. Fragments are backported all the way to Donut.

Use only one activity with footer and body in your app, switches and animates body only just like switches in activities.

Create a dummy class that extends an Activity and add footer to it.using xml (or the sameway you would do for other activity).
And extend this class in your app wherever you want footer.

Related

How can I add multiple activity to the same screen in android

I want to divide my screen into four parts and add activities in each part. I am not interested in using fragment. Each activity should behave independent of other. Attached photo is showing what I exactly want to do.
In each child activity I want to add VideoView or WebView depending on the selection from menu item.
How can I do it. I didn't find any way to add activity to an activity.
Thanks :)
PS: Activity means Activity not fragment.
i strongly recommend 'using fragments' in your case as ActivityGroup is deprecated in API 13..
The only way you can do it by using fragments. Here is the simple example on how to add multiple fragments on single activity Link
Edit link
You can achieve this design by using four fragments, one for each child view inside a single activity.
The recommended way is to create a single XML layout for your activity, and create four fragments inside that layout.

How to select the activity and the fragment

What scenarios using fragments what scenario using the activity , How can I make sure you when to use the activity when using fragments !
Basically, when you want a fixed portion of the screen and the rest will be changing, you want to use fragments.
If all your app is going to be on different screens, you want to use Activities.
Anyway, at least you will need one activity to hold your fragments.
Hope this helps.
As i know,You need to extend the fragment when you are displaying the view into tabs.
Otherwise you can extend activity.
It depends on your requirement. if u want to expose your toolbar throughout your application you can use fragment both activity and fragment are quite similar . You can also use only one activity remaining things may be your fragment
It depends on UI which you are creating.
If you are creating Multi-Pane UI then you should use Fragment.
And if you are creating some part of screen which can be reused then for that part you should create Fragment as Fragment is meant for re-usability.
If you are creating stand-alone screen then you should use Activity
For more info please refer this link How to choose Activity or Fragment if both scenarios are possible?

How to use multiple Fragment in single activity in different times

I am making an app in which the header and footer would be same through out the app. i can start another activity with the same pattern of design in header and footer but as the other activity starts there comes a delay and we can easily notice that a new activity has pop up.
So what I want :
I want that if user click on any button from the footer the content in the middle between header and footer should be change and user should not see any jump which is made when I move to other activity.
So for this I know that I can use fragments. But for some reasons I can not use fragment activity. All I want to move fragment in the center only. So How can i do that . and How can I initialize other things which are in new fragment let say the upcoming fragment could have button so in this way , I wanted to know would it make my main activity heavy which is calling all these fragment
So please guide me through the demo code .
Note: please do not refer me to a fragment link just past some code to give me some idea.
Will be easiest to have the activity implement the header and footer and the variable content as fragments.
Please refer to this post. It has everything you need
Fixed header and footer in android app

Common footer layout in all activities

I am developing a local music player application in which I am having a common view (player) that has four button (play, pause, previous and next).
I need to use that view in all activities ie. song list, album list, artist list.
In sort user should be able to operate player from all screens.
One way is to create a common activity and extends that activity in all actvity and inflate player layout but in this case i have to implement click events in all activities.
what is the best way to implement this.
many thanks.
The best approach to this is by using Fragments. Create a fragment which connects to the service and provides an UI to control it, then add this fragment to all the activities where you need it or add the activity to a parent activity and extend it by using inheritance in all the child activities.
Make a footer layout file and then use include in all layout file you want to display that footer,
<include layout="#layout/footer" />
use weightSum to manage height of footer in all screen
OR
you can also try switching activities without animation.

Using Fragments to switch activities

I'm trying to create a layout that has a stationary footer with activities that slide behind it. I've been told to use Fragments, but that would mean that I would have to convert my already existing Activities to Fragments - right? Here is a diagram of what I'm trying to achieve: http://i.imgur.com/K8Iao.jpg
What I think #TarunMaheshwari is trying to say is that instead of having 3 activities (eg. classes with extends activity), replace it with extends fragment (obviously there are other minor changes you might have to make for the code to work) and then create a main activity (with extends FragmentActivity) that has the static footer you want which can call on the 3 different fragments.
Recommended readings:
http://developer.android.com/guide/topics/fundamentals/fragments.html
http://android-developers.blogspot.ca/2011/02/android-30-fragments-api.html
I believe using fragments is the right solution for your app. However, from what I understand from your question and comments, you really want to avoid using them. To use activities instead of fragments, implement a Tab Layout with a Tab Host and Tab Widget as explained in this tutorial. This solution allows you to use the tabs to switch between activities.
To align the Tab Host to the bottom of the screen, have a look at this tutorial.

Categories

Resources