Screenshot with Android Cyanogenmod

I started to experiment  with my old Samsung Galaxy Tab 10.1 (Google IO edition) running CyanogenMod Android 4.2.2 by using it exclusively as a replacement for a laptop.

I have been creating tutorials, so I have a need to take a lot of screenshots, since it is tricky, or rather not intuitive, I thought I need to share the shortcut:

Hold Power + Volume Down (side closer to Power) for 1 second.

The screenshot on this tablet is saved under, again not very intuitive:

/storage/emulated/0/Pictures/Screenshots

I wish I kneew to to change that location to save to Google Drive, if you know please post a comment.

Developing on Android Tablet with AIDE IDE


This post is part of my experiment if Android tablet could become a (temporary) replacement for my MacBookPro laptop, here I will evaluate Android development on Android Tablet using AIDE IDE (free version / $9.99 premium).

The original post I developed using only (very old) Galaxy 10.1 (GT-P7510) tablet running CyanogenMod Android 4.2.2 and Apple BT keyboard. I had few complaints that are no longer valid when I switched to using Samsung Galaxy Note 12.1 with BT keyboard running Android Kitkat 4.4.2.

Initial observations:

  • The IDE is much better than I expected
  • Syntax completion works well
  • Syntax coloring is good
  • Compile-time errors are detected nicely
  • Home/end arrows jump to the next block {_ } of code, which make things easier
  • Synch of project directory with Dropbox is a great feature
  • The Gradle project samples are not yet supported which is a big deal as most sample projects come as Gradle builds
  • AIDE does not support (2/4 app) split screen which is not a big deal as that is not useful anyway
  • I was not able to GIT push from the tablet, but I was able to GIT Commit (locally), then Dropbox Synch and GIT Commit from my desktop, that is not perfect but it allows working with git while on the go
  • AIDE updated version while I was typing and I lost my changes

Testing GIT and Dropbox combination:







To demonstrate to PROCESS of DEVELOPMENT using AIDE, I will develop a simple Android app that
listens to GPS changes and requests Google Map webpage The final app should look like that:





Start creating a new project in the default AppProjects directory. 





For this project I am choosing simplest "Hello World" app template that only creates Main.java and corresponding files.




Since I am developing one of my own GDG Chicago Android workshops (#120), I will call this app w120.





~


  • The project will use Fine Location and Internet permissions. 
  • You can use 2 finger pinch to ZOOM text size.
  • Syntax completion does not seem to work in AndroidManifest.xml
  • Ctrl+S to save the file.
  • careful, it is easy to misspell android.permission and you will not get WARNING until you run the app and it crashes





~


  • Open res/layout/main.xml
  • Add WebView
  • I was surprised to see syntax completion: the suggestion showed for "fill_parent" but not for "android:layout_width".





~

  • Added WebView to main.xml layout. In this WebView we will display the Google Map with current location. The name of that view is "web_view" we will use it in Java code to set content.
  • I was able to select whole line with Shift+Arrow Up, then Ctrl+C, Ctrl+V which is how normally I add similar lines.
  • If you misspell you will get accurate warning
  • Also as I work on the tablet and Crtl+S, I see on the desktop that Dropbox synchs the files in real time





See more about WebView:
http://developer.android.com/reference/android/webkit/WebView.html

~


  • Open src/com/chicagoandroid/w120/MainActivity.com
  • We create a method openWebView() that will get reference to the WebView layout and pass URL to it.
  • Completion works very well in Java files.
  • Again error messaging is excellent I mistyped "getJavaScriptEnabled(true)" and it explained me clearly what is the problem
  • When typing a new class that has not been imported the error messaging is pretty clear



~
  • import completion works OK, it does not try to figure out where class Location comes from



Because of compilation error encountered above I need to add android.location.*; package. On desktop I would specify each entity to be imported separately, but here I am being lazy, which for some of my clients would be a no-no. As soon as I import the error disappears. Notice that I am in full screen mode now.





Finished adding method that build Google Map URL



~
  • Cleaned up and optimized the code
  • AIDE does NOT like comments, I had to close project and open file again because sometimes the Java got all green from the comments above.
  • The members highlighted in Yellow are not being used yet




~


  • Method that starts Location Updates Listener. 
  • Once again completion works very well.
  • For long lines pinch to zoom
  • We set it so it updates only every 10 meters or ever 30 seconds, more often would not be practical using Web Google Maps that have to re-load.
  • we will call this method in onCreate()



~


  • Implement Location Listener with its methods. 
  • Error messaging is excellent
  • Once you start typing @Override methods the completion kicks in nicely
  • For now we just re-open the WebView with new address every time we get notified of location change.




~


  • Finally we can we can put method startLocationManager() in onCreate(..). 
  • Hint: if you have methods that are underlined yellow that means you are not using them.





~

  • Open res/layout/main.xml
  • add TextView id



~

  • Add statusLine variable which we will use to display Location status changes
  • hide webView until we have actual map to show

~
  • you can refine the messages in your Location Listener
  • do not forget to set webView to VISIBLE





  • Enable GPS on your device
  • In the MENU in top-right corner make sure your files are SAVED. 
  • Now try to RUN your project.
  • The build process takes noticeably longer on OLD TABLET that on new one.




If no errors the app will go thru installation steps, asking for permissions.




~




  • If you made mistakes, e.g. in permissions the app will crash and you can look at the logcat
  • Hint: use pinch to zoom LogCat text




  • ~

    • Creating application KeyStore and signing the app for distribution




    And finally we have an app that is ready for distribution. You can attach it to email and send it to friends and family to admire your genius.



      


    This is by no means completed app and it could keep growing and getting better, but it does show a concept of changing UI based on LocationListener.



    Working on Android tablet

    Today, I was shopping for Windows 8 tablet/laptop. I am a Mac user, but my wife has to use Windows for work. I have to say that I was very impressed, I liked Microsoft Surface Pro 2 and Sony VAIO fit 13.

    I think the tablet/laptop or fun/work market segment will be huge.

    Being an Android developer I was thinking "Why I cannot use ONE tablet to do all my stuff, namely:

    1) Write Android apps
    2) Edit my docs and books (Apple Pages, or Word Docs) 
    3) Edit spreadsheets (time sheets, balance sheets, estimates)
    4) Use misc tools for code management (code repo, diff tools)

    Soon you will be able to have an Android tablet with QUAD processors and 128-256 GB of memory, and external USB hard drive, HDMI port and BT HID (keyboard, pointer).


    I started to research what is available and a quick search came up with the following:

    ANDROID DEV TOOLS
    https://play.google.com/store/apps/details?id=com.aide.ui
    https://play.google.com/store/apps/details?id=com.assoft.DroidDevelop

    ORION - browser based
    http://mmilinkov.wordpress.com/2011/01/11/introducing-orion/

    I will evaluate these tools, your comments and continue this article.

    Ciao!

    ~ Uki