Coursera: Android – Tips


A collection of what I find useful in our Android class.  Feel free to leave comments.  Thanks…

Android Blog   |    adb   |   aapt   |   App’s Workflow

 avd   |   Eclipse Refactor   |   Eclipse Preview   |   Import Android Project

DOS Tab   |   DOS Explorer   ||    Java Version   |    HAXM   |    Hardware Connection

Phonegap   |   Eclipse Run Config


adb (Android Debug Bridge) – Installing APK to AVD (Android Virtual Device)    |   ^ Go top
Alternative adb install:

 


aapt (Android Asset Packaging Tool) – Check APKs permission    |   ^ Go top

Coursera-aaptScreenSize_thumb1
I have created a thread about aapt and adb, available in this thread:
https://class.coursera.org/androidapps101-001/forum/thread?thread_id=8319
To check for permission as in above screenshot:
aapt d permissions xyz.apk

Checking permission could also be done through the AVD.
Go to [Apps], [Settings], [Apps] and select app to check.
On “App Info”, scroll down check if there’s any “PERMISSIONS”.


Android App’s Workflow (My understanding so far)   |   ^ Go top

  1. Manifest.xml is read by installer, icon(s) added accordingly to Android’s HOME.
    Each “LAUNCHER” category in manifest creates an icon in HOME.
  2. Icon launches the app according to specified “<activity android:name…>”, by default named MainActivity (a Java file).
  3. MainActivity as specified in its  setContentView, loads layout (by default “activity_main”, an XML file).
  4. Layout is displayed on the device and control goes back to MainActivity class .


avd (Android Virtual Devices)   |   ^ Go top

  • To change orientation from/to portrait/landcape, use [Ctrl]+[F12]
  • To scroll, use drag and drop (Home/Apps screens scroll only horizontally)
    Apps screen is alphabetical and can’t be re-arranged
  • To enable screen capture, activate “Snapshot” and “Save to snapshot” options
    image_thumb6 image_thumb4

Eclipse String Refactor    |   ^ Go top
Convert hardcoded string into XML value.

 


Eclipse Preview All Screen    |   ^ Go top
To see layout in all screen sizes

 


Eclipse Import Android Project    |   ^ Go top
To import copied/zipped Android project:

  1. From Eclipse, select “File”, “Import…”
  2. From Import dialog, select “General”, “Existing Projects into Workspace”
    image
  3. Click [Browse] from “Select root directory”
    image
  4. Click the folder that contains the “AndroidManifest.xml” and click the [OK] button
    image
  5. Back to the “Import” dialog, click the [Finish] button and the project will be added.


DOS Scroll Tab – On DOS Prompt, after a command and space, press [Tab] to view subfolders.     |   ^ Go top
DOS-anigif_thumb2


DOS Prompt from Explorer    |   ^ Go top
To open command prompt window in the active folder, in Windows Explorer press [Shift]+[Right-Click]
image_thumb11

 


Java Version – Getting version of installed Java:    |   ^ Go top
http://java.com/en/download/installed.jsp

 


Intel HAXM –   Hardware Accelerated Execution Manager   |   ^ Go top
image

DOS Commands: sc query intelhaxm, sc stop intelhaxm, sc start intelhaxm
Uninstallation: Run the file and activate the “Remove” option
Installation: Run the latest HAXM file that is the hotfix
Hotfix is a new install that’s neither just an add-on nor an update
The latest version as of this writing is 1.0.7:
haxm107c

 


Self Evaluation   |   ^ Go top
https://class.coursera.org/androidapps101-001/forum/search?q=self+evaluation#11-state-query=self+evaluation
This is new to me, hardly noticed this.
Was surprised to see I was able to grade myself when [Go on to self-evaluation] was clicked.
Coursera-Assessment00Self_thumb1

 


Hardware Connection   |   ^ Go top

Connecting mobile device to Eclipse:

  1. Activate USB Debugging
    • Tap Apps, Settings, Developer Options
    • Tap USB debugging so it’ll be checked
      Phone-USB-Debug---2013-12-29-01-13-1[1]
  2. Load Eclipse and select PC Software
    • Connect device by USB cable to the computer running Eclipse
    • The device will show “USB connection type” selection, tap the “PC software” option
      W8-USBtap_thumb1 W8-USBaction_thumb
    • The computer will show “Select action”, just disregard
    • Check the Eclipse, [Device] tab should show the hardware with name automatically assigned
      image_thumb21Phone-Dev-Option---2013-12-29-01-05-[2]


PhoneGap   |   ^ Go top

Creating HTML5, CSS, Javascript apps for both Android and iOS.


Eclipse Run Config   |   ^ Go top

I once imported an Android project that automatically launches AVD.  Not knowing Run Config that time, I thought there’s something wrong.  Came across an ebook showing Run Config.  In short, you can simply assign following to be automatically run from Android project:

  • Activity (Wondering what happens when this conflicts with the project itself)
  • Target AVD/Mobile Device
  • Etc…

image

image


Eclipse Project Naming   |   ^ Go top

image

Activity, Layout, Menu have naming convention.  For the above sample, menu would be main.xml.

  • Activity Name: OtherActivity
  • Layout Name: activity_other
  • Menu Name: other

Clean and beautiful ads:
https://www.mobilecore.com/lp/?utm_source=linkedin&utm_medium=moreweekly&utm_campaign=skills_t1


3 thoughts on “Coursera: Android – Tips

  1. Great post. I used to be checking continuously this blog and I am impressed!
    Extremely useful information specifically the last part :) I look
    after such information a lot. I was seeking
    this particular info for a long time. Thank you and
    have a great time.

    • Thanks Dorsey,
      You sure are a genius in finding that article as myself have difficulty finding it :)
      Sure are lots of notes in there, useful to me when I was taking that course.
      Bit outdated now but I guess still useful.
      I plan to later make those notes easier to find, update as well with latest Android release.
      I’ve just added following tags to the article: coursera, mooc, android.
      Happy Holidays,
      Richard

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s