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

E-commerce operations: e-commerce promotion strategies!

China's e-commerce market is strongly driven ...

How do brands follow hot topics? 3 methods

In the short video operation tutorials or practic...

Quantum of the Tomorrow: The most awesome photo ever

In the Southern Song Dynasty, during the Battle o...

Sexy photos will make you look silly

According to research data recently released by th...

Galanz sues Tmall for alleged abuse of market dominance

On November 5, 2019, Galanz released an announcem...

Master the underlying logic of private domain traffic!

Private domain traffic is not simply about adding...

Rather than shaking alone, it is better to shake together

From April 20 to 21, Alibaba Pioneer Channel Taob...

A complete set of APP message push mechanism!

How does the app implement a push mechanism? Whic...

Double 11H5 marketing promotion case analysis!

How to stand out on Double 11? Look down 1. Is yo...

How does APP push promote user retention, activation and growth?

Today we will use a common Internet method, “push...

Building a high-availability App framework for iOS from 0 to 1

I have been building an iOS framework for a new p...