Saturday, February 1, 2014

How To Pass value within Android Two Java Pages

When Develop a android application if we want to pass the values and receive the values from another activity



this is the code sent the value to another activivity here i'm sent the value to viewmap 
  

public void onClick(View view)
    {
           // Launching All products Activity
         Intent in = new Intent(getApplicationContext(), ViewMap.class);
        // sending pid to next activity
      in.putExtra("address",strAdd);
        // starting new activity and expecting some response back
       startActivityForResult(in, 100);   
      }



when we receive something from another activity and another main thiunk is both names are want to be same
in.putExtra("address",strAdd) and in.putExtra("address",strAdd);

   Intent i = getIntent();
        // getting product address  from intent
        Bundle extras = getIntent().getExtras();
        if (extras != null) {

            adress=extras.getString("address");
            }