Hi,
I want to show a seating plan on android . We should be able to see a
seating plan, with the available seats in a certain colour and the
unavailable ones in another colour, and should be able to select a
seat or set of seats which will then be stored and will be unavailable
the next time that seating plan is checked.
I had initially used custom adapter for displaying 7 rows of seats
with 4 seats in each row by giving the count value as 7.But the
problem with custom adapter is that the id of each button(seats)is
becoming same for the entire column so cant assign the colours and
store as to which seat the user is choosing.
I am currently doing by the table row method and trying to locate the
unique position of the cells but still didnt find mch help!!I am
trying if you have some time it wl be of gr8 help!!please reply in
rajsinghis123@gmail.
the requirement is something like this.
1 A B C D
2 A B C D
3 A B C D
4 A B C D
5 A B C D
6 A B C D
7 A B C D
Enter seat no: 1 A
Seat 1A is reserved
1 X B C D
2 A B C D
3 A B C D
4 A B C D
5 A B C D
6 A B C D
7 A B C D
the plain and simple java code is something like this.I am not getting
how to get this by android
import java.util.*;
class Passenger {
public int no;
public String seatA;
public String seatB;
public String seatC;
public String seatD;
public Passenger() {
}
public Passenger(int no, String seatA, String seatB, String
seatC,
String seatD) {
this.no = no;
this.seatA = seatA;
this.seatB = seatB;
this.seatC = seatC;
this.seatD = seatD;
}
public int getNo() {
return no;
}
public void setNo(int no) {
this.no = no;
}
public String getSeatA() {
return seatA;
}
public void setSeatA(String seatA) {
this.seatA = seatA;
}
public String getSeatB() {
return seatB;
}
public void setSeatB(String seatB) {
this.seatB = seatB;
}
public String getSeatC() {
return seatC;
}
public void setSeatC(String seatC) {
this.seatC = seatC;
}
public String getSeatD() {
return seatD;
}
public void setSeatD(String seatD) {
this.seatD = seatD;
}
}
public class air4 {
public static void main(String[] args) throws Exception {
List<Passenger> list = new ArrayList();
list.add(new Passenger(1, "A", "B", "C", "D"));
list.add(new Passenger(2, "A", "B", "C", "D"));
list.add(new Passenger(3, "A", "B", "C", "D"));
list.add(new Passenger(4, "A", "B", "C", "D"));
list.add(new Passenger(5, "A", "B", "C", "D"));
list.add(new Passenger(6, "A", "B", "C", "D"));
list.add(new Passenger(7, "A", "B", "C", "D"));
for (Passenger s : list) {
System.out.println(s.getNo() + " " +
s.getSeatA() + " "
+ s.getSeatB() + " " +
s.getSeatC() + " " + s.getSeatD());
}
for (int i = 1; i <= 5; i++) {
System.out.print("Enter seat no: ");
Scanner input = new Scanner(System.in);
int num = input.nextInt();
String sn = input.next();
for (Passenger s : list) {
if (num == s.getNo()) {
if (sn.equals(s.getSeatA())) {
s.setSeatA("X");
System.out.println("Seat "+num+""+sn+" is
Reserved");
} else if (sn.equals(s.getSeatB())) {
s.setSeatB("X");
System.out.println("Seat "+num+""+sn+" is
Reserved");
} else if (sn.equals(s.getSeatC())) {
s.setSeatC("X");
System.out.println("Seat "+num+""+sn+" is
Reserved");
} else if (sn.equals(s.getSeatD())) {
s.setSeatD("X");
System.out.println("Seat "+num+""+sn+" is
Reserved");
} else {
System.out.println("Not Available");
}
}
System.out.println(s.getNo()+" "+s.getSeatA()+" "
+s.getSeatB()+ " "+s.getSeatC()+" "+ s.getSeatD());
}
}
}
}
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en