Android Studio – courses completed so far… Fri 17 Aug 2018 at 14:13 PT

Android Basics: User Interface (completed Sat 24 Feb 2018) – https://classroom.udacity.com/courses/ud834

Android Basics: User Input (completed Mon 2nd April 2018) https://classroom.udacity.com/courses/ud836

Android Basics: Multiscreen Apps (started Mon 2nd April 2018) on  Wed 8th August 2018 I have completed up to and including Lesson 2 Concept 16 – everything runs fine at this point so saved project to GitHub and start on Concept 17 https://classroom.udacity.com/courses/ud839  I have completed up to and including Lesson 2 Concept 17 – everything runs fine at this point so saved project to GitHub and start on Concept 18.  All good but in Lesson 2 Concept 19, the code example in the video shows data in the GridView (Miwok words for each number word), but we haven’t been instructed to type them in yet… Also on Fri 10th August I changed the manifest file for the new app name “quiz2exam” instead of “miwok”, and added ic_launcher.png files for the new question mark (?) icon. I tested the app (all good) and added this new version of the project to GitHub. Today I also registered the domain name quiz2exam.com for when my app is ready to sell on the Google Play Store. Sun 12 Aug 2018 at 12:18 PT I have competed https://classroom.udacity.com/courses/ud839  up to and including Lesson 2 Concept 22. Now starting Concept 23 – Custom Class resuming Monday 13th August 2018.  Tuesday 14th August, before continuing on the course, I’m studying the sample course: ud839_CustomAdapter_Example

and started my own Android notes, to help me keep track of the Android terminology and operation of Android apps.  Thu 16 Aug 2018 completed lesson 2, then cloned the GitHub code for (completed) ud839 Lesson 3 to Android Studio (see my Android Notes on how to do this), and started on ud839L4 (Images and Visual Polish)…. Completed ud839L4 (Images and Visual Polish)…. at 2pm on Fri 17th Aug 2018.  Starting ud839  L5 (Activity Lifecycle and Audio Playback)….

 

 

Android Basics: Networking – https://classroom.udacity.com/courses/ud843

Android Basics: Data Storage – https://classroom.udacity.com/courses/ud845

Developing Android Apps – https://classroom.udacity.com/courses/ud851

Advanced Android App Development – https://classroom.udacity.com/courses/ud855

Then the Big Nerd Ranch textbook course.

There are many more Android Development courses at Udacity which I will take after completing the Big Nerd Ranch textbook course.

 

5th April 2018 – Android Studies Checkpoint (started UD839) Imported an existing project (seemlessly).

https://classroom.udacity.com/courses/ud839

Started the above today. Importing the Miwok project went seemlessly…

  1. Go to this GitHub project repository link.
  2. Click on the “Download zip” button to download the app code.
  3. Unzip the downloaded file on your computer so that you have a “Miwok” folder.
  4. Open Android Studio.
  5. Choose File > Import Project and select the “Miwok” folder. It may take some time for the project to be imported. If you have any issues, check the Troubleshooting document.
  6. Once that app has successfully imported, run the app on your Android device (phone, tablet, or emulator). It should look like this screenshot. Nothing happens when you click on any of the categories. That’s expected.

Just for your information, during the process of importing the project, Android Studio prompted for some updates and gave warnings related to obsolete features being replaced. This is due to the fact I am using the bleeding edge version of Android Studio, and the project I’m importing was written months previously.  So it took a few minutes to complete the updates and build, the installing the APK to the phone took minutes instead of the seconds it has taken so far with my apps. Nevertheless, all went seemlessly (if slowly) and the app ran as described on the phone.

How to shut down a Raspberry Pi running androidthings

Assuming the RPi3 running the androidthings image was connected to the internet at IP address 192.168.0.16, then to connect a laptop on the same network to the RPI3 running androidthings, and then shut down the androidthings RPI3, do the following: (note the -p means power off)

root@Inspiron-15R:~/Downloads# adb connect 192.168.0.16
connected to 192.168.0.16:5555
root@Inspiron-15R:~/Downloads# adb shell reboot -p
root@Inspiron-15R:~/Downloads#

Connecting my laptop to RPi3 androidthings and building my first androidthings device

Once I had flashed the image and booted up my RPi3 androidthings, I connected to the wifi and androidthings reported my connected IP address as: 192.168.0.16.

From here in Step 2 – Connect the hardware, under #5:

https://developer.android.com/things/hardware/raspberrypi.html

I found this:

root@Inspiron-15R:~/Downloads# adb connect 192.168.0.16
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
connected to 192.168.0.16:5555
root@Inspiron-15R:~/Downloads#

So it seems I’m now wirelessly connected to the RPi3. So now I want to make an androidthings project on my laptop and deploy it on the RPi3 androidthings machine…  I’m now working on finding out how to do that.

So from this page:

https://developer.android.com/things/hardware/raspberrypi-kit.html

I click on “build your first device”:

https://developer.android.com/things/training/first-device/index.html

OK. That is a long drawn out document with many steps, so for now I will take a break.

 

How to shut down androidthings:

root@Inspiron-15R:~/Downloads# adb connect 192.168.0.16
connected to 192.168.0.16:5555
root@Inspiron-15R:~/Downloads# adb shell reboot -p
root@Inspiron-15R:~/Downloads#

Starter code for new Empty Activity and LinearLayout

activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
 xmlns:tools="http://schemas.android.com/tools"
 android:layout_width="match_parent"
 android:layout_height="match_parent"
 android:orientation="vertical"
 tools:context=".MainActivity">

<TextView
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:text="Hello World!" />

</LinearLayout>


MainActivity.java
package com.example.android.udacityud836userinputlesson5part18;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

public class MainActivity extends AppCompatActivity {

@Override
 protected void onCreate(Bundle savedInstanceState) {
 super.onCreate(savedInstanceState);
 setContentView(R.layout.activity_main);
 }
}

https://classroom.udacity.com/courses/ud836 fix error

from the Udacity course on Android input:
 
there is a problem because some instructions are missing for the menu XML and action_settings string setting. 
 
The following page explains the fix:
 
and is documented here for future reference in case the link disappears:

Right click on the res folder while you’re in Android Studio, hover over new, then select Android Resource Directory. It will come up with a box which will probably have Directory name & Resource type both set to ‘values’. What you want to do is click on the down arrow to the right of the Resource type box, and select ‘menu’. The Directory name will also have changed to ‘menu’. Now click the OK button. Now you have your menu folder.

Next you need to create the menu_main.xml file. Right click on the menu folder, hover over new, then click on Menu resource file. It will open a box asking for the name of the file. Type in menu_main (you don’t need to put the .xml at the end, it will do that for you.

So now you need to copy and paste this code into your new file:

<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:context=".MainActivity">
<item
android:id="@+id/action_settings"
android:orderInCategory="100"
android:title="@string/action_settings"
app:showAsAction="never" />
</menu>

Then to fix the actions_settings string :

Go to res/values/strings.xml and add this second string:
<resources>
    <string name="app_name">Court Counter</string>
    <string name="action_settings">Settings</string>
</resources>
done! Everything works fine at this stage so the project was uploaded to GitHub.