0

I am a beginner in android studio (java) and I'm making a Hotel Reservation App. I have three types of rooms (Single, Deluxe, Suite). Each of the rooms has buttons that will redirect to a Reservation form https://i.stack.imgur.com/rXAWj.png. I want to take a string("Single", "Deluxe", "Suite"), depending on the button pressed then display it on the "Room Type" as seen on the image provided.

3 Answers3

0

there are two straight forward ways to deal with your situation.

  1. if you are opening the form in a new fragment/activity, you can just pass the data. For detail, you can refer to https://stackoverflow.com/a/16036693/9635486
  2. or you can just change the Room Type editText to a Spinner so that it can be handled within the same fragment
Neo Luk
  • 446
  • 4
  • 10
0

First i dont know whick language you are working on it i answer it as a kotlin set for every button onclick listener like this

(buttonSingle.setOnClickListener {},buttonDeluxe.setOnClickListener, buttonSuite.setOnClickListener{})

and then write inside of these blocks for example inside of button single button

val myString = single.text(in java getText).toString 

and write it in your edittext with

edittextRoom.text(in java setText) = myString

this is all you need

Barney Stinson
  • 212
  • 3
  • 12
0

Create a dropdown list(for >3 options) or radio button(for ≤3 options) instead of getting input from user .it will more convenient way to show options

Code Scan
  • 42
  • 8