Android high imitation taxi and other software project source code

Android high imitation taxi and other software project source code

Source code introduction

This project is modeled after Didi Taxi and other taxi-hailing software, which includes module functions such as module technology, multi-threading, Baidu map, feedback, user complaints, login and registration, online updates, etc.!
Source code running screenshot

Source code snippet:

  1. package com.rd.callcar;
  2.   
  3. import com.rd.callcar.Util.ExitApplication;
  4. import com.rd.callcar.json.getJson;
  5.   
  6. import android.app.Activity;
  7. import android.app.ProgressDialog;
  8. import android.content.Intent;
  9. import android.os.Bundle;
  10. import android.os.Handler;
  11. import android.os.Message;
  12. import android.view.View;
  13. import android.view.View.OnClickListener;
  14. import android.widget.Button;
  15. import android.widget.EditText;
  16. import android.widget.Toast;
  17.   
  18. public   class Login extends Activity {
  19.   
  20. private Button login, register;
  21. private EditText input_userid, input_pwd;
  22.   
  23. private ProgressDialog mpDialog;
  24.   
  25. final   int LOGINSUCCESS_MSG = 0 ;
  26. final   int LOGINFAIL_MSG = 1 ;
  27. App app = null ;
  28.   
  29. @Override  
  30. protected   void onCreate(Bundle savedInstanceState) {
  31. super .onCreate(savedInstanceState);
  32. setContentView(R.layout.login_layout);
  33. ExitApplication.getInstance().addActivity( this );
  34.   
  35. app = (App) getApplication();
  36.   
  37. // if (app.getLogin()) {  
  38. // StartMain();  
  39. // }  
  40.   
  41. // Initialize the loading dialog  
  42. mpDialog = new ProgressDialog( this );
  43. mpDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
  44. mpDialog.setTitle(R.string.loading_data);
  45. mpDialog.setIcon(android.R.drawable.ic_dialog_info);
  46. mpDialog.setMessage(getString(R.string.waiting));
  47. mpDialog.setIndeterminate( false );
  48. mpDialog.setCancelable( true );
  49.   
  50. login = (Button) findViewById(R.id.login);
  51. register = (Button) findViewById(R.id.register);
  52.   
  53. input_userid = (EditText) findViewById(R.id.input_userid);
  54. input_pwd = (EditText) findViewById(R.id.input_pwd);
  55.   
  56. login.setOnClickListener( new OnClick());
  57. register.setOnClickListener( new OnClick());
  58. }
  59.   
  60. class OnClick implements OnClickListener {
  61. @Override  
  62. public   void onClick(View v) {
  63. switch (v.getId()) {
  64. case R.id.login:
  65. LoginMeth();
  66. break ;
  67. case R.id.register:
  68. startActivityForResult( new Intent(Login. this , Register. class ),
  69. 1 );
  70. break ;
  71. }
  72. }
  73. }
  74.   
  75. @Override  
  76. protected   void onActivityResult( int requestCode, int resultCode, Intent data) {
  77. if (requestCode == 1 ) {
  78. if (resultCode == 1 ) {
  79. input_userid.setText(data.getStringExtra( "userid" ));
  80. }
  81. }
  82. super .onActivityResult(requestCode, resultCode, data);
  83. }
  84.   
  85. private   void LoginMeth() {
  86. final String userid = input_userid.getText().toString().trim();
  87. final String pwd = input_pwd.getText().toString().trim();
  88.   
  89. if (userid.equals( "" )) {
  90. ShowToast(R.string.noUserNameErr);
  91. return ;
  92. }
  93.   
  94. if (pwd.equals( "" )) {
  95. ShowToast(R.string.noPwdErr);
  96. return ;
  97. }
  98.   
  99. mpDialog.show();
  100. new Thread( new Runnable() {
  101.   
  102. @Override  
  103. public   void run() {
  104. try {
  105. boolean isLogin = true ; //getJson.Login(userid, pwd);  
  106. if (isLogin) {
  107. Message message = new Message();
  108. message.what = LOGINSUCCESS_MSG;
  109. message.obj = userid;
  110. mhandler.sendMessage(message);
  111. } else {
  112. Message message = new Message();
  113. message.what = LOGINFAIL_MSG;
  114. mhandler.sendMessage(message);
  115. }
  116. } catch (Exception e) {
  117. Message message = new Message();
  118. message.what = LOGINFAIL_MSG;
  119. mhandler.sendMessage(message);
  120. }
  121. }
  122. }).start();
  123. }
  124.   
  125. //Thread processing  
  126. private Handler mhandler = new Handler() {
  127. @Override  
  128. public   void handleMessage(Message msg) {
  129. mpDialog.dismiss();
  130. switch (msg.what) {
  131. case LOGINSUCCESS_MSG:
  132. app.SaveBegin( "userid" , "18013398197" );
  133. app.SaveLogin( true );
  134. StartMain();
  135. break ;
  136. case LOGINFAIL_MSG:
  137. ShowToast(R.string.loginFail);
  138. break ;
  139. }
  140. }
  141. };
  142.   
  143. private   void StartMain() {
  144. startActivity( new Intent(Login. this , StepOne. class ));
  145. Login. this .finish();
  146. }
  147.   
  148. private   void ShowToast( int res) {
  149. Toast.makeText( this , res, Toast.LENGTH_SHORT).show();
  150. }
  151. }

Source code link: http://download..com/data/1976535

<<:  Zhengyi Wireless: Using Internet thinking to build AppCan enterprise mobile platform

>>:  Google Talk, once a favorite among programmers, will be shut down next week

Recommend

The past, present and future of private domain traffic!

one The concept of private domain traffic should ...

Foreign media comment: Native Android is dead

Android M made its debut, and many developers wit...

Only 3 seconds! Explosive combustion! Many people carry it with them

Recently, a fire broke out in a residential area ...

Will the more coffee you drink, the sleepier you will feel?

What reactions occur after coffee enters the huma...

Teach you step by step how to disable mobile phone updates using adb

1. Introduction Hello, everyone. I’m Coder Zhou Q...

A new turning point for TV games in 2016 from LeTV's new policy

January 20, 2016, the Great Cold, the last solar ...

Microsoft's Chinese-style fight against piracy

"Microsoft just squeezed 60,000 yuan from ou...

Marketing strategy for Labor Day!

The 2021 May Day is approaching. As one of the mo...

B150 motherboard is coming, will it be the next most popular motherboard?

In August this year, Intel launched the sixth-gen...