今天进行了安卓的补货操作,通过获取前台的数据,对数据进行update,从而达到补货的目的。
package com.example.jjt; import androidx.appcompat.app.AppCompatActivity; import android.app.VoiceInteractor; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.CursorTreeAdapter; import android.widget.RelativeLayout; import android.widget.TextView; public class BhActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_bh); TextView name=findViewById(R.id.tv_name); TextView num=findViewById(R.id.tv_num); Button bh_bt=findViewById(R.id.bu_bt); bh_bt.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String num1=num.getText().toString(); String name1=name.getText().toString(); bh(name1,num1); } }); } private void bh(String start,String num) { // 必须新开线程才能连接MySQL数据库 new Thread(new Runnable() { @Override public void run() { try { // String num= Dbh.find(start); Dbh.up(start,num); } catch (Exception ex) { ex.printStackTrace(); } } }).start(); } }
代码行50.
标签:总结,4.6,String,每日,bh,num,import,android,void From: https://www.cnblogs.com/syhxx/p/17294220.html