My current project consists of a main activity in which the user selects either to sign in or sign up a new account. However currently I display two controls. What I wish to acheive is using the main activity to dynamically load the EditText Controls without instantiating a new acitivity to increase user expereince. If anyone could help me out I'd be grateful.
Related
I'm very new to coding so please excuse my lack of knowledge.
I have managed to set up a button which opens a new activity in my Kotlin android project. I want to be able to display the data from my firebase batabase in the new activity when the button is clicked but have no idea how to go about it.
For example, I have 3 buttons for 3 places. Each button opens the same activity which should display the data corresponding to that place in certain textviews (name, addess, etc)
What would be the best way to go about this?
Thanks in advance.
How to save a dynamically created button in android. My button dissapears when the app is restarted.
Thanks in advance.
The idea behind dynamically creating buttons is that they won't be created when the app is initially opened and will be created only when required.
If you require the buttons to be created everytime, just call your dynamic button creation code in onCreate.
In case you create multiple dynamic buttons, you'll need to store the data associated with the buttons by some means, retrieve the data when the app is opened and then recreate the buttons based on the data.
I often put user registration on one xml file with scroll view.
I have learned when a user sees too many fields they opt out of the app so I am planning to upgrade the layout to look like the one for gmail when you sign up on android app. It appears to be using tabbed view but not tabs available and user navigates to the next view by clicking next (refer to attached images).
First page
second page
MY QUESTION
My question is how do I create this views, do I need many xml layout files or put all stuff on one file and use visibility as in once it is filled and user presses next hide the inputs and reveal the next inputs. Note: Gmail appears to be scrolling to another page the way it would appear when using tabs.
You can use one activity to host multiple fragments. The new Android Studio update has Navigation Editor which you can use to achieve similar results.
it is totally up to you how you want to design this but the best thing is you use Fragment and viewpager instead of using two separate layouts.
See Here how to use fragment with viewpager
There are many ways to do this, If you have less content then play with visibility otherwise ViewFipper ( https://abhiandroid.com/ui/viewflipper ) Or can use Fragments
I need to develop an application which contain these tabs shown in the image. Each tab contain a form which will be filled by the user.User can switch to any tab.
User click Activity1, Activity 1 gets displayed and user enters some data; then user press Activity 2, activity 2 gets displayed, user press Activity1 again, Activity 1 gets displayed with the data entered by the user(not the blank activity).
At the end when user click "Save" I need to get all the data from these activities and save it somewhere.
I have worked a lot in java but new to android, I am stuck in developing the UI for this scenario. However I have done this many times in iOS.
Anybody please share your experience of developing such UI.
Thanks,
Fragments will be more suitable for this scenario, the benefit are
They are light weight and faster
Managed automatically by the FragmentManager.
Data Sharing between Fragments is smoother and simpler than it is for Activities
They don't complicate the Architecture of the Application
You can have as many Fragments as you want in you Activity. Following two links can be useful for you.
A similar Thread
A Good Tutorial
Another good tutorial
If even after that you decide to use Activities, You need to think
I want the user to select which Activity the application should start on. I am trying to avoid tabs because I don't like the layout of tabs, but I have a custom title bar that has three icons on which to select functionality/activity.
I want the user to select which activity the application should start from the beginning with a user preferences.
How can I do this?
After starting the main activity, immediately read from the settings and start the user preferred activity.
I also offer an alterntaive soultion. This is not an exact answer to your question though, but may help you to solve your problem in an elegant way.
Subclass TabWidget and define how the row with tabs is drawn.
Create a layout file for TabHost with your TabWidget in it.
Subclass TabActivity and set your own layout you've created.
Read the saved settings and use setDefaultTab method to set the preferred activity.
Voila! You got your own look without losing any functionality of TabActivity. You can read Tab Layout Tutorial for more information on how to do it properly.
What so tough in this. if i have three activity and that i want user to pick one which to start.
at least one activity has to be served as menu to the user from which user will pick. This will be main activity of app. i will display three buttons in it and on their specific click i will initiate the respective activity.