Best practice architecture for Android app [duplicate] - android

This question already has answers here:
Swipe between activities
(2 answers)
Closed 9 years ago.
I'm pretty new to Android development, but have basic knowledge of Java (comming from Python). I'm working on a simple app that will list 10 WebViews side by side, but I'm having some trouble finding the proper way to build the layout and activities.
I have - for example - an arraylist with the uri's I want to build. From this I can build the same number of WebViews. How do I place them side by side (taking 100% of the screen) and allowing the user (me) to swipe between them? Should this be in a single Activity or should each swipe start a new activity?
EDIT: Sorry for the duplicate question.

You can implement them as ten separate WebViews, and then put them in a ViewPager. The ViewPager will automatically handle the swiping from side to side between the WebViews.

Related

Youtube mini player in Android app programmatically [duplicate]

This question already has an answer here:
Android - YouTube Api player on floating window using service
(1 answer)
Closed 3 years ago.
Want to realize same functionality(mini-player in-app only)
currently, I realized it using fragment on the foreground. But it works only when 1 activity. And if use many activities fragment will be recreated and it's not ok when user watching the video.
So, maybe someone can recommend a better solution/example.
I have checked the solution with widgets(Not for this case).
I realise that you discarded the widget possibility but i would still recommend you check it again in this example.
It shows and updates data on one xml which you could expand on screen and reuse or discard if needed.

In Android Development, what is the correct term for a "fixed" element? [duplicate]

This question already has answers here:
sticky row in listview in activity
(2 answers)
Closed 7 years ago.
In an Android project, I'm creating a browse feature which uses a ListView to display content.
My goal is to create a fixed element which remains at the top of the screen, no matter how far down I scroll in the ListView.
What is the correct term in an Android Development environment for an item that stays on the top of the screen even after scrolling down?
As I've browsed S.O. to learn how to approach my problem, I've seen people use the word "fixed" before, but that term seems to be more associated with HTML and CSS. I'm trying to learn what keywords I use as I search for ways to solve my problem. Any suggestions?
You can use the term Sticky. According to your question you need the items to be at top always. So, it's Sticky Header :)
Here are some great libraries to achieve easily in quick.
Header List View
Sticky List Headers

Android app structure [duplicate]

This question already has answers here:
One Activity and all other Fragments [closed]
(8 answers)
Closed 8 years ago.
I just need a little guidance on how do I structure my android app
I have an android app that has five to seven screens. Now the way I have structured the app is that I have one single activity that loads on app start which is more like a gateway to start exploring the screens. This activity also has container which I use to show the fragments. Every fragment represents a screen.
So is this structure of one single activity and multiple fragments a valid and a good one or may be the app can be structured in a better way?
There might be various ways to organise an application,
You can organise it by component/class types
activity/
// all activities here
fragment/
// all fragments here
service/
receivers/
utils/
Or you can organise it by features you provide in your app(say by UI)
feature1/
ActivityOne.java
FragmentOne.java
FragmentTwo.java
FragmentThree.java
feature2/
ActivityOne.java
FragmentOne.java
FragmentTwo.java
FragmentThree.java

Horizontal Tabs in Android [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
How to implement horizontally scrollable tabs?
I would like to implement tabs in an app that essentially also allows swiping between two screens. A good example would be in the App section in the Google Play store. There are horizontal scrollable tabs up top and they move as the screen scrolls.
I am targeting Android 4.0 with this but need to make it backwards compatible.
I am obviously not asking anyone to write the entirety of code on this, I simply am looking for a tutorial somewhere, or advice on how to go about starting this. The Dev site show exactly what I want here: http://developer.android.com/design/building-blocks/tabs.html
But doesn't show HOW to do this (or at least make it visibly clear); it only says that's its good practice to do.
take a look at this API, I use it and its very easy to implement
ViewPagerIndicator
This is usually done by using ViewPager class. In order to make it backward compatible take a look at the ActionBarSherlock project; there you will find examples on how to implement this kind of design pattern and make it work even on Android 1.6.
Also, as Alex said, you can take a look at the ViewPageIndicator project of the same developer if you don't want to care about an action bar.

How to create a custom tabbar in android to look like an iphone tabbar? [duplicate]

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
Android - iphone style tabhost
I am trying to figure out how to achieve a tab bar look and feel like the one provided in the iOS for android applications? I am using the normal one but it makes my application to look old school. I would like to achieve the same visual experience as the image below:
http://www.android.com/market/data/screenshots/com.i2.android.brasileirao.activity0.png
I have also looked at mobyfactory-uiwidgets-android bu they are far from being equal to the one in the image.
Thanks T
There's nothing that says the TabHost in a tabbed layout needs to be above the tab content area, so feel free to stick it wherever. But please don't put tabs on the bottom just because you can; Android users aren't used to this and you need to have a better reason than "it looks old-school" for violating UX expectations.
If you just want to fix the look of individual tabs themeselves, you can use TabSpec's setContent(View v) method to setup a custom view for a tab. Also see the source code to the Google IO 2010 Schedule app. You can definitely spruce up tabs this way in lots of good ways without messing about with user's understandings of what Android tabs are and how they function.

Categories

Resources