源码简介
该项目是仿照滴滴打车等打车软件所做的项目,其中包括涉及模块技术,多线程,百度地图,意见反馈,用户投诉,登录注册,在线更新等模块功能!
源码运行截图
源码片段:
package com.rd.callcar;
import com.rd.callcar.Util.ExitApplication;
import com.rd.callcar.json.getJson;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
public class Login extends Activity {
private Button login, register;
private EditText input_userid, input_pwd;
private ProgressDialog mpDialog;
final int LOGINSUCCESS_MSG = 0;
final int LOGINFAIL_MSG = 1;
App app = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.login_layout);
ExitApplication.getInstance().addActivity(this);
app = (App) getApplication();
// if (app.getLogin()) {
// StartMain();
// }
// 初始化加载对话框
mpDialog = new ProgressDialog(this);
mpDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
mpDialog.setTitle(R.string.loading_data);
mpDialog.setIcon(android.R.drawable.ic_dialog_info);
mpDialog.setMessage(getString(R.string.waiting));
mpDialog.setIndeterminate(false);
mpDialog.setCancelable(true);
login = (Button) findViewById(R.id.login);
register = (Button) findViewById(R.id.register);
input_userid = (EditText) findViewById(R.id.input_userid);
input_pwd = (EditText) findViewById(R.id.input_pwd);
login.setOnClickListener(new OnClick());
register.setOnClickListener(new OnClick());
}
class OnClick implements OnClickListener {
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.login:
LoginMeth();
break;
case R.id.register:
startActivityForResult(new Intent(Login.this, Register.class),
1);
break;
}
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == 1) {
if (resultCode == 1) {
input_userid.setText(data.getStringExtra("userid"));
}
}
super.onActivityResult(requestCode, resultCode, data);
}
private void LoginMeth() {
final String userid = input_userid.getText().toString().trim();
final String pwd = input_pwd.getText().toString().trim();
if (userid.equals("")) {
ShowToast(R.string.noUserNameErr);
return;
}
if (pwd.equals("")) {
ShowToast(R.string.noPwdErr);
return;
}
mpDialog.show();
new Thread(new Runnable() {
@Override
public void run() {
try {
boolean isLogin = true;//getJson.Login(userid, pwd);
if (isLogin) {
Message message = new Message();
message.what = LOGINSUCCESS_MSG;
message.obj = userid;
mhandler.sendMessage(message);
} else {
Message message = new Message();
message.what = LOGINFAIL_MSG;
mhandler.sendMessage(message);
}
} catch (Exception e) {
Message message = new Message();
message.what = LOGINFAIL_MSG;
mhandler.sendMessage(message);
}
}
}).start();
}
// 线程处理
private Handler mhandler = new Handler() {
@Override
public void handleMessage(Message msg) {
mpDialog.dismiss();
switch (msg.what) {
case LOGINSUCCESS_MSG:
app.SaveBegin("userid", "18013398197");
app.SaveLogin(true);
StartMain();
break;
case LOGINFAIL_MSG:
ShowToast(R.string.loginFail);
break;
}
}
};
private void StartMain() {
startActivity(new Intent(Login.this, StepOne.class));
Login.this.finish();
}
private void ShowToast(int res) {
Toast.makeText(this, res, Toast.LENGTH_SHORT).show();
}
}
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.
- 16.
- 17.
- 18.
- 19.
- 20.
- 21.
- 22.
- 23.
- 24.
- 25.
- 26.
- 27.
- 28.
- 29.
- 30.
- 31.
- 32.
- 33.
- 34.
- 35.
- 36.
- 37.
- 38.
- 39.
- 40.
- 41.
- 42.
- 43.
- 44.
- 45.
- 46.
- 47.
- 48.
- 49.
- 50.
- 51.
- 52.
- 53.
- 54.
- 55.
- 56.
- 57.
- 58.
- 59.
- 60.
- 61.
- 62.
- 63.
- 64.
- 65.
- 66.
- 67.
- 68.
- 69.
- 70.
- 71.
- 72.
- 73.
- 74.
- 75.
- 76.
- 77.
- 78.
- 79.
- 80.
- 81.
- 82.
- 83.
- 84.
- 85.
- 86.
- 87.
- 88.
- 89.
- 90.
- 91.
- 92.
- 93.
- 94.
- 95.
- 96.
- 97.
- 98.
- 99.
- 100.
- 101.
- 102.
- 103.
- 104.
- 105.
- 106.
- 107.
- 108.
- 109.
- 110.
- 111.
- 112.
- 113.
- 114.
- 115.
- 116.
- 117.
- 118.
- 119.
- 120.
- 121.
- 122.
- 123.
- 124.
- 125.
- 126.
- 127.
- 128.
- 129.
- 130.
- 131.
- 132.
- 133.
- 134.
- 135.
- 136.
- 137.
- 138.
- 139.
- 140.
- 141.
- 142.
- 143.
- 144.
- 145.
- 146.
- 147.
- 148.
- 149.
- 150.
- 151.
源码链接:http://down.51cto.com/data/1976535