Wednesday, October 26, 2011

send Bundle value intent with android exam

//Activity 1
public void onClick(View arg0) {
                long value;
                if (tinhthanh == 0) {
                    value = 1;
                }
                else {
                  value = 0;
                }
                Bundle sendBundle = new Bundle();
                sendBundle.putLong("value", value);
                Intent i = new Intent(VNTaxiCallActivity.this, ListTaxi.class);
                i.putExtras(sendBundle);
                startActivity(i);
                overridePendingTransition( R.anim.slide_in_left, R.anim.slide_out_left );
            }
//Activity 2
Bundle receiveBundle = this.getIntent().getExtras();
            final long int_tinhthanh = receiveBundle.getLong("value");
            lblHeader =  (TextView) findViewById(R.id.lblHeaderCity);
            if(int_tinhthanh==1){
                Taxi_HaNoi();
            } else if (int_tinhthanh==2) {
                Taxi_DaNang();
            } else if (int_tinhthanh==3) {
                Taxi_HCM();
            }else {
                Taxi_CanTho();
            }