Hello, I’m Grey Ape! A super bug writing program ape!

Recently, a student has learned a lot under the cultivation of many big men,

Although I did not wait, my lovely girlfriend came to me for help. She actually said that the Android Studio came with a real machine that did not work well, and she wanted me to help her browse the articles of various big guys on the Android VIRTUAL machine. It seems that my girlfriend is not limited to using her own computer or mobile phone to learn the knowledge in my articles.

Girl friend come, this which can hold, I pa of stand up, very quick! Then up is a left is kicking a right leg a left jab, “pop” of my computer opened!

When I opened the Android Studio, I had to write the code by hand. My girlfriend said, “This is not good. There are always problems with the real machine debugging, so you can’t use your own real machine!”

I was shocked to hear it! And this?

I rigged her up with a Nighthian simulator.

Not only can you play games with your neighbor on a virtual machine, you can run Android apps, and most importantly, it’s fast! I don’t have to worry about my girlfriend not receiving my wechat anymore,

But here’s the problem!

After installing the Simulator, I found that the simulator does not show up in the Android Studio runtime options. I cannot find the device. This can be the girlfriend anxious bad!

But how can such a little thing keep me away?

I asked her to open the CMD command line and find the installation directory of the “God simulator”. She had to manually enter the path.

First, I found the installation path “\Nox\bin”, a CTRL+L, then enter a “CMD”, the last press enter, directly locked to the CMD command interface under the path, good guy! Her girlfriend was stunned, which made her learn a new skill! No longer need to open CMD to manually enter the path to lock.

Next, I typed on the command line:

Nox_adb. Exe connect 127.0.0.1:62001

I asked her to re-run Android Studio, but it still didn’t show the emulator device. It was easy, and programmers used common practice to restart the “Night God Simulator”.

Finally, the emulator device name appears under the “Run” button. Select it and run it again.

This is a success! This is absolutely useful!

Finally, with a few lines of code, I made a small control to help her realize her little wish to browse the big guys on the Android VIRTUAL machine:

Activity_main.xml file code:


      
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <EditText
        android:id="@+id/htmlUrl"
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:layout_marginTop="10dp"
        ></EditText>

    <Button
        android:id="@+id/htmlUrl_bt"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Read the big guy's article."
        android:textSize="30dp"
        app:layout_constraintTop_toBottomOf="@id/htmlUrl"
        ></Button>

</androidx.constraintlayout.widget.ConstraintLayout>
Copy the code

Mainactivity. Java file code:

package com.example.linktest5_11;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;

import android.view.View;
import android.widget.Button;
import android.widget.EditText;



public class MainActivity extends AppCompatActivity {

    EditText htmlUrl;
    Button htmlUrl_bt;
    @Override
    protected void onCreate(Bundle savedInstanceState){
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        htmlUrl = findViewById(R.id.htmlUrl);
        htmlUrl_bt = findViewById(R.id.htmlUrl_bt);

        htmlUrl_bt.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String htmlUrl_str = htmlUrl.getText().toString();
                Intent intent = newIntent(Intent.ACTION_VIEW,Uri.parse(htmlUrl_str)); startActivity(intent); }}); }}Copy the code

It works like this:

This can be the girlfriend happy bad, and can be happy to learn each big guy’s article!