Skip to content Skip to sidebar Skip to footer

Switching Activities/passing Data Between Activities

So using suggestions from the last question I asked, I figured out how to call BarCodeScanner, and return the value to a field. so now, I have a toast that says 'successful scan' a

Solution 1:

Try sending a Bundle object when calling the new intent.

Intenti=newIntent(main.this, Result.class);
Bundleb=newBundle();
b.putString("SNARP", "SCAN_RESULT")
i.putExtras(b);

Solution 2:

Try getting string in the child Activity this way.

publicclassResultextendsActivity {
  /** Called when the activity is first created. */@OverridepublicvoidonCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.result);

    Intenti= getIntent();
    Stringfoosh= i.getStringExtra("SNARP");

Post a Comment for "Switching Activities/passing Data Between Activities"