Create and launch a second Android activity. Covers Intent, startActivity(), finish(), and the activity stack.
For tutorial on creating a button, see https://www.youtube.com/watch?v=aE5f1tV5nU4
Initial setup:
——————–
Have project with initial activity and button for Toast
Create new activity: SecondActivity
——————–
Show .xml, .java, and manifest.
Launch activity:
——————–
startActivity(new Intent( [Current Activity’s ‘this’], [New Activity’s Java].class));
Encapsulate launching
——————–
Intent i = SecondClass.makeIntent(this)
startActivity();
Activity Stack
——————–
– Loading an Activity pushes it on the Activity *Stack*
– Pressing back button pops stack:
destroys this activity, returns to previous activity.
– New Button runs activity’s finish() method pops it in code.
Must use correctly to have good activity stack.
If you instead startActivity() back to the first one, you make a loop.
Can move on and kill current activity:
——————–
startActivity(…);
finish();
Troubleshooting:
——————–
– Demonstrate what happens with the activity being in the manifest.
* View LogCat via DDMS:
…android.content.ActivityNotFoundException: Unable to find explicit activity class …; have you declared this activity in your AndroidManifest.xml?
Git in Android Studio (basic): Android ProgrammingCreate and push an Android Studio project into a GitLab repository via Android Studio (IntelliJ’s) Git integration. Covers setting up an SSH key via Git for Windows, adding files, pushing, and pulling changes.
Steps: Listing of videos: http://www.cs.sfu.ca/CourseCentral/276/bfraser/videolist.html |
|
Channel: DrBFraser Published: 2017-01-16 07:17:17 Duration: 13M25S Views: 183 Likes: 6 Favorites: 0 |
|
Creating a Button: Android ProgrammingDemo of using Android Studio to create a simple application with a button which generates a log message and a toast.
1. Launch Android Studio; create simple hello-world app. Listing of videos: http://www.cs.sfu.ca/CourseCentral/276/bfraser/videolist.html |
|
Channel: DrBFraser Published: 2017-01-09 07:40:22 Duration: 18M26S Views: 845 Likes: 11 Favorites: 0 |
|
Run Java program from IntelliJ’s TerminalDemo of running a simple Java application from inside IntelliJ’s build in terminal. Also shows displaying command-line arguments.
Covers: |
|
Channel: DrBFraser Published: 2017-01-23 04:17:10 Duration: 7M59S Views: 91 Likes: 1 Favorites: 0 |
|
Git Clone in Android Studio: Android ProgrammingCloning an existing Git project (GitLab, GitHub, …) via Android Studio (build on IntelliJ). Also shows pushing a change to the remote repo.
Setting up SSH key and creating GitLab repo: Listing of videos: http://www.cs.sfu.ca/CourseCentral/276/bfraser/videolist.html |
|
Channel: DrBFraser Published: 2017-01-16 08:09:10 Duration: 4M35S Views: 84 Likes: 2 Favorites: 0 |
|
Switching Activities: Android ProgrammingUpdated version of video using Android Studios found here: https://youtu.be/ToOX2OTCYAk
Guide/demonstration to switching between activities in an Android program. Link to previous demo for creating a button: Steps: 2. Create new Java class 3. Add activity to manifest 4. Java code to switch activities Ex: – Suggestion: Put launch code inside button callback: Button daClicker = (Button) findViewById(R.id.button1); 5. Activity Stack – Can move on and kill current activity: 6. Troubleshooting: |
|
Channel: DrBFraser Published: 2013-02-05 06:58:18 Duration: 11M46S Views: 67196 Likes: 353 Favorites: 0 |