meta data for this page
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| android:questions [2010/03/16 18:03] – hevi | android:questions [2010/03/19 08:32] (current) – ppuro | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Android Coding Questions ====== | ====== Android Coding Questions ====== | ||
| + | |||
| + | |||
| + | ==== Where' | ||
| + | |||
| + | < | ||
| + | |||
| + | <?xml version=" | ||
| + | < | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | |||
| + | < | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | |||
| + | | ||
| + | |||
| + | </ | ||
| + | |||
| + | </ | ||
| + | |||
| + | ==== How do I start another activity? ==== | ||
| + | |||
| + | < | ||
| + | startActivity(new Intent(this, | ||
| + | </ | ||
| + | + Don't forget to add lines in AndroidManifest.xml | ||
| + | |||
| + | ==== How to add EditText fields to the table' | ||
| + | < | ||
| + | < | ||
| + | android: | ||
| + | android: | ||
| + | < | ||
| + | < | ||
| + | android: | ||
| + | < | ||
| + | < | ||
| + | </ | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | ==== How to get Eclipse and Android work in Ubuntu? ==== | ||
| + | For eclipse you need to use sun java packages (gcc gjc java is installed by default but it does not seem to work well) | ||
| + | * https:// | ||
| + | * get JDK (SDK) package as well | ||
| + | |||
| + | Ubuntu 9.10 repositories have Eclipse 3.5.1. It does not work with Android SDK. Get newer Eclipse. Version 3.5.2 seem to work. | ||
| + | * http:// | ||
| + | * Extract it to your self installed software place (eg. /opt) and link eclipse start program to some place in your PATH. | ||
| + | |||
| + | Follow general android install [[setup|instructions]]. | ||
| + | |||
| + | |||
| + | ==== How to save XML file after editing (f.e. adding new child) - what class to use? ==== | ||
| + | |||
| + | To use XmlSerializer is one option to save XML into readable form (string or file). | ||
| + | |||
| + | See the following link [[http:// | ||
| + | |||
| + | < | ||
| + | |||
| + | private String writeXml(List< | ||
| + | XmlSerializer serializer = Xml.newSerializer(); | ||
| + | StringWriter writer = new StringWriter(); | ||
| + | try { | ||
| + | serializer.setOutput(writer); | ||
| + | serializer.startDocument(" | ||
| + | serializer.startTag("", | ||
| + | serializer.attribute("", | ||
| + | for (Message msg: messages){ | ||
| + | serializer.startTag("", | ||
| + | serializer.attribute("", | ||
| + | serializer.startTag("", | ||
| + | serializer.text(msg.getTitle()); | ||
| + | serializer.endTag("", | ||
| + | serializer.startTag("", | ||
| + | serializer.text(msg.getLink().toExternalForm()); | ||
| + | serializer.endTag("", | ||
| + | serializer.startTag("", | ||
| + | serializer.text(msg.getDescription()); | ||
| + | serializer.endTag("", | ||
| + | serializer.endTag("", | ||
| + | } | ||
| + | serializer.endTag("", | ||
| + | serializer.endDocument(); | ||
| + | return writer.toString(); | ||
| + | } catch (Exception e) { | ||
| + | throw new RuntimeException(e); | ||
| + | } | ||
| + | } | ||
| + | |||
| + | </ | ||
| + | ==== Does anybody know how to launch another application, | ||
| + | I know how to launch web-browser, | ||
| + | |||
| + | A: A generic answer to this is that you need to know the intent filter of the started activity/ | ||
| + | |||
| ==== How to add question ? ==== | ==== How to add question ? ==== | ||
| Line 8: | Line 111: | ||
| How to get functionality X to work ? | How to get functionality X to work ? | ||
| </ | </ | ||
| + | |||
| ==== How to answer a question ? ==== | ==== How to answer a question ? ==== | ||
| - | Just write a solution text into section. | + | Just write a solution text into section, after question. |
| - | If solution is bigger that one paragraph size, it is good idea document solution into separate page. | + | If solution is bigger that one paragraph size (having eg. couple screenshots), it is good idea document solution into separate page. |
| < | < | ||
| Solution in [[separate page]] | Solution in [[separate page]] | ||
| </ | </ | ||