![]() Before implementing the onClick handlers to create, save and open files, the first step is to declare some request codes for these three actions. This code is then passed on to the onActivityResult() method by the intents enabling the method to identify which action has been requested by the user. This can be achieved by passing a request code through to the intent when it is launched. ![]() Since all intents from a single activity will result in a call to the same onActivityResult() method, a mechanism is required to identify which intent triggered the call. When the work of the intent is complete, the application will be notified by a call to a method named onActivityResult(). Invariably this will result in the framework displaying the storage picker user interface so that the user can specify the storage location (such as a directory on Google Drive and the name of a file). ![]() Working with files in the Storage Access Framework involves triggering a variety of intents depending on the specific action to be performed. Switch back to Text mode and directly modify the layout to add onClick handlers to the buttons and a multiline EditText view with vertical scrolling enabled: ![]() Position the Button views and change the text properties to “New”, “Open” and “Save” so that the user interface layout matches that shown in Figure 47-1: Return to Design mode and drag and drop three Button objects onto the layout canvas. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |