新建虚拟手机:
效果:
res->layout->activity_main.xml:
点击code:
Logcat:
package com.example.demo;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity {
public Button btnLogin;
public Button btnReset;
public TextView txtUser, txtPwd;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
initView();
//绑定事件
btnLogin.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Log.e("事件", "点击登录");
}
});
btnReset.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Log.e("事件", "点击登录");
}
});
}
public void initView(){
btnLogin = findViewById(R.id.btn_login);
btnReset = findViewById(R.id.btn_reset);
txtUser = findViewById(R.id.txt_user);
txtPwd = findViewById(R.id.txt_pwd);
}
}
简单功能:
重置:
public void doReset(){
//清空输入框
txtUser.setText("");
txtPwd.setText("");
}
登录功能:
引入模块:
implementation ("com.squareup.okhttp3:okhttp:4.9.1")
这里:
记得要下载:
给权限:
这里我搞了一个flask项目,不能用127.0.0.1
from flask import Flask, request
app = Flask(__name__)
@app.route("/login", methods=['GET', 'POST'])
def login():
print(request.form)
user = request.form.get('user')
pwd = request.form.get('pwd')
return "OOOK"
if __name__ == '__main__':
app.run(host="0.0.0.0", port=8000)
https://blog.csdn.net/lw_zhaoritian/article/details/121291067
报错:
not permitted by network security policy
https://blog.c服务器托管网sdn.net/qq_33401954/article/details/102617018
效果:
服务器托管,北京服务器托管,服务器租用 http://www.fwqtg.net
机房租用,北京机房租用,IDC机房托管, http://www.fwqtg.net
相关推荐: 《现代TypeScript高级教程》泛型和类型体操
点击在线阅读,体验更好 链接 现代JavaScript高级小册 链接 深入浅出Dart 链接 现代TypeScript高级小册 链接 泛型和类型体操 泛型和类型体操(Type Gymnastics)是 TypeScript 中高级类型系统的重要组成部分。它们提…