Swiping between XML layouts in Android - android

I'm right now working on a launcher app and I have three Activities. User is on 2nd Activity by default and when user swipes left it should take him to 3rd Activity and when user swipes right it should take user to 1st Activity. Just like Swipable Tabs but the Tabs should not appear. Is it possible? Best example is of Home Screen, I want it exactly as Home Screen. I've tried a lot! But I'm not getting what ACTUALLY I want, any help would be gladly appreciated, thanks!

I hope I can get you well.
First personally I don't suggest achieving this goal by using multiple activity. A better way might be one activity containing multiple fragment.
Then if you do so, several tools can make help, ViewPager for example.
If you want to add some view page indicator, as what the homescreen looks like, then ViewPagerIndicator might be a good choice.
Hope it helps.

Related

Swipe Feature To go To Next Activity

I am making an app where user can make a survey which contains questions, I have buttons to go to the next questions but I also want him to be able to swipe left to go to the next question. How can I implement That?
Thanks in advance.
I strongly recommend you to use viewpager or horizontal recyclerview against activity . A question per activity is not good idea .
Good luck

How can I show two activities at a time in android

I have 2 activities, In first activity I have a button and I want when user clicks or move up that button the second activity come from bottom and stop when it goes to the half of the screen. I don't understand how can I achieve this. I also searched google but they show some type of dialog boxes :(.
This is what I want. When app start 1st activity is shown on the screen but when user click ^ this button both 2 activities show 50% on the screen.
Can anybody tell me how can I achieve this. Is it possible???
You would achieve this using Fragments.
I would suggest you start with the offical documentation - https://developer.android.com/training/basics/fragments/index.html
In order to create the interface above you could use fragments instead of activity.
In your case you need to have an activity with two fragments (you can use coordinatorlayout).
If you don't have enough knowledge about fragments I recommend to read those articles:
Codepath fragments guide
Vogella fragments guide
Convert Activity to Fragment and use <FrameLayout> on page to display/remove fragments from page.
Fragments are reusable components Refer to convert Activity to Fragment
This might help you understand how to work with Fragments link
You should read about fragments. They can be used for the UI you described. You can make it so that a second fragment is GONE, and when the user presses a button, it becomes visible. You should probably use a relative layout for the two fragments.

Display part on another Activity (or Fragment?) Android

I have to deal with two ActionBar displayed at the same time on the screen. There's an onClickListener on the second one which allows the second activity to be shown on the entire screen after a click, with an animation.
I have no idea how to do that. Two activies, fragments? ViewPager? ... Absolutely no idea. Could you please help me? Thank you.
EDIT : here is a picture of what I wanna achieve http://romainpellerin.eu/so_android.png
You have to see it in order to clearly understand my problem.
Definitely Fragments.
When you bring in the second fragment specify animations in the fragment transaction before you commit it.
There are tons of tutorials online. Here some more help.
Android Fragments and animation
SDK
http://developer.android.com/guide/components/fragments.html
how to make fragments backwards compatible
http://developer.android.com/training/basics/fragments/support-lib.html

Android: two activities, one tab

What I want to do is the following:
I have 4 tabs in total, but in 1 tab i want to have multiple screens which the user can change using the menu
I can capture the event of when the user presses the right button, so no help needed there:)
what I can't do is starting the Activity without removing the TabBar!
I found some information about changing the view of the framelayout, but i really want to start another activity in the layout, not just change the view (I want to keep my code clean you see;)
thanks in advance
so in Tab A I want to be able to use Activity A and B
The only solution I found is still replacing the view, but doing it through ActivityGroup, so the code would still look normally and would be separated in activities. Works great, but there still is needs for hacks like back button press and stuff.
Scrapped this idea, though, since later I wanted more flexible and more stylish tab bar, so I wrote my own. Works like a charm and took some 2 working days to code.

Swipe among activities in android

i have 4 activities in which i have to swipe them right, left and if i am in last activity and swipe to the left then again first activity should be shown.
can anybody have any idea how i can achieve this? or some sample code?
thanks a lot.
you can achieve it by animaton..
But it will show as a Gallery view and you can swipe as well...
OnTouchEvent on every activity you can call another activity using intents by
overridePendingTransition(R.anim.act_back_slide_enter, R.anim.act_back_slide_leave);
//overridePendingTransition("animation for activity which enters", "animation for activity which leaves");
I have not yet tried this... but we can make it in this form.. If you get success let me know.
#sajjoo Here goes your answer in deezapps widget with the questions below pointing at it
How to show multiple screens with right/left slide Gesture
How to create a slider screen (As in Tweetdeck) in Android?
and many more linked questions..
I recently posted a question that covers a lot of this (my question is about using Swipe together with ScrollView, the Swipe gesture by itself works just fine):
Swipe/Fling tab-changing in conjunction with ScrollView?
If you read the sources I have listed and use the code I've provided then you should be able to do it.
It's work fine... just must to delete the redundant R.java file...!
http://www.codeshogun.com/blog/2009/04/16/how-to-implement-swipe-action-in-android/

Categories

Resources