Clicking a button to open new activity showing data from firebase - android

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.

Related

Runtime button creation in Android studio?

This isn't so much a question about my specific code as it is a question on what I need to use to accomplish my task.
I'm making a workout logging app for my class. The user needs to be able to create a workout routine, filled with various exercises of their choice.
On the home page, there is an "Add Workout" button. Clicking this should bring them to a screen where they name the workout and fill it in with said exercises. When they click save, I need to be able to create a new button on the home page with simply the name of their new workout. This new button when clicked will bring them to that workout, where they can start the workout and put in their reps, sets, weight, etc.
What do I need to be looking at to achieve this? Do I need to be saving the workouts to a database and using a function to go through the database and populate the home screen with respective buttons each time I enter the app / add a new workout? Or is there a different way to do this? I'm not sure that I'm even asking the right question or framing this problem the correct way.
Thanks!
you should put the button on the home page from the beginning but make it invisible at first.
yes you should put the workout information in a database and if there is a workout saved, make the button visible in the home page.
use android:visibility="gone" in XML and birthday.visibility = View.VISIBLE in the activity to modify the visibility

Dynamic main activity

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.

Eclipse - ButtonCLick --> new screen with text

Im kinda new on developing for Android, and now i have decided to make a simple apps for my frens and me.
I know how to design the layout, but when it comes to the "activity" I always messes things up..
So now to my question - I'm creating a app to show my college schedule so I have 6 buttons (monday tuesday wednesday etc.) Then when I click each button I want to get to another screen with todays schedule..
How to I create new screens in an easy way? please answer steps by steps with screenshot...
Here are the steps:
What you are calling a new screen is Activity. Read what is Activity and its Life Cycle.
Read How to create activities: Best way to add Activity to an Android project in Eclipse?
Since you've mentioned that you've already created the Buttons do this:
See How to set a listener on Buttons, so that you can perform some action on it (eg: start Activity) when Button is clicked. Read Android: how to handle button click
See How to start a new Activity: How to start new activity on button click
Its turns out that rather than steps by step pictures, what is required is breaking the problem into multiple small problems and try to search if anyone has solved it before.
This would be the starting point. Hope it helps.

How to create a view that would change the interface?

Currently, I am making a contacts application. There is a feature that I would like to add in.
As you can see, there are 3 buttons at the bottom of the screen: Contacts, Phone, Groups. By clicking any one of these three buttons, I would be directed to another screen. This is the feature that I would like to add. How to make it? Any help would be very much appreciated.
you can start a new activity . and if you want to stay in the same activity you can use setContentView(layout) to set new layout for a screen.

Page turn/flip with button click for android

I am working on page curl/turn animation with button click and I couldn't able to do it. Because I am new to Android and I searched a lot through Google, someone please share your knowledge with the example code for the animation
I am working on a sign-in page with username,email as text-view elements with edit text boxes, and Signin and Register are the two buttons
When I click the Register button the page should turn/flip to a new Register page and for signin button It should show an Alert dialog after submitting the credentials
Help is always appreciated, Thanks.!
Yes, you can have as many layout (.xml) pages as you'd like. When you desire to use one simply call setContentView(signin) or something alike.
You need to learn to explore your options before you post a question, thus creating two threads about the same topic. Look through the documentation and then here.

Categories

Resources