meta data for this page
Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
android:basics [2012/07/04 17:47] esa-petri |
android:basics [2012/07/04 19:10] (current) esa-petri |
||
---|---|---|---|
Line 8: | Line 8: | ||
* find core functionality and bare basic that are needed and implement them | * find core functionality and bare basic that are needed and implement them | ||
* if time was let from previous one, implement all rest fancy stuff you planed originaly | * if time was let from previous one, implement all rest fancy stuff you planed originaly | ||
- | |||
- | |||
- | |||
===Layouts=== | ===Layouts=== | ||
- | When building Gui it is important to choose right layout. while using linear layouts is easy they are very restrictive. Relative in other hand is way to get complicated designs but need often small changes to xml. I suggest to use Realative Layout as default. | + | When building Gui it is important to choose right layout. while using linear layouts is easy they are very restrictive. Relative in other hand is way to get complicated designs but need often small changes to xml. I suggest to use Realative Layout as default. |
+ | you should always when you create elements change their default name to something human readable. to do this right click element and select edit id. Do this every time you create element(or you will suffer horrible problems buhahaa....). | ||
+ | Text of elements should be placed inside project/ | ||
Things that you find your self adding by hand to xml are. | Things that you find your self adding by hand to xml are. | ||
* android: | * android: | ||
Line 20: | Line 20: | ||
* android: | * android: | ||
to add click listening to buttons, | to add click listening to buttons, | ||
- | * | + | and sizes/ |
links: | links: | ||
* http:// | * http:// | ||
* http:// | * http:// | ||
- | |||
===Icons and resources=== | ===Icons and resources=== | ||
- | your android project has resources in res folder. you can add resources by manually editing files in case of res/ | + | your android project has resources in res folder. you can add resources by manually editing files in case of res/ |
+ | you can add new icons by creating new iconbutton and changing its background and there is choice for creating new image resource. but often easiest choice is copying image to project/ | ||
Links: | Links: | ||
Line 34: | Line 34: | ||
=== AndroidManifest.xml === | === AndroidManifest.xml === | ||
- | often manifest file is missing your brand new Activity or you haven' | + | Often when your program doesn' |
links: | links: | ||
* http:// | * http:// | ||
+ | * http:// | ||
+ | |||
+ | === Debugging === | ||
+ | Next line of code is used to get android print conveniently to debugger. | ||
+ | Tag is name of class or anything you want, message is message(daa). | ||
+ | log.d(" | ||
+ | |||
+ | code line to turn some policy restrictions to errors | ||
+ | |||
+ | private static final boolean DEVELOPER_MODE = true; | ||
+ | private static final String TAG = " | ||
+ | private static final int SDK_VERSION = android.os.Build.VERSION.SDK_INT; | ||
+ | if (DEVELOPER_MODE && SDK_VERSION > 13) { | ||
+ | StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder() | ||
+ | .detectDiskReads().detectDiskWrites().detectNetwork() | ||
+ | .penaltyLog().build()); | ||
+ | StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder() | ||
+ | .detectLeakedSqlLiteObjects().detectLeakedClosableObjects() | ||
+ | .penaltyLog().penaltyDeath().build()); | ||
+ | log.d(TAG," | ||
+ | } | ||
+ | |||
+ | |||
+ | links: | ||
+ | * http:// | ||
+ | * http:// | ||
+ | |||
===If your project stops building suddenly=== | ===If your project stops building suddenly=== |