Free to use the C # programming language to develop an Android browser.
First, install VS2010, install the Android SDK, configure the AVD (Android) emulator .
When debugging open ADV (Android Simulator) in the inside you add a machine model, set the resolution, memory size, SD card, after startup, you can debug!
Debug generated code is not published to the real machine, because the actual Android program is running in the real machine will be verified when it is called Key.store in NetBeans or eclipse
So when publishing, use a tool called Keytools in NetBeans or eclipse to generate a Key.store file.
Use the following format:
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 and last name?
[Unknown]: Huangzhi
What is the name of your organizational unit?
[Unknown]: Bwsyq co.ltd
What is your organization's name?
[Unknown]: bwsyq java Develop group
What is the name of your city or region?
[Unknown]: Hang Zhou
What is the name of your state/province?
[Unknown]: Hang Zhou
What is the two-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
Hou, is c=86 correct?
After this or ask you to enter the password, this time will produce a Xxx-release-key.keystore authentication password file alias called: Xxxkeystore
Whether it's vs2010 or NetBeans or eclipse will ask you to enter your password when it's released, the password verification will generate a real release installation file, xxx. APK, this is the app that can be installed on the real machine!
Example: http://pan.baidu.com/share/link?shareid=367259&uk=201606611
Then don't be happy, so the compiled program can only run the general APP, if you want to use Google Maps API, you also need to remove the MD5 password from the Key.store
Keytool-list-v-alias Xxxkeystore-keystore Xxx-release-key.keystore
To fetch it through this keytools command.
Then go to http://www.google.com/glm/mmap Google Maps website to get a map generated from MD5 key
To use the Google Maps API in the program you publish
Of course, there are many, such as how to register, using AdMob How to add Google Mobile ads in your app to make money, and so on, interested can join our QQ group together to explore the exchange!
Start development: New Android Application
The resulting code is as follows: Activity1.cs code:
usingSystem;usingAndroid.app;usingAndroid.content;usingAndroid.runtime;usingAndroid.views;usingAndroid.widget;usingAndroid.os;usingAndroid.webkit;namespacehz.android.test{[Activity (Label ="Hz.android.test", Mainlauncher =true)] Public classactivity1:activity {intCount =1;protected Override voidOnCreate (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, the WYSIWYG is much stronger than Netneans and eclipse, and there are a lot of different controls!
Figure 1
Use Netneans and Eclipse to write your own axml file, which will be automatically generated after you drag it:
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 =< Span style= "color: #DD1144;" > "textemailaddress" android:layout_width = "Fill_parent" android:layout_height = "Wrap_content" Span style= "color: #008080;" >android:id = "@+id/edittext1" android: Text = android:linksclickable =/> <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 This is the R.java class code that is automatically generated when you develop Android for NetBeans or Java:
//------------------------------------------------------------------------------ //<auto-generated> //This code is generated by a tool. //Runtime version:4.0.30319.239 // //Changes to this file may cause incorrect behavior and'll be lost if //The code is regenerated. //</auto-generated> //------------------------------------------------------------------------------Namespace hz.android.test{ PublicPartial class Resource { PublicPartial class Attribute { PrivateAttribute () {}} PublicPartial class drawable { //AAPT resource value:0x7f020000 Public Const intIcon =2130837504;//AAPT resource value:0x7f020001 Public Const intlbs =2130837505;PrivateDrawable () {}} PublicPartial class Id { //AAPT resource value:0x7f050004 Public Const intCheckedTextView1 =2131034116;//AAPT resource value:0x7f050003 Public Const intDatePicker1 =2131034115;//AAPT resource value:0x7f050002 Public Const intEditText1 =2131034114;//AAPT resource value:0x7f050000 Public Const intMyButton =2131034112;//AAPT resource value:0x7f050001 Public Const intWebView1 =2131034113;PrivateId () {}} PublicPartial class Layout { //AAPT resource value:0x7f030000 Public Const intMain =2130903040;PrivateLayout () {}} PublicPartial class String { //AAPT resource value:0x7f040001 Public Const intApp_name =2130968577;//AAPT resource value:0x7f040000 Public Const intHello =2130968576;PrivateString () {}}}}
When debugging open ADV (Android Simulator) in the inside you add a machine model, set the resolution, memory size, SD card, after startup, you can debug!
Debug generated code is not published to the real machine, because the actual Android program is running in the real machine will be verified when it is called Key.store in NetBeans or eclipse
So when publishing, use a tool called Keytools in NetBeans or eclipse to generate a Key.store file.
Use the following format:
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 and last name?
[Unknown]: Huangzhi
What is the name of your organizational unit?
[Unknown]: Bwsyq co.ltd
What is your organization's name?
[Unknown]: bwsyq java Develop group
What is the name of your city or region?
[Unknown]: Hang Zhou
What is the name of your state/province?
[Unknown]: Hang Zhou
What is the two-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
Hou, is c=86 correct?
After this or ask you to enter the password, this time will produce a Xxx-release-key.keystore authentication password file alias called: Xxxkeystore
Whether it's vs2010 or NetBeans or eclipse will ask you to enter your password when it's released, the password verification will generate a real release installation file, xxx. APK, this is the app that can be installed on the real machine!
Example: http://pan.baidu.com/share/link?shareid=367259&uk=201606611
The real machine (tested on Samsung, Motorola, HTC) has the following effects:
The browser interface generates the APK file.
End
Android Browser for the first app developed in C # (Genesis)