notifications (like growl, gnotify)
use Toast: http://developer.android.com/guide/topics/ui/notifiers/toasts.html
import android.widget.Toast;
Toast.makeText(getApplicationContext(), someString, Toast.LENGTH_SHORT).show();
create a new Android project (in Eclipse)
- File > New > Project
- Android > Android Project > Next
- Project Name: android_My_project
- Build Target: (at least API 3)
- Application Name: My project
-
Package name: (must start with domain extension (gov, edu, com) or country code (us, ca), followed by unique identifier, such as domain, followed by package name. use periods to separate words. first identifier (word) should always be lowercase. after that can be upper or lower, and can have underscores. identifiers my not start with numbers, and should have an underscore prepended to them if they do. hyphens are not allowed and should be replaced with underscores. also:
“If any of the resulting package name components are keywords (§3.9) then append underscore to them.”
see: http://java.sun.com/docs/books/jls/third_edition/html/packages.html#7.7
-
if you need a screen for your app (if it’s not purely a widget, something else)
Create Activity: MyProject
- Min SDK Version: 3
storing Android projects in revision control system (e.g. SVN, git)
- exclude the bin and gen folders from the repo
exporting your Android app for use on an Android device
- right-click on your Android project > Android Tools > Export Signed Application Package…
- click Next
- select Create new keystore
- Location: /home/username/workspace/android-test.keystore
- enter a password
- click Next
- Alias: test
- enter a password
- Validity (years): 25
- First and Last Name: test
- click Next
- choose a location for your .apk
using Bundles
Bundle bundle = new Bundle();
bundle.putString("stringKey", stringVariable);
bundle.putInt("intKey", intVariable);
String someString = bundle.getString("stringKey");
Building an Android project from elsewhere
-
Clone the project’s git repo
cd ~/workspace/git git clone ...
-
Clone the git repos for the project’s dependencies
cd ~/workspace/git git clone ...
-
Import the project and dependencies into Eclipse
-
File > Import > Android > Existing Android Code Into Workspace > Next
-
Browse > browse to the git folder > OK
-
Deselect any undesired projects (samples, tests, etc) > Finish
-
-
Configure the project dependencies in Eclipse
-
Right-click the project > Properties > Android
-
Under Library if there are any errors, click Add >select the appropriate library > OK and then remove the old library reference by clicking Remove
-