Android Programming Project

Teaching myself how to develop Android applications


Wednesday, July 2
Progress still slow. Ran across a source of good Python-for-Android code at this Italian fellow's website, La Tana del Gurzo. For instance, look at his code for an EXIF remover here. Also, these two less-Androidy files: pyF-API.py and pyF-Parsing.py. Current plan: (1) Daily Google search for "python android", (2) get out old Python books from storage, (3) keep an eye out for Android "L" model tablet.


Monday, June 30
Minimal progress. tried to run view HTML, but there is different between Url and path. installed FTP app. working on design for tarot app.


Sunday, June, 29
Took me a long, very frustrating time, but I finally got QPython to display an HTML file:

which was produced by this code (hello14.py):

try:
   import androidhelper as android
except ImportError:
   import android
d=android.Android()
print("b4 call")
d.makeToast("after") 
d.webViewShow('file:///sdcard/com.hipipal.qpyplus/projects/hello14/fon.htm', None)
run on this exceedingly simple HTML file:

Slight typo in last line of screen shot was fixed. Mental corrections necessary to do all this: 1) do as project, not as script; use top 4 lines so SLA4 utility doesn't disappear; and many more. But -- this means I can perform useful work (HTML images). Time required: June 6 to June 30, two weeks! Plunged me into the pit of depression at times, thinking that my mental skills had deteriorated. Still don't know how to make webViewShow go away...

Saturday, June 28
After 9 hours yesterday with little progress, I am considering scaling back on Android programming efforts until such time as I get a new Android tablet with the new Lollipopo system. This is just too frustrating working on a tiny keyboard, and I haven't been able to get a suitable emulator running on my laptop. This feels like a defeat.
In the meantime, will continue learning the limited androidhelper command set, one per day=, e.g.

notify(title,message)
		Displays a notification that will be canceled when the user clicks on it.
			title (String) title
			message (String)
Here is today's program:
import androidhelper
d=androidhelper.Android()
line="How now brown cow?"
d.notify("Bovine Query",line)
Didn't work. I am apparently not alone in my frustration. Here's some others claiming problems, .
Anyway, moved on to next function in androidhelper, vibrate, and it worked.
import androidhelper
d=androidhelper.Android()
d.vibrate() 
Almost noon. That's all the Android work I'm doing today. It is just consuming too much of my time. Next function:
 	viewHtml(path)
		Opens the browser to display a local HTML file.
			path (String) the path to the HTML file
Here's how to show a file:
droid.webViewShow('file:///sdcard/sl4a/scripts/sample.html')
. Also, see here.
Or here:
def webViewShow(self,url,wait=None):
		'''
		webViewShow(url,wait=None)
		Display a WebView with the given URL.
			url (String)
			wait (Boolean) block until the user exits the WebView (optional)
		See wiki page for more
		detail.
Someone says this works:
import androidhelper

ImageFile = "http://www.google.com/images/srpr/logo4w.png"
img = file("/mnt/sdcard/image_file.html", "w")
img.write("")

droid = androidhelper.Android()
droid.webViewShow('file:///mnt/sdcard/image_file.html', None)

Friday, June 27
Created Android directory in Google Drive. Created two test graphic files, testwing.jpg and testwing.png and uploaded to Google Drive.

Trying to get Android SDK (Android Software Developers Kit) working.M
A funless, busy day trying to get Android to work. Frustrating trying to get Emulator running. Managed to get one file working and then transferred via Google Drive, hello8.py.

import androidhelper
d=androidhelper.Android()
line=d.dialogGetInput() 
s="Hi,  %s" % (line.result,) 
d.makeToast(s) 

Tuesday, June 24
After board meeting, commented androidhelper to find useful functions. Also installed Python 2.7 interpreter on my Windows machine to make it easier to figure out Qpython syntax, and, in hello4.py, read the text that I put into a file in a previous write-text experiment, hello3.py.

import androidhelper
d=androidhelper.Android()
fob=open('test.txt ','r') 
l=fob.read() 
fob.close()
d.makeToast(l) 

Sunday, June 22
Signed up for Developer's Preview of new Android-Wear watch. Put the Preview Support Library in C:\Users\Bob\Documents\Unzipped\AndroidWearPreview.
Next step is to Opt In on Google Play, but I'm going to hold off on that until I get a little more experienced.
Here is introduction to Android Wear Watch project.
Also signed up to become part of Android Wear Development community here.


Discovered a collection of esthetically pleasing Android app interfaces called Android Niceties. Something of a new style developing here...
From Reddit:
List of developer friendly sites to promote android games in without hassle.
http://androidfreegamesapps.forumotion.com/ very developer friendly http://forum.ppcgeeks.com/ very developer friendly http://forums.androidcentral.com/ a little bit stricter but still good http://www.androidprofit.com/ small but growing and developer friendly.
Signed up for a trial of a different Android emulator, ManyMo. Not sure how it works....
Signed up for a new browser, Javelin, under some sort of indecipherable "free pay-it-forward" basis.
Installed SL4A script launcher. See also here.
Paid $20 for an online book on SL4a scripting in Python on Android.
Signed up for an Android Alliance Lecture in Philly on Wednesday June 25 at 6PM.
--
Downloaded SL4A docs into my philly-bob\web\pythonfiles directory.
Tutorials:
  1. Introduction
  2. Control Flow
  3. Using JSON

Wrote hello3.py, which tests file input/output. In order to email it to myself, had to enable advanced file functions on my phone's Email. It worked.

d=androidhelper.Android()
fob=import androidhelper
open('test.txt ','w') 
fob.write('hey now brown cow') 
fob.close()
d.makeToast("text out") 

Saturday, June 21
Signed up for Developer's Preview of new Android-Wear
watch. Put the Preview Support Library in C:\Users\Bob\Documents\Unzipped\AndroidWearPreview.
Next step is to Opt In on Google Play, but I'm going to hold off on that until I get a little more experienced.
Here is introduction to Android Wear Watch project.
Also signed up to become part of Android Wear Development community here.


Wrote another QPython program, mainly trying to test ability to type files on my regular laptop and then send them to my Android phone. Hellishly complicated.
  1. Wrote hello1.py, a slight variant of hello0.py, on my laptop.
  2. Emailed it to myself as attachment
  3. Opened email on my Android phone
  4. Saved attachment to my Google Drive
  5. In Android phone Google Driven app, open file; it automatically opens in QEdit/QPython
  6. Save As hello1.py in Android Phone com.hipipal/plyplus/scripts
  7. Run QPython, MyQPython, which lists scripts
  8. Run hello1.py
  9. Take Screenshot (Hold VolumeDown, Power button)
  10. Saves screenshot in Gallery
Result:

9 PM: exhausted.

Friday, June 20
Busy day with commercial graphic works. Not much on Android project. Signed up for GitHub, a group website for advanced programmers, but not sure how to use it.


Thursday, June 19
Trying to run Android Software Development Kit, but having trouble. For a sense of how difficult it is, watch video. Finally, after 3+ hours got it "kind of" installed, but don't understand it. Here's the "money" shot, that appeared after many uninstalls and reinstalls of Java and the ASD kit.


Wednesday, June 18,4:56 PM
Got heatsick, sweaty, dizzy during a meeting yesterday with no ventilation, spending day recovering.
Researching: Kivy, Django, and PIL, which are all said to work with QPython. And pondering all the different packages in PyPi.
Learned how to take screenshots on my phone: Hold Volume Down and Power Lock for approx two seconds.
Downloaded the Android Developer Tools from Android site and installed it, but instead of a "virtual" Android phone it takes me here. Not sure I want to go through this since I am tentatively committed to a QPython path. Really, all I wanted to do was get away from the clumsy keyboard on my phone. Perhaps I can create text files on my PC and email them to my phone?


http://developer.android.com/sdk/index.html#download

Tuesday, June 17, 5:28 PM
Seated at outdoor table at Saxby's over an iced tea and a roast beef sandwich, got my first program to run. It is hello0.py, and it's very simple:

The program uses a function called "makeToast" to display a short-duration Toast notification, i.e., a little grey box that reads "hello bob." WOWZER!

This program imports a sophisticated 2200-line Python program ("module") called androidhelper, which in turn calls a "class" defined in a 64-line module called Android.
For a handy guide to the various Python modules, see Frederick Lundh's Guide to the Standard Python Library.


Monday, June 16 11:18 PM
After I returned my iPad for a refund because it was too restrictive, I'm going to learn how to write apps/programs for the Android operating system. Right now, I have an Android phone and I intend to get an Android tablet soon. Since I have some programming background in the language Python, I hope to use the free program QPython to do this. You can follow my progress here. May mark a decline in time spent on art and co-op politics.


Started: 20130716