Hello TWaver Android

Source: Internet
Author: User

First, you need to build an Android Development environment, install the eclipse and ADT (Android Development Tools) plug-ins, and install the required SDK In the Android SDK Manager. Developers must master the Java programming language and have Android development capabilities. Finally, you need the TWaver Android development library file (twaver. android. jar) to start TWaver Android development. The following is a step-by-step explanation using the simplest Hello TWaver example. Create a Hello TWaver project, create an Android Application project "Hello TWaver", and set the package name to "twaver. demo. hellotwaver ", select the minimum SDK as API 11 (Android 3.0), select the Target SDK as API 11, and then follow the wizard prompts to end. The wizard automatically generates some files and directories, including "MainActivity. java "file is the default Main Boot class, and we will modify this file later. A brief introduction to each directory: Import twaver. android. the jar class library needs to introduce the twaver android Development Kit. The introduced class library in Android is different from the desktop Java Development, and needs to be imported through the "Import" method, instead of "build path ", use the Import Wizard to Import twaver. android. jar and ADT are automatically converted to the formats supported by the Dalvik virtual machine. The steps are as follows: select the libs directory, right-click "Import", select the file system, and find "twaver. android. jar ", click Finish," twaver. android. jar "will appear in the libs directory, so that we can call the API in twaver android: Write Hello TWaver to open the previously automatically generated MainActivity. java "File, this is the main Bootstrap class of this project. Find the" onCreate "method (this method will be called when the application loads). Here we create a Network component, and use "setContentView (...) "Add it to the Panel. The Code is as follows: create a Network component and add two nodes, one line, and one alarm to its data container, finally, set this network component to content view 1 @ Override 2 protected void onCreate (Bundle savedInstanceState) {3 super. onCreate (savedInstanceState); 4 5 Network network = new Network (this); 6 ElementBox = network. getElementBox (); 7 8 Node node = new Node (); 9 no De. setName ("Hello"); 10 node. setStyle (Styles. LABEL_OUTLINE, 1); 11 node. set location (50,100); 12 box. add (node); 13 Node node2 = new Node (); 14 node2.setName ("TWaver"); 15 node2.setLocation (250,200); 16 box. add (node2); 17 Link link = new Link (node, node2); 18 link. setName ("Hello TWaver"); 19 box. add (link); 20 21 box. getAlarmBox (). add (new Alarm (node. getId (), AlarmSeverity. CRITICAL); 22 23 this. setContentView (Network); 24} Run and debug the final running program. Android applications can be published to virtual machines or directly connected to real devices. I recommend using real devices for debugging and development, this is highly efficient and supports multi-touch. Note that not all Android devices can be used for development. We recommend that you use Google Nexus products, for more information about Device Development, refer to: Development. Open the Android simulator manager and create a virtual machine with an API level greater than or equal to 11. Here we use 4.0.3 and select the corresponding SDK: start after creation, wait until the virtual machine starts up, start running the Application just now (right-click and choose Run as --> Android Application). The following page is displayed;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.