Horizontal Paging/Swipe views - android

I have a quiz app which loads questions into a textview, answers in radiobuttons which is wrapped in a scrollview. Currently I'm using next and previous buttons which work but I'd rather use swiping to control that. How do I implement this so that I can get animations of the page being dragged kind of like the tabs in the google play music app.
I've googled around and seen viewpager used a lot, but I don't know if that's right for what I want to do. I've also considered using viewflipper but again I don't know if that's right. And I wouldn't know how to use either of those in an animated drag fashion.
There's the possibility of hundreds of questions one after another which might be a factor.
Thank you!

How do I implement this so that I can get animations of the page being dragged kind of like the tabs in the google play music app.
Use a ViewPager.
There's the possibility of hundreds of questions one after another which might be a factor.
Rewrite your app to not ask the user "hundreds of questions one after another", then. Having a single quiz that long would be annoying in any medium, IMHO.
From a coding standpoint, depending upon what else is going on in your app, memory might become an issue using ViewPager, ViewFlipper, or pretty much anything other than a single set of radio buttons whose captions you change as the user moves from question to question.

Related

AutoCapture Screen views and button clicks events globally in without manually putting them on every screen and button

I was looking for some auto event capture for every screen and button clicks without manually putting them on every single button or Activity/Fragment and I could find few. But I am really curious to know what to going under the hood and how are they getting these info about screen views and button clicks.
Looking for some tips to create my custom auto capture events in Android App.
You just have your tracking logic in global screen renderer, or button click listener, using whatever available there (screen ids, button ids, class names) to put in your events.
However, this only works if you don't hack around and always use the same methods for rendering and navigations.
Soon enough, the product owner will ask you to make a transparent screen, or to have a screen that flows from right to left, or a screen that opens only to a 1/3 of the screen, or a pop-up, or an overlay, or a weird iframe. You'll have to have defined tracking for those separately.
And then, on top of that, the Analytics team will donate their bit of discord where they don't want to see transparent screens as new screenviews, but also track red buttons differently from green ones. And Toggles should be tracked differently too. By the way, the screen class names aren't useful for analytics, please name them manually. And also, buttons that look like links should be tracked this special way. And don't track the buttons that are just tooltips. Oh, the iframes. The iframes issue messages on activity in them, so listen to those and translate them to events please.
Now, this is an example of what it's going to be like. In real life, it's even more than that. If you have to add an exception for your universal tracking every time Analytics doesn't like it, you will end up with a mess of nested logic that is impossible to maintain. Also, every change to it will cause more bugs in unexpected places than fixes.
Still, universal tracking makes sense when you don't have dedicated analysts or a large marketing team and so you don't want to be able to answer complex business questions frequently.
In all other cases, it's better to hardcode analytics in a structured manner, maybe mapping screen ids to screen names in one neat place, then have analytics sdk wrappers to store the core logic and make use of the name mapping,

Choose infinite scroll or automatic paging in mobile app?

I'm creating a mobile app that will show images to a user, abit like twitter,facebook,instagram etc. What I've noticed is that they often use infinite scrolling. I've been considering going this road but at the same time I've never really liked infinite scrolling as it feels like i'm not getting anywhere and it makes me kind of exhausted quickly. Therefore I'm considering making a paging variant of infinite scroll that instead. When the user reaches the bottom, he/she automatically gets to a new page and the scroll is at the top again. By getting back to the previous page he/she must just scroll upp and the first page will load and the scroller will start on the bottom of this page.
I know this question could be answered in many various ways and it's alot about personal preference but i still figured i put this out here to see what you guys think about this topic. I've seen some similar question but mostly regarding websites.
Question:
what do you think suits best in mobile devices(infinite or paging to load more content, keep in mind that the user isn't searching for any specific item in the list just simply scrolling) and why?
Thanks!
I think you should go for infinite scrolling, as you said user is not looking for something specific, so user would prefer scrolling until he gets bore. Just like FB posts, you scroll down to the end and it then fetches the older posts. But paging should be used just like FB for the better performance.
The idea of new page isn't much nice as when user scrolls upwards he believes that it's just continuous and wouldn't like to take on new page every time he reaches to the top or bottom.

How is Android's Instagram structured? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I'm building an android app which, although it has a completely different function, has a very similar UI to Instagram. There is a bottom bar with buttons for viewing timeline, posting (my app's content), checking notifications, and viewing your own profile.
I am a fourth year electrical engineering student, but I am relatively new to Android development. In order to teach myself more stuff faster, I went ahead and made a lot of the functions of my app (like viewing posts, profile, timeline, friends, etc.) their own activities with their own bottom bar (which are just buttons as of now). In doing this I have learned a lot about development and have built an app that, for what I have built out so far, functions as it's supposed to, but is not too fast or pretty. I realize this is probably not the best practice and I wanted to ask you all what you think a simple explanation of how to implement an Instagram-like UI would be? When I say Instagram-like I mainly mean: it includes a bottom bar; the app "preserves" where a user is, like if I'm viewing a friend from the timeline, then press the view profile button, then press the timeline again, then I will still be viewing my friend.
I have tried to read up as much as I could to tackle the redesign but I'm still a little fuzzy on the standard for doing something like this.Should I try TabHost (which is deprecated)? should each button represent an activity with swappable views (for example in IG I click a post on my timeline and it swaps to the pictures post view)? Should I associate an activity with each button and swap fragments based on where the user navigates? I realize this is an open ended question, and I hope it's not too vague for Stack Overflow, but I have thought about it a great deal, and I would appreciate the feedback of some more experienced developers! Thanks!
You can use the new TabLayout that is contained in the support design library along with a view pager to switch between your different fragments.
You can read about the TabLayout as well as some of the other things packed in to the design library here.
Reference for TabLayout
edit: In the comments I mentioned an analogy for you to think about how to use fragments vs. activities. In the interest of not spreading misinformation I'm gonna back peddle on what I said a little bit. You can absolutely use separate activities and switch between them using the tabs. So, the correct answer is kind of somewhere in the middle. The MainActivity would still hold the tablayout and manage the tab listener and switch between the tabs but you can set the content of the tablayout to hold the content a new activity. But you can do it with fragments as well and possibly more efficiently.
It really depends on the structure of your app and how deep it goes. If you only have 4 fragments and the information is centric to one work flow then you might choose to only use one activity with four fragments. It is really up to the developer on how to manage this.
Since fragments have come out, one philosophy has been if the space that you are using can be repurposed, that is, if you are working in the same box (the area above the tab bar of the instagram application for example), use a fragment. (Referencing from here). The camera tab is a good example of where to use an activity. The camera functionality represents an entirely different workflow than is seen when navigating feeds, pictures and profiles of the instagram application. So the feed might be one fragment, and the user profile another fragment but they are all being managed by the same activity and using the same content frame.
There are other answers posted in the reference I provided above which should help your understanding further.

General android layout questions

I should begin by saying that I'm brand new to android development, although I have a good understanding of the fundamentals of java. That being said, I usually learn best by doing, so I'm writing an app for a campus magazine I work for and trying to learn through the process of making it.
At the top of the screen is a bar with two spinners labeled "issues" and "sections," which allow the user to filter the articles shown to only those in the respective issue / section. The rest of the screen is taken up by what I will describe as a vertically-oriented gallery, which shows the headline for each story underneath an image associated with it. The user can then "flip" through the stories in the magazine by scrolling through the "gallery." Selecting one of the stories will open the full story up in ViewPager.
I have two main questions at this point:
1) Initially, I planned to place the "issues" and "sections" spinners in the ActionBar. However, as I understand it, ActionBars are not displayed to users using Android 2.x. Given that these elements are critical to navigating the app, and that a majority of android users are still using 2.x, this seems unacceptable. As a result, I'm using an ActionBar-less theme and essentially drawing my own action bar via a linear layout on top of my main activity. Am I correct in my understanding that ActionBars do not display on Android 2.x devices? If so, am I correct in including my "tool bar" as a part of the main activity, or is there a better way to implement it? (Perhaps as a fragment? I don't really understand how those fit in yet...).
2) I am aware that the gallery widget is deprecated, so obviously I'm not going to use it. What alternative widgets would best achieve the same visual goal of having the user "flip" through the stories in the magazine by scrolling through the widget? Is there a way to animate a ListView to achieve this goal?
Again, any help - particularly which helps me to understand the wider issues involved here - will be greatly appreciated.
Thanks in advance.
You can use ActionBarSherlock - it is compatible down to Android v 1.6.
ViewPager might help you

Android swipe left and right from record to record

A lot of apps that I have (such as gmail) has a feature where you can swipe left and right to go from one record to another. In gmail, this navigation takes you from one email to the next (or previous, depending on which way you swipe). When you reach the end, you get this blue halo effect, and the swiping in that direction doesn't work. My question is, what is this navigation called? Is it something in the sdk, or is it written by the developer for each app? Can I use it in my app where I have data stored in the sqlite database that I would like to show one record at a time this way? Is it available in all sdk versions?
I would search for it, but I don't know what it's called so I can't really think of any good search terms here. If someone just points me in the right direction, I can read the documentation and figure it out.
The component you are looking for calls ViewPager. You'll find in under the compatibility pack jar.
android viewPager implementation
http://android-developers.blogspot.co.il/2011/08/horizontal-view-swiping-with-viewpager.html
You can use something called a viewFlipper if you want to use animations.
There's a nice tutorial here: http://www.warriorpoint.com/blog/2009/05/26/android-switching-screens-in-an-activity-with-animations-using-viewflipper/
Good luck :)

Categories

Resources