I m making parking navigation system. i have made arrays for garages and pass it into other activity of parking now there are changes in that activity and i have to pass it back to garage activity.Need a simpler solution. thanks in advance
Here is code, I've tried:
GarageActivity
int[] g1 = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
int[] g2 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
int[] g3 = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
int[] g4 = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
int[] g5 = {0, 0, 1, 1, 1, 1, 1, 1, 1, 1};
int[] g6 = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
b1.setOnClickListener(new View.OnClickListener() {
@Override public void onClick (View v){
Intent it = new Intent(Start.this, MainActivity.class);
it.putExtra("g1", g1);
startActivity(it);
}
});
ParkingActivity
public void onClick(View v) {
if (tx1Count == 0) {
v.setBackgroundResource(R.color.redColor);
tx1Count = 1;
b[0] = 1;
Toast.makeText(MainActivity.this, "Parking Alloted", Toast.LENGTH_SHORT).show();
} else if (tx1Count == 1) {
v.setBackgroundResource(R.color.Green);
tx1Count = 0;
b[0] = 0;
}
}
});