Android Intent and Fragment: Uses, Permissions, and Lifecycle, Lecture notes of Programming Languages

Various aspects of Android Intents and Fragments, including their uses, permissions required, and lifecycle methods. It includes questions on specifying operations, sending messages, flags for Intent resolution, and permissions in AndroidManifest.xml. Students can use this document as study notes, summaries, or cheat sheets for understanding the basics of Intents and Fragments in Android development.

Typology: Lecture notes

2020/2021

Uploaded on 06/17/2021

mame-magnaw
mame-magnaw 🇪🇹

4 documents

1 / 8

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
1. Which of the following statements describe common uses of the Intent class?
To specify an operation to be performed.
Correct
is selected.This is correct.
To specify a database query to be performed.
Un-selected is correct
is not selected.This is correct.
To represent an event that has occurred.
To hold a signing key that identifies the Intent's creator.
Un-selected is correct
2. If you want to send a message to a particular person using an Intent with the
Intent.ACTION_SENDTO action, what one other piece of Intent information do you have to set?
See: http://developer.android.com/reference/android/content/Intent.html#ACTION_SENDTO for
more information.
Flags.
Extras.
Category.
pf3
pf4
pf5
pf8

Partial preview of the text

Download Android Intent and Fragment: Uses, Permissions, and Lifecycle and more Lecture notes Programming Languages in PDF only on Docsity!

  1. Which of the following statements describe common uses of the Intent class? To specify an operation to be performed. Correct is selected.This is correct. To specify a database query to be performed. Un-selected is correct is not selected.This is correct. To represent an event that has occurred. To hold a signing key that identifies the Intent's creator. Un-selected is correct
  2. If you want to send a message to a particular person using an Intent with the Intent.ACTION_SENDTO action, what one other piece of Intent information do you have to set? See: http://developer.android.com/reference/android/content/Intent.html#ACTION_SENDTO for more information. Flags. Extras. Category.

Data. Correct is selected.This is correct.

  1. Which one of the following flags will help you get more information about how Android determines which Activities can respond to a given Intent? Intent.FLAG_ACTIVITY_NO_HISTORY. Intent.FLAG_ACTIVITY_NEW_TASK. Intent.FLAG_DEBUG_LOG_RESOLUTION. Correct is selected.This is correct. Intent.FLAG_FROM_BACKGROUND
  2. The HelloWorldWithLogin application started an Activity with an explicit Intent: Intent helloAndroidIntent = new Intent(LoginScreen.this,HelloAndroid.class); What are the data types of the two parameters supplied to the Intent constructor? See: http://developer.android.com/reference/android/content/Intent.html for more information. Activity and Intent. OnClickListener and View.
  1. Which of the following describe situations where permissions might be used? To restrict access to costly operations. Correct is selected.This is correct. To restrict access to device hardware features. This should be selected is not selected.This is wrong. It should be selected. To restrict access to user data. This should be selected is not selected.This is wrong. It should be selected. To restrict application loading to devices that run a specific version of Android. Un-selected is correct
  2. Which XML tag does an application use to specify permissions that the device's user must grant to the application before that application can run on the user's device. android:permission. <uses-permission> Correct is selected.This is correct.

<define-permission>

  1. Which XML tag or attribute is used to specify an application-specific permission that an application requires of any other application that wants to interact with it? android:permission Correct is selected.This is correct. <uses-permission> <define-permission>
  2. Which Exception is thrown if one Activity tries to start another Activity for which it does not have the appropriate permissions? See: http://developer.android.com/guide/topics/security/permissions.html for more information. AccessControlException. SecurityException. Correct is selected.This is correct. NullPointerException. ClassCastException.

Get a reference to the FragmentManager. Add the Fragment. Commit the FragmentTransaction. Correct is selected.This is correct. Begin the FragmentTransaction.

  1. (True of False) When a Fragment is programmatically added to an Activity, by default Android adds the new Fragment to the Task backstack. True. False. Correct
  2. Which one of the following Fragment methods tells Android not to destroy a Fragment when a device configuration change occurs? setInitialSavedState(). hasOptionsMenu(). setRetainInstance().

Correct is selected.This is correct. setArguments().