首页>代码>基于ListView开发android简易点菜系统实例>/Dddtext/src/com/jmi/Dddtext/MainActivity.java
package com.jmi.Dddtext;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Base64;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import org.json.JSONObject;
import java.util.concurrent.TimeUnit;

public class MainActivity extends Activity implements View.OnClickListener {
    private static final String TAG = "login";
    Button loginBtn = null;
    EditText useridEt = null;
    EditText passEt = null;
    TextView promptText = null;

    
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        loginBtn = (Button) findViewById(R.id.loginBtn);
        loginBtn.setOnClickListener(this);
        useridEt = (EditText) findViewById(R.id.userId);
        passEt = (EditText) findViewById(R.id.pass);
        promptText = (TextView) findViewById(R.id.promptText);
      
    }


    public void onClick(View v) {
        String userid = useridEt.getText().toString().trim();
        String pass = passEt.getText().toString().trim();
        if(userid.equals("")){
            promptText.setText(R.string.userIdError);
            return ;
        }
        if(pass.equals("")){
            promptText.setText(R.string.passError);
            return ;
        }


        if (userid.length()>=4 && pass.length()>=6) {
            Toast.makeText(this, R.string.loginSuccess, Toast.LENGTH_LONG).show();
            Intent intent = new Intent(MainActivity.this,Dian.class);
            startActivity(intent);
          
        } else {
            Toast.makeText(this, R.string.loginError, Toast.LENGTH_LONG).show();
        }
    }
}
最近下载更多
aliguaguagua  LV1 2023年10月12日
2074520745  LV1 2023年6月24日
yyyyyyzh  LV8 2023年6月11日
1602701143  LV1 2023年6月3日
我真不会打篮球  LV1 2023年6月3日
龙门客栈  LV9 2023年6月1日
chloe0417  LV1 2023年5月29日
倾城之恋1  LV5 2023年5月21日
202105013142  LV1 2023年1月31日
tong07  LV2 2022年12月20日
最近浏览更多
2636804923  LV6 6月19日
咩咩咩咩咩  LV2 6月17日
adminadminsqwqe  LV8 6月14日
AIWU1234  LV2 6月9日
1941549176  LV4 6月4日
lilitu  LV6 5月30日
今晚都别睡啦  LV9 5月29日
happySuperman  LV2 5月29日
pangzhihui  LV14 5月28日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友