Mindmap
Cookbook
Inhalt der Mindmap
Cookbook
§1.Activity
- 1. Declaring an activity
- AndroidManifest.xml
- Declaring an activity is how we tell the system about our activity and how it can be requested. For example, an pplication will usually indicate that at least one activity should be visible as a desktop icon and serve as the main entry point to the application.
- <application <activity </activity> </application>
- Declaring an activity is a simple matter of declaring the <activity> element and specifying the name of the activity class with the android:name attribute. By adding the <activity> element to the Android Manifest, we are specifying our intention to include this component within our application. Any activities (or any other component for that matter) that are not declared in the manifest will not be included in the application. Attempting to access or utilize an undeclared component will result in an exception being thrown at runtime. android:label . This attribute indicates the title shown on the screen as well as the icon label if this is the Launcher activity.
- AndroidManifest.xml
- 2. Starting a new activity with an intent object
- Add intent function
- public void launchIntent(View view) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse("https://www.packtpub.com/")); startActivity(intent); }
- Creat button
- activity_main.xml
- <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Launch Browser" android:id="@+id/button" android:layout_centerVertical="true" android:layout_centerHorizontal="true" android:onClick="launchIntent"/>
- activity_main.xml
- Add intent function
- 3. Switching between activities
- Create a new black activity
- Activity_main.xml, Create button
- onclick
- Crie uma função, que recebe um obj intent, que acione o ACTION_VIEW, passe o dado e dps chame a porra da mizera
- 1. Declaring an activity
Informationen
- Beschreibung
- Mindmap am Cookbook, erstellt von John Aley am 26/01/2018.
- Erstellt von
- John Aley
- Aufrufe
- 1
- Bewertung