TextView and strings.xml: Android Programming

Move strings from the layout into strings.xml for internationalization, access a TextView via Java code, and have Java code read from strings.xml.

1. Add a TextView, move text to strings.xml, change formatting.
2. Use Java to change the text on a TextView.
3. Use Java to load string from strings.xml and change text on TextView.

Uses a button for the demo, and briefly reviews an exception.

Listing of videos: http://www.cs.sfu.ca/CourseCentral/276/bfraser/videolist.html

Clean & Zip Android Studio Project

How to clean the build products out of an Android Studio project folder and compress it.

Covers:
1. Show project folder in OS file viewer
2. Launch command prompt (Windows)
3. Run gradle: gradlew clean
4. Zip folder

Listing of videos: http://www.cs.sfu.ca/CourseCentral/276/bfraser/videolist.html

Channel: DrBFraser
Published: 2017-01-09 06:39:12
Duration: 3M38S
Views: 62
Likes: 4
Favorites: 0

Creating a Button: Android Programming

Demo 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.
2. See XML and .java code for activities
3. Add a button, change name, see XML
4. Java code to access button: View.OnClickListener
5. Generate a log message when button is clicked.
6. Generate a toast when button is clicked.
7. Show where to find the compiled R class.

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: 105
Likes: 6
Favorites: 0

Shared Preferences : Android Programming

Demonstration on how to use the SharedPreferences object in Android to store a value between application runs.

Shows:
– Placing TextView elements on the screen
– Accessing TextView elements via Java code
– Reading and Writing values from/to the shared preferences.

Channel: DrBFraser
Published: 2013-02-15 02:18:20
Duration: 21M32S
Views: 12687
Likes: 78
Favorites: 0

CLion under Linux: Install & Run

Demo of installing CLion IDE (for C/C++ programming) under Linux (specifically Ubuntu).

To run clion.sh from a terminal
(if double-clicking on the icon fails):

[1] Press the Windows key to open up the menu in the top-left corner of Ubuntu.

[2] type “terminal”; run it.

[3] Enter the commands:
cd clion-2016.2.2
cd bin
./clion.sh

– Change the clion-2016.2.2 to match the folder name you extracted)
– That ./ is important in the final command.
– This should launch the installer.

For a video on installing VMWare Player and creating an Ubuntu VM, see http://youtu.be/TXGREvxPbL4

Topics:
– Downloading latest Clion installer via a browser
– Running installer via GUI
– Creating C++ Hello World project in CLion
– Import multiple existing C++ files.
– Excluding files from the build.

If double clicking on clion.sh shows you the contents, then right-click and select Open With, then Other Applications… and click View All Applications and select Run Software.

Listing of videos: http://www.cs.sfu.ca/CourseCentral/276/bfraser/videolist.html

Channel: DrBFraser
Published: 2016-09-12 05:46:49
Duration: 11M13S
Views: 1998
Likes: 9
Favorites: 0

JUnit 4 with IntelliJ: A quick introduction

Introductory video on using JUnit 4 in IntelliJ.
For next video, check out: https://youtu.be/xHk9yGZ1z3k

Hot Keys:
– Alt-Insert: Generate code — constructor, getter, test case
– Alt-Enter: Quick-Fix something, such as create a test class, method, field.
– Ctrl-Shift-F10: Set current run config.
If done inside a test method, will run just that method. Otherwise runs whole class
– Shift-F10: Re-run last run config.

Steps:
– Create new IntelliJ Java project
– Create class under test: PetRock
– Create test folder in project, and set as ‘Test’ folder
File, Project Structure, Sources, select ‘test’ folder; click TESTS on top
– Create test class from existing class
Click class name; press Alt-Enter, Create Test
Configure project for JUnit 4
– Write testGetName, run tests
assertEquals

– Run with CTRL+Shift+F10 to set what to run
If in a test method, only runs that method
If in test class, runs full class
– Shift F10 = Re-run last “configuration”
– Ctrl + Shift + T: Toggle between test and code-under-test

– Create new test method for isHappy; run tests.
– in JUnit class, Alt+Insert, Test Method
– Alt + Enter: on non-existant methods to create.
– use assertTrue, assertFalse

Listing of videos: http://www.cs.sfu.ca/CourseCentral/276/bfraser/videolist.html

Channel: DrBFraser
Published: 2016-06-20 07:33:14
Duration: 11M51S
Views: 5846
Likes: 83
Favorites: 0

Leave a Reply

Your email address will not be published. Required fields are marked *