Android Advanced (23) Examples of Android development process

Source: Internet
Author: User

An example of the Android development processPreface

Looking back at the Android project that I've done before, I find myself suddenly overwhelmed by the time it took to develop, and it's been too long before the development led to a sharp drop in knowledge of Android skills. Warm and so know the new.

Talk less, get to the point ~

The following is an example of the basic Android development process, as well as the principles involved in the Android mini-projects that you have developed.

The project name is "I check", the main implementation function is to query, add product evaluation, share the shopping experience.

The main interfaces are as follows:

Figure 1 Main Function interface

Figure 2 View product information

Figure 3 Adding a new comment

Figure 4 Sweep code operation

Figure 5 Viewing the latest share

Figure 6 Adding product information

Figure 7 User Registration

Figure 8 Current user status

When you create a new Android project, you can set the app name, apply permissions, and configure four components in the Androidmanifest.xml configuration file, each node configuration can refer to other documents on the network.

At this point, the application portal is determined, for welcomeactivity, into welcomactivity, the code is as follows:

Package Org.wokankan;import Java.util.timertask;import Android.app.activity;import android.content.intent;import Android.os.bundle;import Android.os.handler;import Android.os.handlerthread;import Android.os.Message;import Android.view.window;public class Welcomeactivity extends Activity {protected static final int loginover = 0;protected stat IC final String TAG = "Welcome";p rivate Handler Handler; Because you want to override the construction method, you cannot use the anonymous inner class @overrideprotected void OnCreate (Bundle savedinstancestate) {super.oncreate ( savedinstancestate);//Set login without title bar requestwindowfeature (Window.feature_no_title); Setcontentview (R.layout.welcome); Handlerthread myThread = new Handlerthread ("Myhandlerthread"); Mythread.start (); handler = new Handler () {@ overridepublic void Handlemessage (Message msg) {if (Msg.what = = Loginover) {//page jump Intent Intent = new Intent (Welcomeactivi Ty.this, Mainactivity.class); startactivity (intent); WelcomeActivity.this.finish ();}}; Tt.run ();} TimerTask tt = new TimerTask () {@Overridepublic void run () {//LOG.I (TAG, Thread.CurrentThread (). GetName ());//set 3s to jump to mainactivityhandler.sendmessagedelayed (Handler.obtainmessage ( Loginover), 3000);}};}

At run time, there is another annoying character set encoding problem, and the Chinese characters are all question marks when they are written to the database. As shown in.

The problem is that when writing to the database, the Chinese characters are displayed correctly before writing, and then garbled after writing. You need to set how the database is encoded.

According to the previous problem resolution, in MySQL directly in the form of SQL statements to test, the test statement is as follows :

Insert into product (Barcode,product_name,guige,changjia,xinghao,imguri,qrbarcode_uri) VALUES ("123", " test " ," " ," China ","","","");

When it was executed, there was a problem. The error prompts are as follows:

In accordance with the previous problem-solving ideas, summarized as follows:

To implement Chinese characters when inserting a database without garbled characters, the following conditions should be met:

You specify the encoding method when connecting to the database, as shown in the following example:

Jdbc:mysql://localhost:3308/lmapp ? useunicode=true&characterencoding= UTF8

The subsequent encoding method designation is particularly important.

Report

Reference Documents

1.http://www.cnblogs.com/pilang/archive/2011/04/20/2022932.html

2.http://blog.csdn.net/sunhuaqiang1/article/details/51444018

3.http://blog.csdn.net/sunhuaqiang1/article/details/51644645

American and American pictures



Android Advanced (23) Examples of Android development process

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.