How to realize the Registration and Login Program by android
This article mainly introduces the relevant knowledge of "how to realize the registration login program in android". The editor shows you the operation process through the actual case. The operation method is simple, fast and practical. I hope that this article "how to realize the registration login program in android" can help you solve the problem.
Registration page:
User_register.xml:
"
Process the Activity of the registration page:
Package com.example.foreveross.office; import java.io.IOException;import java.io.UnsupportedEncodingException;import java.util.ArrayList;import java.util.List; import org.apache.http.HttpEntity;import org.apache.http.HttpResponse;import org.apache.http.NameValuePair;import org.apache.http.ParseException;import org.apache.http.client.ClientProtocolException;import org.apache.http.client.HttpClient;import org.apache.http.client.entity.UrlEncodedFormEntity;import org.apache.http.client.methods.HttpPost Import org.apache.http.impl.client.DefaultHttpClient;import org.apache.http.message.BasicNameValuePair;import org.apache.http.util.EntityUtils; import com.example.wenandroid.R;import android.app.Activity;import android.os.Bundle;import android.os.StrictMode;import android.view.View;import android.view.View.OnClickListener;import android.view.View.OnFocusChangeListener;import android.widget.Button;import android.widget.EditText;import android.widget.Toast; public class UserRegister extends Activity {private EditText register_username;private EditText register_passwd Private EditText reregister_passwd;private Button register_submit; @ Override protected void onCreate (Bundle savedInstanceState) {/ / TODO Auto-generated method stub super.onCreate (savedInstanceState); StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder () .permitAll () .build (); StrictMode.setThreadPolicy (policy); setContentView (R.layout.user_register); register_username= (EditText) findViewById (R.id.register_username) Register_passwd= (EditText) findViewById (R.id.register_passwd); reregister_passwd= (EditText) findViewById (R.id.reregister_passwd); register_submit= (Button) findViewById (R.id.register_submit) Register_username.setOnFocusChangeListener (new OnFocusChangeListener () {@ Override public void onFocusChange (View v, boolean hasFocus) {/ / TODO Auto-generated method stub if (! hasFocus) {if (register_username.getText (). ToString (). Trim (). Length ()