Im trying to have a card flip animation between activities. I looked at the example given by google but i only got more confused on how it works. I want to be able to click a button and have the card flip animation between two activites. Is there any examples on how to do this using a button and two activities?
As per my knowledge,3D transitions are not supported by window manager.
Behind this there is a reason, that to achieve FLIP animation both views must be loaded to show mirror effect. While activities are stand alone processes in Android.
So If you want such animations better you use fragments rather activities.
But If you still want it with activities. Here is the alternative Click
You may again go through the developer site. They have used fragments. With the use of fragments it is easily achievable. You need a one activity and other fragments to achieve the desire functionality.
Related
I would like to have a barcode reader/generator in my app, preferably in one activity. For iOS i think this can be done using a segmented view controller. How would I do this in android? Or should i just put them on two different activities?
Assuming from what I could understand from your question:
you could use a ViewPager, you can read more at http://developer.android.com/training/implementing-navigation/lateral.html
Or if you want the look and feel of IOS segmented control, probably you could create two buttons and change fragments based on which button has been clicked.
Take a look at this (assuming you understand fragments)
How to replace a Fragment on button click of that fragment?
Fragments are close to UIViews in IOS. If you are not well versed with fragments, this might help http://www.tutorialspoint.com/android/android_fragments.htm
I'm looking for the the best way to reproduce, in an Android app, the behavior of the iPhone UiNavigationController within an UITabBarController.
I'm working on this Android app where I have a TabActivity and 4 tabs. I've already gone through a lot of posts regarding the use of activities and tabs and how it's not a good idea to use activities for everything, which seems fair enough. I decided to use one Activity on each tab anyway, since it makes sense in my application.
However, in one of those activities I have a deep navigation tree with more than one branch and up to 12 different views the user can go through.
The problem is: Android controls the navigation through activities inside an app, if you click the back button it will go to the previous one, but if I'm navigating through views, using one Activity, and I click back, it just finishes it. So how can I have a smooth navigation behavior between views in an Activity?
I had implemented this using a TabActivity with FragmentActivity as each tab. Utilizing Fragments API you can organize the code just like you would be using 12 different activities, still using only 1 for each tab in fact. Fragment's framework will handle back key press for you to show previous fragment instead of closing the entire activity.
There are some problems with such approach, for example, there's no MapFragment, but the workarounds can be found here on SOF.
You will need Android Support Package if your minimum SDK version is lower than 3.0.
Well I know very little about UiNavigationViewController, but I guess you want something to navigate between different Views. As you are using TabActivity, every tab should load into a separate Activity.
But since you want to branch it out, using that many Activities is not a perfect solution, neither the ActivityGroup too. The better solution, as per my opinion(I have run into similar problem once) is to have the main or root tabs loads into separate Activity, but for their branches, use the ViewFlipper, which flips the Views. So the whole Layout(Subclass of View) can be flipped.
You may run into some problem while flipping more than two Views (as what people say, though I never had any problem). So in that case you can use layout.setVisibility(View.GONE) to hide the layout and just change it with View.VISIBLE for next view.
And about the concerns of back button, you need to store the last used View or Activity into a variable, and in the override of onBackPressed(), just need to call them.
There might be better solution than this, not that I can remember, but yeah it's the easiest solution I can come up with.
I am trying to build an app in which I want to go to a new page through swipe-say. I have about 10 different pages and I want to go to these pages by swiping. Can I implement these pages as separate activities? Can I swipe from one activity to another? I strongly like to implement these pages in seperate xml files rather than creating everything in a single xml page. But as far as I have searched, there are no proper tutorials or blogs giving an appropriate example of a program implementing swipe. If possible, provide some working codes.
Thanks in advance.
It seems that a FragmentPager is what you want.
Examples and code on the linked page.
If you build for earlier versions of Android, the necessary code is included in the Android Support Package.
In Android, swipe is not identified as a particular gesture.
You can use a OnTouchListener registered on your view, and animate your view if the gesture exeeds a certain threshold.
You can then launch a new activity, or in a simpler way, use a viewFlipper.
Please try the attached link View flow.
I feel it will fit your needs perfectly. You can even create different xmls and inflate them into different view objects and then use the "view flow" to switch between them.
The "view flow" is perfect for handling both simple & complicated views. The flow indicator on the top of the screen is optional.
I hope it helps..
I'm developing an android application and I want flipping in my application (like iPhone).
When the user touches the screen and swipes left or right it should change the activity.
Does anyone have suggestions as to how I could implement this in code?
try this
http://www.inter-fuser.com/2009/08/android-animations-3d-flip.html
I have another Solution:
If you want to flip not only one view but the whole screen with all views, you have only one possibility: you must use Fragment and flip them. For this use google solution: google example
So in your project use mix structure activities and fragments
When transitioning between activities, such as calling startActivity(); or when using the back button, the screen slides in from the sides.
Is there any way to alter this? I have a flash-card like application, so when I move from activity A to activity B I would like the screen to flip over like turning a real flash card.
Is there any way to do this out of the box? Or does this require some custom animations?
Since Android 2.0 (API Level 5), you can use Activity.overridePendingTransition specify an explicit transition animation .
see http://developer.android.com/reference/android/app/Activity.html#overridePendingTransition(int, int)
As far as I know, the applications have no control over the transitions between their activities.
What you could do is merge the two activities using a custom ViewGroup that changes between the two Views using any animation you like. It's not trivial but should certainly be doable.