Home IT Linux Windows Database Network Programming Server Mobile  
           
  Home \ Programming \ Use Visual Studio 2015 to develop Android program     - CentOS7 install MySQL5.6.22 (Linux)

- Switching Virtual Machine + Ubuntu graphical interface and terminal interface (Linux)

- Fast Sort Algorithms (Programming)

- KVM usb passthrough configuration (Linux)

- grub boot error resolution examples (Linux)

- CentOS5 installation Nodejs (Linux)

- Define and modify strings principle in Python (Programming)

- Node.js v4.0.0 installation configuration on Ubuntu 14.04 / 15.04 (Linux)

- CentOS 7 open ports (Linux)

- Installation and Configuration rsync server under CentOS 6.3 (Server)

- Linux system started to learn: Teaches you install Ubuntu 15.04 on VirtualBox (Linux)

- CentOS 6 / Linux su: Unable to set user ID: Resource temporarily unavailable (Linux)

- Nodejs complete installation instructions for Express (Linux)

- Configuring a Linux operating system security management services Explain (Linux)

- Ubuntu treated with cue file to ape and wav files automatically track points (Linux)

- Applications in Objective-C runtime mechanism (Programming)

- Without Visual Studio .NET Windows application development (Programming)

- How to use the command line to obtain Freely RSS source on Linux (Linux)

- After VMware CentOS full VM clone the network card is unavailable Solutions (Linux)

- Ubuntu 14.04.02 LTS startup items erroneous writing / dev / sda1 (win 7 loader) Repair (Linux)

 
         
  Use Visual Studio 2015 to develop Android program
     
  Add Date : 2017-08-31      
         
       
         
  Environment configuration:

Operating System: win 7 64 Wei

IDE: Visual Studio 2015

SDK: installer_r24.3.3-windows

Installation prerequisites:

Edit the hosts file (in the annex can be downloaded) because the installation process to update and registration networking

After completing the installation directly VS New Android program will prompt:

---------------------------

Microsoft Visual Studio

---------------------------

Value can not be null. Parameter name: path1

---------------------------

Determine

---------------------------
 

That is because VS is not configured with the android SDK, then we set.

The first step: update android SDK

Self Baidu and install installer_r24.3.3-windows.exe, and then open the installation path of SDK Manager to select a version of Android updates, such as 4.1.2, other versions may be needed to remove the check mark.

And then wait for updated

Then open the AVD Manager to create a virtual machine:

Click Start to start on the right look can play together.

Step Two: Create a new android project:

Then you will be asked to sign in:

You need to register and log in.

Followed by opening Explorer, locate the file layout:

Double-click to open the design interface:

Toolbox above has built a lot of control:

Here it does not matter, like procrastinate, do not like to write their own layout code, we completed a login screen:

Complete code such as:

< ? Xml version = "1.0" encoding = "utf-8"?>
< LinearLayout xmlns: android = "http://schemas.android.com/apk/res/android"
    android: layout_width = "fill_parent"
    android: layout_height = "fill_parent"
    android: orientation = "vertical"
    android: layout_margin = "5dip">
    < TextView
        android: id = "@ + id / form_title"
        android: layout_width = "wrap_content"
        android: layout_height = "wrap_content"
        android: text = "initial user name and password are 123" />
    < LinearLayout
        android: id = "@ + id / layout_login_name"
        android: layout_width = "fill_parent"
        android: layout_height = "wrap_content"
        android: layout_margin = "5.0dip"
        android: layout_marginTop = "10.0dip"
        android: orientation = "horizontal">
        < TextView
            android: layout_width = "wrap_content"
            android: layout_height = "wrap_content"
            android: text = "login:" />
        < EditText
            android: id = "@ + id / txt_login_name"
            android: layout_width = "fill_parent"
            android: layout_height = "wrap_content"
            android: textSize = "15.0sp" />
    < / LinearLayout>
    < LinearLayout
        android: id = "@ + id / login_pwd_layout"
        android: layout_width = "fill_parent"
        android: layout_height = "wrap_content"
        android: layout_below = "@ id / layout_login_name"
        android: layout_centerHorizontal = "true"
        android: layout_margin = "5.0dip"
        android: orientation = "horizontal">
        < TextView
            android: id = "@ + id / login_pass_edit"
            android: layout_width = "wrap_content"
            android: layout_height = "wrap_content"
            android: text = "Password:"
            android: textSize = "15.0sp" />
        < EditText
            android: id = "@ + id / txt_login_pwd"
            android: layout_width = "fill_parent"
            android: layout_height = "wrap_content"
            android: password = "true"
            android: textSize = "15.0sp" />
    < / LinearLayout>
    < Button
        android: id = "@ + id / btn_login"
        android: layout_width = "fill_parent"
        android: layout_height = "wrap_content"
        android: layout_gravity = "center"
        android: gravity = "center"
        android: onClick = "btn_click"
        android: text = "Login" />
< / LinearLayout>

These codes a little hard Nengkanmingbai.

Open MainActivity edit code as follows:

protected override void OnCreate (Bundle bundle)
  {
    base.OnCreate (bundle);
    // Set our view from the "main" layout resource
    SetContentView (Resource.Layout.Main);
    // Get our button from the layout resource, form_title
    // And attach an event to it
            Button button = FindViewById < Button > (Resource.Id.btn_login);
            EditText txtLoginName = FindViewById < EditText> (Resource.Id.txt_login_name);
            EditText txtLoginPwd = FindViewById < EditText> (Resource.Id.txt_login_pwd);
            TextView txtMsg = FindViewById < TextView> (Resource.Id.form_title);
            button.Click + = delegate {
                                        string loginName = txtLoginName.Text;
                                        string loginPwd = txtLoginPwd.Text;
                                        if (loginName == loginPwd && loginName == "123")
                                          {
                                              txtMsg.Text = "successful landing!";
                                          }
                                    };
  }

The meaning is very simple, is to find the control, the value assignment, the control ID is defined in the layout @ + id / it is behind.

IntelliSense does not speak, temporarily Renren it.

Then start, press F5, or if you want to view the details of abnormal operation, Please open logcat:

The widening output console:

Later if Ben collapse, more information can be found in operation here.

Go to Control Panel in the virtual machine:

Start it, enter information:

Click Sign:

The third step: Deploying app

After the second step you can find the install apk file in debug directory:

Then the excitement is copied to a mobile phone and found that it is simply impossible.

The reason is that VS developed apk need to publish in order to install and use, the release button

Now gray, you need to debug mode to release is available:

Publishing Wizard will then appear:

Here you please feel free!

Then continues:

Remember the above path, one will find here APK installation file.

And then wait for the black screen shines 2, there have been looking forward to this file:

Copied to the phone, install and start it was Joseph!
     
         
       
         
  More:      
 
- The correct method to modify the maximum number of concurrent connections Tomcat 7 (Server)
- How to configure AWStats in Ubuntu Server (Server)
- MongoDB3.0.6 wiredtiger MMAPv1 (Database)
- Ubuntu Telnet service settings (Linux)
- Windows using SSH management Ubuntu (Linux)
- Ubuntu prompt / lack of boot space solutions (Linux)
- Talking about the implementation and the JVM garbage collection mechanism (Programming)
- Android Studio Personalization (Linux)
- Linux at command (Linux)
- Dell R710 server disk recovery database one case (record) (Server)
- Django template inheritance child (Programming)
- C ++ containers (Programming)
- Creating and extracting archives 11 tar command examples in Linux (Linux)
- Linux settings Java_home (Linux)
- Mhddfs: multiple smaller partitions into one large virtual storage (Linux)
- To install Redis under Linux (Database)
- To use iostat display I / O status under Linux (Linux)
- Yii2 Advanced Version Copy New Project Problem Solved (Programming)
- Spring Boot + Nginx + Tomcat + SSL configuration notes (Server)
- Linux disk partition, format, mount the directory (Linux)
     
           
     
  CopyRight 2002-2016 newfreesoft.com, All Rights Reserved.