I am guilty. I spent an afternoon and finally learned from myself without a teacher. I used C # To develop my first Android browser app. I am sorry for the Java Community (with the development process)

Source: Internet
Author: User
Tags admob

I am guilty. I spent an afternoon and finally learned from myself without a teacher. I used C # To develop my first Android browser app. I am sorry for the Java Community (with the development process)

 

Development Process:

Install vs2010, Android SDK, and AVD (Android) Simulator

 

When debugging, open the ADV (Android simulator) and add a machine model in it. Set the resolution, memory size, and SD card. After the device is started, you can debug it!

The code generated by debugging cannot be published to the real machine, because the actual Android program runs on the real machine for verification. This is called key. Store in netbeans or eclipse.

Therefore, you must use a tool named keytools in netbeans or eclipse to generate a key. Store file.
The format is as follows:
D: \ progra ~ 1 \ Java \ jdk1.7.0 _ 11 \ JRE \ bin \ keytool-genkey-v-keystore xxx-release-key.keystore-alias xxxkeystore-keyalg RSA-keysize 2048-validity 20000
What is your first name and last name?
[UNKNOWN]: huangzhi
What is the name of your organization?
[UNKNOWN]: bwsyq Co. Ltd
What is your organization name?
[UNKNOWN]: bwsyq Java develop group
What is the name of your city or region?
[UNKNOWN]: Hang Zhou
What is the name of your province/city/autonomous region?
[UNKNOWN]: Hang Zhou
What is the dual-letter country/region code for this unit?
[UNKNOWN]: 86
CN = huangzhi, ou = bwsyq Co. Ltd, O = bwsyq Java develop group, L = Hang Zhou, St = hang Z
Is Hou and c = 86 correct?

After that or ask you to enter the password, then a xxx-release-key.keystore will be generated to verify the password file alias called: xxxkeystore

Both vs2010, netbeans, and eclipse require you to enter the password when performing the release operation. After the password is verified, a real release Installation File XXX will be generated. APK. This is the app that can be installed and run on a real machine!

Example: http://pan.baidu.com/share/link? Consumer id = 383627 & UK = 201606611

Don't be happy after that. In this way, the compiled program can only run general apps. If you want to use the Google map API, You need to retrieve the MD5 password from key. Store.
Keytool-list-v-alias xxxkeystore-key store xxx-release-key.keystore
Use the keytools command to obtain
Then go to the http://www.google.com/glm/mmap Google map website to get a map key generated based on MD5
In order to use the Google map API in your released Program

Of course, there are many more, such as how to register, how to use AdMob to increase Google mobile ads in your application to make money, etc. If you are interested, join our QQ Group to discuss and exchange!

Start development: Create an Android Application

The Code is as follows: activity1.cs:

using System; using Android.App;using Android.Content;using Android.Runtime;using Android.Views;using Android.Widget;using Android.OS;using Android.Webkit; namespace hz.android.test{    [Activity (Label = "hz.android.test", MainLauncher = true)]    public class Activity1 : Activity    {        int count = 1;         protected override void OnCreate (Bundle bundle)        {            base.OnCreate (bundle);              SetContentView (Resource.Layout.Main);            Button button = FindViewById<Button> (Resource.Id.myButton);            WebView webView = FindViewById<WebView> (Resource.Id.webView1);            button.Click += delegate {                button.Text = string.Format ("{0} clicks!", count++);                webView.LoadUrl("http://blog.csdn.net/tengyunjiawu_com/article/details/8565766");            };        }    }}

 

The interface design is visualized. What you see is what you get. It is much better than netneans and eclipse, and there are many various controls!

The netneans and eclipse interfaces both need to write the axml file by themselves, which can be automatically generated after being dragged:

Layout/Main. axml

<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"    android:orientation="vertical"    android:layout_width="fill_parent"    android:layout_height="fill_parent">    <Button        android:id="@+id/myButton"        android:layout_width="fill_parent"        android:layout_height="wrap_content"        android:text="@string/hello" />    <WebView        android:layout_width="fill_parent"        android:layout_height="220.7dp"        android:id="@+id/webView1"        android:layout_marginBottom="50.0dp" />    <EditText        android:inputType="textEmailAddress"        android:layout_width="fill_parent"        android:layout_height="wrap_content"        android:id="@+id/editText1"        android:text="bwsyq@bwsyq.com QQ:99923309"        android:linksClickable="true" />    <DatePicker        android:layout_width="fill_parent"        android:layout_height="wrap_content"        android:id="@+id/datePicker1" />    <CheckedTextView        android:layout_width="fill_parent"        android:layout_height="wrap_content"        android:id="@+id/checkedTextView1" /></LinearLayout>

 

Resource. Designer. CS:

//------------------------------------------------------------------------------// <auto-generated>//     This code was generated by a tool.//     Runtime Version:4.0.30319.239////     Changes to this file may cause incorrect behavior and will be lost if//     the code is regenerated.// </auto-generated>//------------------------------------------------------------------------------ namespace hz.android.test{              public partial class Resource    {                 public partial class Attribute        {                         private Attribute()            {            }        }                 public partial class Drawable        {                         // aapt resource value: 0x7f020000            public const int Icon = 2130837504;                         // aapt resource value: 0x7f020001            public const int lbs = 2130837505;                         private Drawable()            {            }        }                 public partial class Id        {                         // aapt resource value: 0x7f050004            public const int checkedTextView1 = 2131034116;                         // aapt resource value: 0x7f050003            public const int datePicker1 = 2131034115;                         // aapt resource value: 0x7f050002            public const int editText1 = 2131034114;                         // aapt resource value: 0x7f050000            public const int myButton = 2131034112;                         // aapt resource value: 0x7f050001            public const int webView1 = 2131034113;                         private Id()            {            }        }                 public partial class Layout        {                         // aapt resource value: 0x7f030000            public const int Main = 2130903040;                         private Layout()            {            }        }                 public partial class String        {                         // aapt resource value: 0x7f040001            public const int app_name = 2130968577;                         // aapt resource value: 0x7f040000            public const int hello = 2130968576;                         private String()            {            }        }    }}

 

When debugging, open the ADV (Android simulator) and add a machine model in it. Set the resolution, memory size, and SD card. After the device is started, you can debug it!

The code generated by debugging cannot be published to the real machine, because the actual Android program runs on the real machine for verification. This is called key. Store in netbeans or eclipse.

Therefore, you must use a tool named keytools in netbeans or eclipse to generate a key. Store file.
The format is as follows:
D: \ progra ~ 1 \ Java \ jdk1.7.0 _ 11 \ JRE \ bin \ keytool-genkey-v-keystore xxx-release-key.keystore-alias xxxkeystore-keyalg RSA-keysize 2048-validity 20000
What is your first name and last name?
[UNKNOWN]: huangzhi
What is the name of your organization?
[UNKNOWN]: bwsyq Co. Ltd
What is your organization name?
[UNKNOWN]: bwsyq Java develop group
What is the name of your city or region?
[UNKNOWN]: Hang Zhou
What is the name of your province/city/autonomous region?
[UNKNOWN]: Hang Zhou
What is the dual-letter country/region code for this unit?
[UNKNOWN]: 86
CN = huangzhi, ou = bwsyq Co. Ltd, O = bwsyq Java develop group, L = Hang Zhou, St = hang Z
Is Hou and c = 86 correct?

After that or ask you to enter the password, then a xxx-release-key.keystore will be generated to verify the password file alias called: xxxkeystore

Both vs2010, netbeans, and eclipse require you to enter the password when performing the release operation. After the password is verified, a real release Installation File XXX will be generated. APK. This is the app that can be installed and run on a real machine!

Example: http://pan.baidu.com/share/link? Consumer id = 383627 & UK = 201606611

Real machine (tested on Samsung, Motorola, and HTC:

Effect after clicking the button above:

Don't be happy after that. In this way, the compiled program can only run general apps. If you want to use the Google map API, You need to retrieve the MD5 password from key. Store.
Keytool-list-v-alias xxxkeystore-key store xxx-release-key.keystore
Use the keytools command to obtain
Then go to the http://www.google.com/glm/mmap Google map website to get a map key generated based on MD5
In order to use the Google map API in your released Program

Of course, there are many more, such as how to register, how to use AdMob to increase Google mobile ads in your application to make money, etc. If you are interested, join our QQ Group to discuss and exchange!

: Http://pan.baidu.com/share/link? Consumer id = 383627 & UK = 201606611

I am also a newbie. If you have any suggestions, comments, or code, contact me: QQ chat group: 72133568,272 36303,74965947, 16592133,204 725117, 204724518

Related Article

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.