Using startActivity vs startActivity ForResult

The most common way to invoke an Activity is by using the startActivity() method, but there is also another method you will see used in specific instances—startActivityForResult(). Both pass control to a different Activity. The difference with regard to startActivityforResult is that it returns a value to the current Activity when the Activity being invoked is complete. It in effect allows you to chain activities and expect callback-style responses (you get the response by implementing the onActivityResult() method).

Also notable within the ReviewCriteria example is that we are using an AlertDialog O- Before we allow the next Activity to be invoked, we call a simple vali-date() method that we have created, where we display a pop-up-style alert dialog to the user if the location has not been specified. Along with generally demonstrating the use of AlertDialog, this demonstrates how a button can be made to respond to a click event with an OnClickListener() ©•

With that we have covered a good deal of material and have completed Review-Criteria, our first Activity. Now that this class is fully implemented, we next need to

0 0

Post a comment