package com.bw.g2dayzuoye.view; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import androidx.appcompat.app.AppCompatActivity; import com.bw.g2dayzuoye.MainActivity; import com.bw.g2dayzuoye.R; import com.hyphenate.EMCallBack; import com.hyphenate.chat.EMClient; public class MainActivitydl extends AppCompatActivity { private EditText dlZh; private EditText dlMm; private Button dlButton; private Button zcButton; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main_activitydl); initView(); zcButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(MainActivitydl.this, MainActivityzc.class); startActivity(intent); } }); dlButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { EMClient.getInstance().login(dlZh.getText().toString(), dlMm.getText().toString(), new EMCallBack() { // 登录成功回调 @Override public void onSuccess() { Intent intent = new Intent(MainActivitydl.this, MainActivity.class); startActivity(intent); } // 登录失败回调,包含错误信息 @Override public void onError(final int code, final String error) { } @Override public void onProgress(int i, String s) { } }); } }); } private void initView() { dlZh = findViewById(R.id.dl_zh); dlMm = findViewById(R.id.dl_mm); dlButton = findViewById(R.id.dl_button); zcButton = findViewById(R.id.zc_button); } }
mvvm登录注册
最新推荐文章于 2024-08-31 18:42:13 发布