Fragments VS Activities: Mixing both is a good idea? - java

Is it a good idea to mix Fragments and Activities? In my app, few windows need to be Fragments because they should have ViewPager. Other screens are normal.
So my question is, when you started using Fragments, do you use Fragments everywhere? Whether it is needed or not? My app should support 5 inch to 4 inch screen only anyway.

Related

How to implement sliding functionality in android app

I am Learning android development on my own, I am working on a quiz app, in this app, I want to add 100 questions (1 screen for 1 question)
user can go to the next question by swiping so how can I do it?
should I use 100 fragments for each question with the help of viewpager or any other method is available to do it?
You need to use ViewPage2 for swiping.

How to add more than 5 bottom navigation view in android programming?

Okay so i know it's a bad user experience to having more than 5 navigation view in bottom of any android application and also related library doesn't support it but beside the fact i really want to know, is there anyway i could achieve this.?
like i wanna more than 5 bottom navigation tabs or it might be 6 or 7 tabs in bottom. it's like A,B,C,D,E,F,G

How Many Fragments Can I Host in an Activity?

I am developing an application and was just curious about the best practice regarding how many fragments to host in an activity.
I have a view that I am going to reuse throughout my application, and I want to continue using it as much as possible to display various fragments. What is the recommended practice? Is it safe from an app performance standpoint to load unlimited fragments in an activity?
In the documentation i dont see a limits about how many fragment you can use, but... its good idea think before declare fragments, if you have a lot fragment you can start with problems about the "logic".
First start with Mockups, Wireframes and Navigation, then you should know how many fragments or activities you need.

Android - Add screens and swipe through them

TL;DR version:
I want to add multiple instances of the same activity in my app and swipe through them.
I'm creating a home replacement app and I would like to know how to set up multiple home screens. I checked out the sample app provided in the SDK but it has only one screen.
I have almost everything set up but now realised that I couldn't figure out how to add multiple home screens and swipe through them. I'm just guessing that since the home screen is an activity, launchers add the same activity multiple times and let the user swipe through them. Is this correct?
What I can't figure out is how it does so and how it lets the user select the number of screens he/she wants and add/remove those activities again.
Can someone please help me out. Thanks a lot.
I think you want to use fragments. Checkout http://developer.android.com/guide/components/fragments.html
If you have specific queries on use of fragments, would love to help.

Changing UI in Java Android

I have an application in my android tablet. The user interface of that application is really bad. I want to make another level -if this word is correct- and use the same application. I won't add new operations, functions. I just want to make the buttons, labels and texts look better.
Is it possible to re-design the UI, or make a layer between the user and application?
Thank you very much.
EDIT: I don't have the source code, unfortunately.
Use dip in your xml views instead of px.
To make it look better design it for different screens . Make folders for layouts like
1.layout-small( for phones like samsung galaxy mini)
2.layout-medium(for phones like samsung galaxy note)
3.layout-large(7-10 inch tablets)
4.layout-xlarge(10+ inch devices)
Make sure that file names and views ids should be same to avoid null pointer exceptions in run time . Just play with views attributes and sizes in xml files.
For further details see this
Realistically, It would be tough to changes the UI without sourcecode, as you would not know hows these UI controls will work and look. In simple way you can change the orientation of activities as per need such as portrait to landscape in menifest file, add images for different resolution and adjust padding and all. But this wont be good solution.
check this link, would help you bit Android App for Tablet and Phone
You need to check this out first and foremost:
http://developer.android.com/guide/practices/screens_support.html
Android is designed to be used on multiple devices. It allows you define different layouts (UI's) for devices of different sizes and screen resolutions.
You can use stuff like Fragments as well to divide your apps functionality into smaller pieces and display only those parts which suit the current device.

Categories