Difference between revisions of "Android Development"

From Klaus' wiki
Jump to: navigation, search
(Importing a project into Eclipse Juno)
 
(11 intermediate revisions by the same user not shown)
Line 1: Line 1:
==Applications==
+
=Android tips and trix.=
  
[[meterReading]] is an application that helps you controlling your consumption of electricity, water, heating, etc.
+
Below you will find some of the quirks I've been through and fixes for them. Some may have vanished while improvements has been programmed into Eclipse and the SDK.
  
==Android tips and trix.==
+
==Code styles==
  
Use [[File:Klaus_java_format.xml]] to format your Java code - it will then look most like the AU-HIH standard for C/C++.
+
Use [[File:Klaus_java_format.xml]] to format your Java code - it will then look most like the AU-HIH standard for C/C++. The your code would look like [[Android Example Code]]
 +
 
 +
==Code fragments that might be helpful==
 +
 
 +
[[How to move your app to SD card]]
 +
 
 +
[[Backward compatibility]]
 +
 
 +
==Solving Quirks==
  
 
On Linux (at least Fedoras) the Pop-up dialogs used to set all kind of properties does not work by just clicking on them with your mouse. Instead first issue '''Alt+F12''' before clicking on the elipsis (...). When finished hit '''ESC'''
 
On Linux (at least Fedoras) the Pop-up dialogs used to set all kind of properties does not work by just clicking on them with your mouse. Instead first issue '''Alt+F12''' before clicking on the elipsis (...). When finished hit '''ESC'''
 +
 +
===Connect devices to Linux boxes===
 +
 +
To connect your HTC android to your Fedora linux follw the instructions given on [http://developer.android.com/guide/developing/device.html Google Developers site]
 +
 +
<source lang="bash">
 +
SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", MODE="0666", GROUP="plugdev"
 +
</source>
 +
 +
To have your Motorola Xoom connected to your Linux box add a file in /etc/udev/rules.d called 92-motorola-xoom.rules with this content:
 +
 +
<source lang="bash">
 +
ACTION!="add", GOTO="xoom_rules_end"
 +
SUBSYSTEM!="usb|usb_device", GOTO="xoom_usb_end"
 +
 +
ATTRS{idVendor}=="22b8", ATTRS{idProduct}=="70a8", MODE="0666" SYMLINK+="xoom"
 +
ATTRS{idVendor}=="22b8", ATTRS{idProduct}=="70a9", MODE="0666" SYMLINK+="xoom"
 +
 +
LABEL="xoom_usb_end"
 +
LABEL="xoom_rules_end"
 +
</source>
 +
 +
To let Samsung Galaxy S2 be recognised by the debugger add these lines to 92-samsung.rules in /etc/udev/rules.d
 +
 +
<source lang="bash">
 +
SUBSYSTEMS=="usb", ATTRS{idVendor}=="04e8",
 +
ATTRS{idProduct}=="6640", MODE="0660", OWNER="root",
 +
GROUP="androiddev", SYMLINK+="android%n"
 +
SUBSYSTEM=="usb", SYSFS{idVendor}=="04e8", MODE="0666"
 +
</source>
 +
 +
==Utilities==
  
 
Screencast your phone on the PC with [http://androidscreencast.googlecode.com/svn/trunk/AndroidScreencast/dist/androidscreencast.jnlp this]
 
Screencast your phone on the PC with [http://androidscreencast.googlecode.com/svn/trunk/AndroidScreencast/dist/androidscreencast.jnlp this]
Line 13: Line 53:
 
List of phones with technical information can be found [http://www.andro-phones.com/2010-android-phones.php here]
 
List of phones with technical information can be found [http://www.andro-phones.com/2010-android-phones.php here]
  
Books:
+
Logcat tool for the phone: [http://code.google.com/p/alogcat/ Logcat]
 +
 
 +
==Books==
 +
 
 
[http://pragprog.com/titles/eband3/hello-android Hello Android]
 
[http://pragprog.com/titles/eband3/hello-android Hello Android]
  
 
[http://www.amazon.com/Professional-Android-Application-Development-Programmer/dp/0470565527/ref=cm_lmf_tit_2 Professional Android Application Development Programmer]
 
[http://www.amazon.com/Professional-Android-Application-Development-Programmer/dp/0470565527/ref=cm_lmf_tit_2 Professional Android Application Development Programmer]
  
Tutorials - on-line examples:
+
==Tutorials - on-line examples==
 +
 
 
[http://www.androidsnippets.org/ AndroidSnippets]
 
[http://www.androidsnippets.org/ AndroidSnippets]
  
Line 28: Line 72:
  
 
[http://developer.android.com/guide/index.html Guides] at Android.com
 
[http://developer.android.com/guide/index.html Guides] at Android.com
 
Logcat tool for the phone: [http://code.google.com/p/alogcat/ Logcat]
 
  
 
API demo's: [http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/view/index.html API demo]
 
API demo's: [http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/view/index.html API demo]
Line 36: Line 78:
  
 
Source of knowledge [http://stackoverflow.com StackOverFlow]
 
Source of knowledge [http://stackoverflow.com StackOverFlow]
 +
 +
A tutorial for playing with [http://www.droidnova.com/playing-with-graphics-in-android-part-i,147.html graphics] in Android.
 +
 +
==Importing a project into Eclipse Juno==
 +
 +
It seams as if Juno don't accept old configuration from - much - earlier Eclipses.
 +
 +
Fear not!
 +
 +
Create a new empty directory to hold your project and import from the old version directory into this.
 +
 +
If you include some external delivered libraries you may run into errors when accessing functions in the library.
 +
 +
No problem!
 +
 +
Just follow these instructions I've dig'ed up on the Internet.
 +
 +
In Eclipse:
 +
-> Right click your project - go to build path - select Configure build path
 +
-> go to the "Order and Export" tab
 +
-> Check the "achartengine-1.0.0.jar box and then single click its name
 +
-> move it up so its right below the Android dependencies (sometimes this can make a difference if you have multiple Jars)
 +
 +
Source [https://groups.google.com/forum/?fromgroups=#!topic/achartengine/TLHv3a08GdA Google Groups]

Latest revision as of 12:42, 13 December 2012

Android tips and trix.

Below you will find some of the quirks I've been through and fixes for them. Some may have vanished while improvements has been programmed into Eclipse and the SDK.

Code styles

Use File:Klaus java format.xml to format your Java code - it will then look most like the AU-HIH standard for C/C++. The your code would look like Android Example Code

Code fragments that might be helpful

How to move your app to SD card

Backward compatibility

Solving Quirks

On Linux (at least Fedoras) the Pop-up dialogs used to set all kind of properties does not work by just clicking on them with your mouse. Instead first issue Alt+F12 before clicking on the elipsis (...). When finished hit ESC

Connect devices to Linux boxes

To connect your HTC android to your Fedora linux follw the instructions given on Google Developers site

SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", MODE="0666", GROUP="plugdev"

To have your Motorola Xoom connected to your Linux box add a file in /etc/udev/rules.d called 92-motorola-xoom.rules with this content:

ACTION!="add", GOTO="xoom_rules_end"
SUBSYSTEM!="usb|usb_device", GOTO="xoom_usb_end"
 
ATTRS{idVendor}=="22b8", ATTRS{idProduct}=="70a8", MODE="0666" SYMLINK+="xoom"
ATTRS{idVendor}=="22b8", ATTRS{idProduct}=="70a9", MODE="0666" SYMLINK+="xoom"
 
LABEL="xoom_usb_end"
LABEL="xoom_rules_end"

To let Samsung Galaxy S2 be recognised by the debugger add these lines to 92-samsung.rules in /etc/udev/rules.d

SUBSYSTEMS=="usb", ATTRS{idVendor}=="04e8",
ATTRS{idProduct}=="6640", MODE="0660", OWNER="root",
GROUP="androiddev", SYMLINK+="android%n"
SUBSYSTEM=="usb", SYSFS{idVendor}=="04e8", MODE="0666"

Utilities

Screencast your phone on the PC with this

List of phones with technical information can be found here

Logcat tool for the phone: Logcat

Books

Hello Android

Professional Android Application Development Programmer

Tutorials - on-line examples

AndroidSnippets

Common tasks

Android SDK Alert

Examples at Android.com

Guides at Android.com

API demo's: API demo

Icons for Android: Icons

Source of knowledge StackOverFlow

A tutorial for playing with graphics in Android.

Importing a project into Eclipse Juno

It seams as if Juno don't accept old configuration from - much - earlier Eclipses.

Fear not!

Create a new empty directory to hold your project and import from the old version directory into this.

If you include some external delivered libraries you may run into errors when accessing functions in the library.

No problem!

Just follow these instructions I've dig'ed up on the Internet.

In Eclipse:

-> Right click your project - go to build path - select Configure build path
-> go to the "Order and Export" tab
-> Check the "achartengine-1.0.0.jar box and then single click its name
-> move it up so its right below the Android dependencies (sometimes this can make a difference if you have multiple Jars)

Source Google Groups