主頁 > 移動端開發 > Android登陸注冊

Android登陸注冊

2021-12-23 09:52:21 移動端開發

目錄

主頁.xml

主頁.java

登陸.xml

登陸.java

注冊.xml

注冊.java

個人資訊.xml

個人資訊.java

修改個人資訊.xml

修改個人資訊.java

修改密碼.xml

修改密碼.java

意見反饋.xml

意見反饋.java

訂單串列.xml

訂單串列.構造

訂單配接器

配接器里面的布局

訂單串列.java

工具類,GongJuLei.java


主頁.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="center_horizontal">

    <ImageView
        android:layout_marginTop="30dp"
        android:layout_width="150dp"
        android:layout_height="150dp"
        android:id="@+id/imageView"
        android:background="#F1F1F1"
        />
    <TextView
        android:layout_marginTop="5dp"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/textView"
        android:text="賬號名"
        />

    <androidx.cardview.widget.CardView
        android:layout_width="match_parent"
        app:cardCornerRadius="30dp"
        android:layout_marginTop="10dp"
        android:layout_marginLeft="30dp"
        android:layout_marginRight="30dp"
        app:cardBackgroundColor="#EFEFEF"
        android:layout_height="wrap_content">
        <TextView
            android:id="@+id/textView1"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:padding="10dp"
            android:text="個人資訊"
            android:gravity="center"
            />
    </androidx.cardview.widget.CardView>

    <androidx.cardview.widget.CardView
        android:layout_width="match_parent"
        app:cardCornerRadius="30dp"
        android:layout_marginTop="10dp"
        android:layout_marginLeft="30dp"
        android:layout_marginRight="30dp"
        app:cardBackgroundColor="#EFEFEF"
        android:layout_height="wrap_content">
        <TextView
            android:id="@+id/textView2"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:padding="10dp"
            android:text="訂單串列"
            android:gravity="center"
            />
    </androidx.cardview.widget.CardView>

    <androidx.cardview.widget.CardView
        android:layout_width="match_parent"
        app:cardCornerRadius="30dp"
        android:layout_marginTop="10dp"
        android:layout_marginLeft="30dp"
        android:layout_marginRight="30dp"
        app:cardBackgroundColor="#EFEFEF"
        android:layout_height="wrap_content">
        <TextView
            android:id="@+id/textView3"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:padding="10dp"
            android:text="修改密碼"
            android:gravity="center"
            />
    </androidx.cardview.widget.CardView>

    <androidx.cardview.widget.CardView
        android:layout_width="match_parent"
        app:cardCornerRadius="30dp"
        android:layout_marginTop="10dp"
        android:layout_marginLeft="30dp"
        android:layout_marginRight="30dp"
        app:cardBackgroundColor="#EFEFEF"
        android:layout_height="wrap_content">
        <TextView
            android:id="@+id/textView4"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:padding="10dp"
            android:text="意見反饋"
            android:gravity="center"
            />
    </androidx.cardview.widget.CardView>

    <androidx.cardview.widget.CardView
        android:layout_width="match_parent"
        app:cardCornerRadius="30dp"
        android:layout_marginTop="10dp"
        android:layout_marginLeft="30dp"
        android:layout_marginRight="30dp"
        app:cardBackgroundColor="#EFEFEF"
        android:layout_height="wrap_content">
        <TextView
            android:id="@+id/textView5"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:padding="10dp"
            android:text="退出"
            android:gravity="center"
            />
    </androidx.cardview.widget.CardView>



</LinearLayout>

主頁.java

import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.fragment.app.Fragment;

import com.bumptech.glide.Glide;
import com.example.smartcity.GongJuLei;
import com.example.smartcity.R;
import com.example.smartcity.gerenzhongxing.denglu.DengLu;
import com.example.smartcity.gerenzhongxing.gerenxingxi.DingDangLieBiao;
import com.example.smartcity.gerenzhongxing.gerenxingxi.FangKuiXingXi;
import com.example.smartcity.gerenzhongxing.gerenxingxi.GeRenXingXi;
import com.example.smartcity.gerenzhongxing.gerenxingxi.XiuGaiMiMa;
import com.example.smartcity.gerenzhongxing.gerenxingxi.XiuGaiXingXi;

import org.json.JSONException;
import org.json.JSONObject;

public class GeRenZhongXing extends Fragment implements View.OnClickListener {
    TextView textView1,textView,textView2,textView3,textView4,textView5;
    ImageView imageView;
    View view;
    String token="";
        @Override
        public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState) {
            view= LayoutInflater.from(getContext()).inflate(R.layout.xinwen,null,false);
            SharedPreferences sharedPreferences=getActivity().getSharedPreferences("name",0);
            token=sharedPreferences.getString("token","");
            textView=view.findViewById(R.id.textView);
            textView1=view.findViewById(R.id.textView1);
            textView2=view.findViewById(R.id.textView2);
            textView3=view.findViewById(R.id.textView3);
            textView4=view.findViewById(R.id.textView4);
            textView5=view.findViewById(R.id.textView5);
            imageView=view.findViewById(R.id.imageView);
            textView.setOnClickListener(this);
            imageView.setOnClickListener(this);
            textView1.setOnClickListener(this);
            textView2.setOnClickListener(this);
            textView3.setOnClickListener(this);
            textView4.setOnClickListener(this);
            textView5.setOnClickListener(this);
//            獲取資料
            huoqushuju();
            return view;
        }

    private void huoqushuju() {
            if (!token.equals("")){
                new Thread(new Runnable() {
                    @Override
                    public void run() {
                        try {
                            String data=new GongJuLei().getHuoquGeRenXingXi(token);
                            JSONObject jsonObject=new JSONObject(data);
                            JSONObject jsonObject1=jsonObject.getJSONObject("user");
                            getActivity().runOnUiThread(new Runnable() {
                                @Override
                                public void run() {
                                    try {
                                        textView.setText("賬號名:"+jsonObject1.getString("userName"));
                                        Glide.with(getContext()).load(url).into(imageView);
                                    } catch (JSONException e) {
                                        e.printStackTrace();
                                    }
                                }
                            });
                        }catch (Exception e){
                            e.printStackTrace();
                        }
                    }
                }).start();
            }
        }

    @Override
    public void onClick(View view) {
        switch (view.getId()){
            case R.id.imageView:
                if (token.equals("")){
                    startActivity(new Intent(getContext(), DengLu.class));
                }
                break;
            case R.id.textView:
                if (token.equals("")){
                    startActivity(new Intent(getContext(), DengLu.class));
                }
                break;
            case R.id.textView1:
                if (token.equals("")){
                    startActivity(new Intent(getContext(), DengLu.class));
                }else {
                    startActivity(new Intent(getContext(), GeRenXingXi.class));
                }
                break;
            case R.id.textView2:
                if (token.equals("")){
                    startActivity(new Intent(getContext(), DengLu.class));
                }else {
                    startActivity(new Intent(getContext(), DingDangLieBiao.class));
                }
                break;
            case R.id.textView3:
                if (token.equals("")){
                    startActivity(new Intent(getContext(), DengLu.class));
                }else {
                    startActivity(new Intent(getContext(), XiuGaiMiMa.class));
                }
                break;
            case R.id.textView4:
                if (token.equals("")){
                    startActivity(new Intent(getContext(), DengLu.class));
                }else {
                    startActivity(new Intent(getContext(), FangKuiXingXi.class));
                }
                break;
            case R.id.textView5:
                startActivity(new Intent(getContext(), DengLu.class));
                break;
        }
    }
}

登陸.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".gerenzhongxing.denglu.DengLu"
    android:orientation="vertical"
    android:gravity="right"
    >
    <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            >
            <TextView
                android:text="登陸"
                android:gravity="center"
                android:textSize="30dp"
                android:textStyle="bold"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"/>
        </RelativeLayout>
    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/editText1"
        android:hint="請輸入賬號"
        android:singleLine="true"
        />
    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/editText2"
        android:hint="請輸入密碼"
        android:singleLine="true"
        android:inputType="textPassword"
        />
    <TextView
        android:id="@+id/textView"
        android:padding="10dp"
        android:layout_marginRight="10dp"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:gravity="right"
        android:text="注冊賬號"
        />
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        >
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/button"
            android:text="登陸"
            />
    </LinearLayout>

</LinearLayout>

登陸.java

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

import com.example.smartcity.GongJuLei;
import com.example.smartcity.R;
import com.example.smartcity.daohanglang.DaoHangLang;

import org.json.JSONException;
import org.json.JSONObject;

public class DengLu extends AppCompatActivity {
    EditText editText1,editText2;
    Button button;
    TextView textView;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_deng_lu);
        editText1=findViewById(R.id.editText1);
        editText2=findViewById(R.id.editText2);
        button=findViewById(R.id.button);
        textView=findViewById(R.id.textView);
        textView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                startActivity(new Intent(DengLu.this,ZhuChe.class));
            }
        });
        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (!editText1.getText().equals("")&&!editText2.getText().equals("")){
//        獲取資料
                    new Thread(new Runnable() {
                        @Override
                        public void run() {
                            try {
                                String data=new GongJuLei().getDengLu(editText1.getText().toString().trim(),editText2.getText().toString().trim());
                                JSONObject jsonObject=new JSONObject(data);
                                runOnUiThread(new Runnable() {
                                    @Override
                                    public void run() {
                                        try {
                                            if (jsonObject.getString("msg").equals("操作成功")){
                                                SharedPreferences sharedPreferences=getSharedPreferences("name",0);
                                                SharedPreferences.Editor editor=sharedPreferences.edit();
                                                editor.putString("token",jsonObject.getString("token"));
                                                editor.commit();
                                                startActivity(new Intent(DengLu.this, DaoHangLang.class));
                                                finish();
                                            }
                                            Toast.makeText(DengLu.this,jsonObject.getString("msg") +"", Toast.LENGTH_SHORT).show();
                                        } catch (JSONException e) {
                                            e.printStackTrace();
                                        }
                                    }
                                });
                            }catch (Exception e){
                                e.printStackTrace();
                            }
                        }
                    }).start();
                }else {
                    Toast.makeText(DengLu.this, "資料未填寫完整", Toast.LENGTH_SHORT).show();
                }
            }
        });

    }
}

注冊.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".gerenzhongxing.denglu.DengLu"
    android:orientation="vertical"
    android:gravity="right"
    >
    <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            >
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/textView"
                android:text="回傳"
                android:padding="10dp"
                />
            <TextView
                android:text="注冊"
                android:gravity="center"
                android:textSize="30dp"
                android:textStyle="bold"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"/>
        </RelativeLayout>
    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/editText1"
        android:hint="請輸入賬號名"
        android:singleLine="true"
        />
    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/editText2"
        android:hint="請輸入手機號"
        android:singleLine="true"
        android:inputType="textPassword"
        />
    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/editText3"
        android:hint="請輸入密碼"
        android:singleLine="true"
        android:inputType="textPassword"
        />
    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/editText4"
        android:hint="請重復密碼"
        android:singleLine="true"
        android:inputType="textPassword"
        />
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        >
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/button"
            android:text="注冊"
            />
    </LinearLayout>

</LinearLayout>

注冊.java

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;
import android.widget.Toast;

import com.example.smartcity.GongJuLei;
import com.example.smartcity.R;

import org.json.JSONException;
import org.json.JSONObject;

public class ZhuChe extends AppCompatActivity {
    TextView textView;
    Button button;
    EditText editText1,editText2,editText3,editText4;
    String xinbie="";
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_zhu_che);
        textView=findViewById(R.id.textView);
        button=findViewById(R.id.button);
        editText1=findViewById(R.id.editText1);
        editText2=findViewById(R.id.editText2);
        editText3=findViewById(R.id.editText3);
        editText4=findViewById(R.id.editText4);

        textView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });

        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                new Thread(new Runnable() {
                    @Override
                    public void run() {
                        try {
                            String data=new GongJuLei().getZhuChe(editText1.getText().toString(),editText2.getText().toString(),editText3.getText().toString(),xinbie);
                            JSONObject jsonObject=new JSONObject(data);
                            runOnUiThread(new Runnable() {
                                @Override
                                public void run() {
                                    try {
                                        if (jsonObject.getString("msg").equals("操作成功")){
                                            finish();
                                        }
                                        Toast.makeText(ZhuChe.this, jsonObject.getString("msg")+"", Toast.LENGTH_SHORT).show();
                                    } catch (JSONException e) {
                                        e.printStackTrace();
                                    }
                                }
                            });
                        }catch (Exception e){
                            e.printStackTrace();
                        }
                    }
                }).start();
            }
        });

    }
}

個人資訊.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:gravity="center_horizontal"
    tools:context=".gerenzhongxing.gerenxingxi.GeRenXingXi">
    <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            >
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/textView"
                android:text="回傳"
                android:padding="10dp"
                />
            <TextView
                android:text="個人資訊"
                android:gravity="center"
                android:textSize="30dp"
                android:textStyle="bold"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"/>
        </RelativeLayout>

    <ImageView
        android:background="#F5F5F5"
        android:layout_marginTop="20dp"
        android:layout_width="150dp"
        android:layout_height="150dp"
        android:id="@+id/imageView"
        />
    <LinearLayout
        android:layout_marginTop="10dp"
        android:layout_width="match_parent"
        android:layout_marginLeft="30dp"
        android:layout_marginRight="30dp"
        android:background="#F2F2F2"
        android:padding="10dp"
        android:layout_height="wrap_content">
        <TextView
            android:layout_weight="1"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:text="賬號名:"
            />
        <TextView
            android:id="@+id/textView1"
            android:layout_weight="2"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:text="賬號名:"
            />
    </LinearLayout>
    <LinearLayout
        android:layout_marginTop="10dp"
        android:layout_width="match_parent"
        android:layout_marginLeft="30dp"
        android:layout_marginRight="30dp"
        android:background="#F2F2F2"
        android:padding="10dp"
        android:layout_height="wrap_content">
        <TextView
            android:layout_weight="1"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:text="昵稱:"
            />
        <TextView
            android:id="@+id/textView2"
            android:layout_weight="2"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:text="賬號名:"
            />
    </LinearLayout>
    <LinearLayout
        android:layout_marginTop="10dp"
        android:layout_width="match_parent"
        android:layout_marginLeft="30dp"
        android:layout_marginRight="30dp"
        android:background="#F2F2F2"
        android:padding="10dp"
        android:layout_height="wrap_content">
        <TextView
            android:layout_weight="1"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:text="郵箱號:"
            />
        <TextView
            android:id="@+id/textView3"
            android:layout_weight="2"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:text="賬號名:"
            />
    </LinearLayout>
    <LinearLayout
        android:layout_marginTop="10dp"
        android:layout_width="match_parent"
        android:layout_marginLeft="30dp"
        android:layout_marginRight="30dp"
        android:background="#F2F2F2"
        android:padding="10dp"
        android:layout_height="wrap_content">
        <TextView
            android:layout_weight="1"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:text="電話號碼:"
            />
        <TextView
            android:id="@+id/textView4"
            android:layout_weight="2"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:text="賬號名:"
            />
    </LinearLayout>
    <LinearLayout
        android:layout_marginTop="10dp"
        android:layout_width="match_parent"
        android:layout_marginLeft="30dp"
        android:layout_marginRight="30dp"
        android:background="#F2F2F2"
        android:padding="10dp"
        android:layout_height="wrap_content">
        <TextView
            android:layout_weight="1"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:text="性別:"
            />
        <TextView
            android:id="@+id/textView5"
            android:layout_weight="2"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:text="賬號名:"
            />
    </LinearLayout>
    <LinearLayout
        android:layout_marginTop="10dp"
        android:layout_width="match_parent"
        android:layout_marginLeft="30dp"
        android:layout_marginRight="30dp"
        android:background="#F2F2F2"
        android:padding="10dp"
        android:layout_height="wrap_content">
        <TextView
            android:layout_weight="1"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:text="身份證號碼:"
            />
        <TextView
            android:id="@+id/textView6"
            android:layout_weight="2"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:text="賬號名:"
            />
    </LinearLayout>
    <LinearLayout
        android:layout_marginTop="10dp"
        android:layout_width="match_parent"
        android:layout_marginLeft="30dp"
        android:layout_marginRight="30dp"
        android:background="#F2F2F2"
        android:padding="10dp"
        android:layout_height="wrap_content">
        <TextView
            android:layout_weight="1"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:text="余額:"
            />
        <TextView
            android:id="@+id/textView7"
            android:layout_weight="2"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:text="賬號名:"
            />
    </LinearLayout>
    <LinearLayout
        android:layout_marginTop="10dp"
        android:layout_width="match_parent"
        android:layout_marginLeft="30dp"
        android:layout_marginRight="30dp"
        android:background="#F2F2F2"
        android:padding="10dp"
        android:layout_height="wrap_content">
        <TextView
            android:layout_weight="1"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:text="積分:"
            />
        <TextView
            android:id="@+id/textView8"
            android:layout_weight="2"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:text="賬號名:"
            />
    </LinearLayout>
    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="修改"
        android:id="@+id/button"
        />

</LinearLayout>

個人資訊.java

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.example.smartcity.GongJuLei;
import com.example.smartcity.R;

import org.json.JSONException;
import org.json.JSONObject;

public class GeRenXingXi extends AppCompatActivity {
    TextView textView,textView1,textView2,textView3,textView4,
            textView5,textView6,textView7,textView8;
    ImageView imageView;
    String token="";
    Button button;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_ge_ren_xing_xi);
        token=getSharedPreferences("name",0).getString("token","");
        textView=findViewById(R.id.textView);
        textView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });
        imageView=findViewById(R.id.imageView);
        textView1=findViewById(R.id.textView1);
        textView2=findViewById(R.id.textView2);
        textView3=findViewById(R.id.textView3);
        textView4=findViewById(R.id.textView4);
        textView5=findViewById(R.id.textView5);
        textView6=findViewById(R.id.textView6);
        textView7=findViewById(R.id.textView7);
        textView8=findViewById(R.id.textView8);
        button=findViewById(R.id.button)    ;
        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                startActivity(new Intent(GeRenXingXi.this,XiuGaiXingXi.class));
            }
        });
//        獲取資料
        new Thread(new Runnable() {
            @Override
            public void run() {
                try {
                    String data=new GongJuLei().getHuoquGeRenXingXi(token);
                    JSONObject jsonObject=new JSONObject(data);
                    JSONObject jsonObject1=jsonObject.getJSONObject("user");
                    runOnUiThread(new Runnable() {
                        @Override
                        public void run() {
                            try {
                                Glide.with(GeRenXingXi.this).load(url).into(imageView);
                                textView1.setText(jsonObject1.getString("userName"));
                                textView2.setText(jsonObject1.getString("nickName"));
                                textView3.setText(jsonObject1.getString("email"));
                                textView4.setText(jsonObject1.getString("phonenumber"));
                                if (jsonObject1.getString("sex").equals("0")){
                                    textView5.setText("男");
                                }else {
                                    textView5.setText("女");
                                }
                                StringBuffer stringBuffer=new StringBuffer(jsonObject1.getString("idCard"));
                                stringBuffer.replace(2,14,"***");
                                textView6.setText(stringBuffer);
                                textView7.setText(jsonObject1.getString("balance"));
                                textView8.setText(jsonObject1.getString("score"));
                            } catch (JSONException e) {
                                e.printStackTrace();
                            }
                        }
                    });
                }catch (Exception e){
                    e.printStackTrace();
                }
            }
        }).start();
    }
}

修改個人資訊.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:gravity="center_horizontal"
    tools:context=".gerenzhongxing.gerenxingxi.XiuGaiXingXi">
    <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            >
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/textView"
                android:text="回傳"
                android:padding="10dp"
                />
            <TextView
                android:text="修改資訊"
                android:gravity="center"
                android:textSize="30dp"
                android:textStyle="bold"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"/>
        </RelativeLayout>
    <EditText
        android:id="@+id/editText1"
        android:hint="請輸入昵稱"
        android:singleLine="true"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"/>
    <EditText
        android:id="@+id/editText2"
        android:hint="請輸入電話號碼"
        android:singleLine="true"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"/>
    <EditText
        android:id="@+id/editText3"
        android:hint="請輸入身份證號碼"
        android:singleLine="true"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"/>
    <RadioGroup
        android:layout_width="match_parent"
        android:orientation="horizontal"
        android:gravity="center_horizontal"
        android:id="@+id/radioGroup"
        android:layout_height="wrap_content">
        <RadioButton
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/radioButton1"
            android:text="男"
            />
        <RadioButton
            android:layout_marginLeft="10dp"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/radioButton2"
            android:text="女"
            />

    </RadioGroup>
    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/button"
        android:text="修改"
        />
</LinearLayout>

修改個人資訊.java

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RadioGroup;
import android.widget.TextView;
import android.widget.Toast;

import com.example.smartcity.GongJuLei;
import com.example.smartcity.R;

import org.json.JSONException;
import org.json.JSONObject;

public class XiuGaiXingXi extends AppCompatActivity {
    TextView textView;
    Button button;
    EditText editText1,editText2,editText3;
    RadioGroup radioGroup;
    String token="",xinbie="";
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_xiu_gai_xing_xi);
        textView=findViewById(R.id.textView);
        button=findViewById(R.id.button);
        editText1=findViewById(R.id.editText1);
        editText2=findViewById(R.id.editText2);
        editText3=findViewById(R.id.editText3);
        radioGroup=findViewById(R.id.radioGroup);
        radioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(RadioGroup radioGroup, int i) {
                switch (i) {
                    case R.id.radioButton1:
                        xinbie="0";
                        break;
                    case R.id.radioButton2:
                        xinbie="1";
                        break;
                }
            }
        });
        token=getSharedPreferences("name",0).getString("token","");
        textView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });
        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (!editText1.getText().toString().trim().equals("")&&
                    !editText2.getText().toString().trim().equals("")&&
                    !editText3.getText().toString().trim().equals("")&&
                        !xinbie.equals("")
                ){
                    if (editText2.length()==11){
                        if (editText3.length()==18){
                            new Thread(new Runnable() {
                                @Override
                                public void run() {
                                    try {
                                        String data=new GongJuLei().getXiuGaiXingXi(token,
                                                editText1.getText().toString().trim(),
                                                editText2.getText().toString().trim(),
                                                editText3.getText().toString().trim(),xinbie);
                                        JSONObject jsonObject=new JSONObject(data);
                                        runOnUiThread(new Runnable() {
                                            @Override
                                            public void run() {
                                                try {
                                                    if (jsonObject.getString("msg").equals("操作成功")){
                                                        finish();
                                                    }
                                                    Toast.makeText(XiuGaiXingXi.this, jsonObject.getString("msg")+"", Toast.LENGTH_SHORT).show();
                                                } catch (JSONException e) {
                                                    e.printStackTrace();
                                                }
                                            }
                                        });
                                    }catch (Exception e){
                                        e.printStackTrace();
                                    }
                                }
                            }).start();
                        }else {
                            Toast.makeText(XiuGaiXingXi.this, "請輸入18位身份證號碼", Toast.LENGTH_SHORT).show();
                        }
                    }else {
                        Toast.makeText(XiuGaiXingXi.this, "請輸入11位電話號碼", Toast.LENGTH_SHORT).show();
                    }
                }else {
                    Toast.makeText(XiuGaiXingXi.this, "請輸入完整", Toast.LENGTH_SHORT).show();
                }
            }
        });
    }
}

修改密碼.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:gravity="center_horizontal"
    tools:context=".gerenzhongxing.gerenxingxi.XiuGaiMiMa">
    <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            >
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/textView"
                android:text="回傳"
                android:padding="10dp"
                />
            <TextView
                android:text="修改密碼"
                android:gravity="center"
                android:textSize="30dp"
                android:textStyle="bold"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"/>
        </RelativeLayout>

    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/editText1"
        android:hint="請輸入舊密碼"
        />
    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/editText2"
        android:hint="請輸入新密碼"
        />
    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/editText3"
        android:hint="請重復密碼"
        />
    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/button"
        android:text="修改"
        />

</LinearLayout>

修改密碼.java

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

import com.example.smartcity.GongJuLei;
import com.example.smartcity.R;

import org.json.JSONException;
import org.json.JSONObject;

public class XiuGaiMiMa extends AppCompatActivity {
    TextView textView;
    EditText editText1,editText2,editText3;
    Button button;
    String token="";
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_xiu_gai_mi_ma);
        token=getSharedPreferences("name",0).getString("token","");
        textView=findViewById(R.id.textView);
        editText1=findViewById(R.id.editText1);
        editText2=findViewById(R.id.editText2);
        editText3=findViewById(R.id.editText3);
        button=findViewById(R.id.button);
        textView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });
        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (editText2.getText().toString().trim().equals(editText3.getText().toString().trim())){
                    new Thread(new Runnable() {
                        @Override
                        public void run() {
                            try {
                                String data=new GongJuLei().getXiuGaiMiMa(token,editText1.getText().toString().trim(),editText2.getText().toString().trim());
                                JSONObject jsonObject=new JSONObject(data);
                                runOnUiThread(new Runnable() {
                                    @Override
                                    public void run() {
                                        try {
                                            if (!editText1.getText().toString().trim().equals("")&&!editText2.getText().toString().trim().equals("")){
                                                if (jsonObject.getString("msg").equals("操作成功")){
                                                    finish();
                                                }
                                                Toast.makeText(XiuGaiMiMa.this, jsonObject.getString("msg")+"", Toast.LENGTH_SHORT).show();
                                            }else {
                                                Toast.makeText(XiuGaiMiMa.this, "未填寫完整", Toast.LENGTH_SHORT).show();
                                            }
                                        } catch (JSONException e) {
                                            e.printStackTrace();
                                        }
                                    }
                                });
                            }catch (Exception e){
                                e.printStackTrace();
                            }
                        }
                    }).start();
                }else {
                    Toast.makeText(XiuGaiMiMa.this, "新密碼不一致", Toast.LENGTH_SHORT).show();
                }
            }
        });
    }
}

意見反饋.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:gravity="center_horizontal"
    tools:context=".gerenzhongxing.gerenxingxi.FangKuiXingXi">
    <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            >
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/textView"
                android:text="回傳"
                android:padding="10dp"
                />
            <TextView
                android:text="反饋資訊"
                android:gravity="center"
                android:textSize="30dp"
                android:textStyle="bold"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"/>
        </RelativeLayout>
    <androidx.cardview.widget.CardView
        android:layout_width="match_parent"
        android:layout_height="300dp"
        android:layout_margin="20dp"
        android:background="#fff"
        app:cardCornerRadius="30dp"
        app:cardBackgroundColor="#EEEEEE"
        >
        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent">
            <EditText
                android:background="@null"
                android:id="@+id/editText"
                android:hint="請輸入反饋資訊"
                android:gravity="left"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_margin="20dp"
                android:maxLength="150"
                />
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="還剩150個字可以輸入"
                android:id="@+id/textView1"
                android:layout_alignParentRight="true"
                android:layout_alignParentBottom="true"
                android:layout_margin="30dp"
                />
        </RelativeLayout>

    </androidx.cardview.widget.CardView>
    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/button"
        android:text="提交"
        />
</LinearLayout>

意見反饋.java

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.KeyEvent;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

import com.example.smartcity.GongJuLei;
import com.example.smartcity.R;

import org.json.JSONException;
import org.json.JSONObject;

public class FangKuiXingXi extends AppCompatActivity {
TextView textView,textView1;
EditText editText;
Button button;
String token="";
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_fang_kui_xing_xi);
        token=getSharedPreferences("name",0).getString("token","");
        textView=findViewById(R.id.textView);
        textView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });
        textView1=findViewById(R.id.textView1);
        editText=findViewById(R.id.editText);
        button=findViewById(R.id.button );
        editText.addTextChangedListener(new TextWatcher() {
            @Override
            public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {

            }

            @Override
            public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {

            }

            @Override
            public void afterTextChanged(Editable editable) {
                textView1.setText("還剩"+(150-editText.length())+"個字可以輸入");
                if (editText.length()==150){
                    Toast.makeText(FangKuiXingXi.this, "不可以輸入了", Toast.LENGTH_SHORT).show();
                }
            }
        });
        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (!editText.getText().toString().trim().equals("")){
                    new Thread(new Runnable() {
                        @Override
                        public void run() {
                            try {
                                String data=new GongJuLei().getFangKuiXingXi(token,editText.getText().toString().trim());
                                JSONObject jsonObject=new JSONObject(data   );
                                runOnUiThread(new Runnable() {
                                    @Override
                                    public void run() {
                                        try {
                                            if (jsonObject.getString("msg").equals("操作成功")){
                                                finish();
                                            }
                                            Toast.makeText(FangKuiXingXi.this, jsonObject.getString("msg")+"", Toast.LENGTH_SHORT).show();
                                        } catch (JSONException e) {
                                            e.printStackTrace();
                                        }
                                    }
                                });
                            }catch (Exception e){
                                e.printStackTrace();
                            }
                        }
                    }).start();
                }else {
                    Toast.makeText(FangKuiXingXi.this, "未填寫", Toast.LENGTH_SHORT).show();
                }
            }
        });
    }
}

訂單串列.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context=".gerenzhongxing.gerenxingxi.DingDangLieBiao">
<RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        >
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/textView"
            android:text="回傳"
            android:padding="10dp"
            />
        <TextView
            android:text="訂單串列"
            android:gravity="center"
            android:textSize="30dp"
            android:textStyle="bold"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"/>
    </RelativeLayout>
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        <TextView
            android:id="@+id/textView1"
            android:layout_weight="1"
            android:gravity="center"
            android:layout_width="0dp"
            android:text="訂單編號"
            android:layout_height="wrap_content"/>
        <TextView
            android:id="@+id/textView2"
            android:layout_weight="1"
            android:gravity="center"
            android:layout_width="0dp"
            android:text="訂單型別"
            android:layout_height="wrap_content"/>
        <TextView
            android:text="電影院名"
            android:id="@+id/textView3"
            android:layout_weight="1"
            android:gravity="center"
            android:layout_width="0dp"
            android:layout_height="wrap_content"/>
    </LinearLayout>
    <androidx.recyclerview.widget.RecyclerView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/recyclerView"
        />
</LinearLayout>

訂單串列.構造

public class DingDangGozhao {
    String id,bianhao,leixing,time;

    public DingDangGozhao(String id, String bianhao, String leixing, String time) {
        this.id = id;
        this.bianhao = bianhao;
        this.leixing = leixing;
        this.time = time;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getBianhao() {
        return bianhao;
    }

    public void setBianhao(String bianhao) {
        this.bianhao = bianhao;
    }

    public String getLeixing() {
        return leixing;
    }

    public void setLeixing(String leixing) {
        this.leixing = leixing;
    }

    public String getTime() {
        return time;
    }

    public void setTime(String time) {
        this.time = time;
    }
}

訂單配接器

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.text.Layout;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import com.example.smartcity.R;

import java.util.List;

public class DingDangAdapter extends RecyclerView.Adapter<DingDangAdapter.ViewHolder> {
    List<DingDangGozhao> list;
    Context context;

    public DingDangAdapter(List<DingDangGozhao> list, Context context) {
        this.list = list;
        this.context = context;
    }

    @Override
    public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        return new ViewHolder(LayoutInflater.from(context).inflate(R.layout.dingdan,parent,false));
    }

    @Override
    public void onBindViewHolder(DingDangAdapter.ViewHolder holder, int position) {
        holder.textView1.setText(list.get(position).getBianhao());
        holder.textView2.setText(list.get(position).getLeixing());
        holder.textView3.setText(list.get(position).getTime());
        holder.itemView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent=new Intent(context,DingDangXiangQing.class);
                intent.putExtra("id",list.get(position).getId());
                ((Activity)context).startActivity(intent);
            }
        });
    }

    @Override
    public int getItemCount() {
        return list.size();
    }

    public class ViewHolder extends RecyclerView.ViewHolder {
        TextView textView1,textView2,textView3;
        public ViewHolder(View itemView) {
            super(itemView);
            textView1=itemView.findViewById(R.id.textView1);
            textView2=itemView.findViewById(R.id.textView2);
            textView3=itemView.findViewById(R.id.textView3);
        }
    }
}

配接器里面的布局

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="10dp"
    >
    <TextView
        android:id="@+id/textView1"
        android:layout_weight="1"
        android:gravity="center"
        android:layout_width="0dp"
        android:layout_height="wrap_content"/>
    <TextView
        android:id="@+id/textView2"
        android:layout_weight="1"
        android:gravity="center"
        android:layout_width="0dp"
        android:layout_height="wrap_content"/>
    <TextView
        android:id="@+id/textView3"
        android:layout_weight="1"
        android:gravity="center"
        android:layout_width="0dp"
        android:layout_height="wrap_content"/>

</LinearLayout>

訂單串列.java

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import com.example.smartcity.GongJuLei;
import com.example.smartcity.R;

import org.json.JSONArray;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.List;

public class DingDangLieBiao extends AppCompatActivity {
    TextView textView;
    RecyclerView recyclerView;
    List<DingDangGozhao> list=new ArrayList<>();
    String token="";
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_ding_dang_lie_biao);
        token=getSharedPreferences("name",0).getString("token","");
        textView=findViewById(R.id.textView);
        textView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });
        recyclerView=findViewById(R.id.recyclerView);
        LinearLayoutManager linearLayoutManager=new LinearLayoutManager(this);
        recyclerView.setLayoutManager( linearLayoutManager);
        new Thread(new Runnable() {
            @Override
            public void run() {
                try {
                    String data=new GongJuLei().getDingDang(token);
                    JSONObject jsonObject=new JSONObject(data);
                    JSONArray jsonArray=jsonObject.getJSONArray("rows");
                    for (int i = 0; i < jsonArray.length(); i++) {
                        JSONObject jsonObject1=jsonArray.getJSONObject(i);
                        DingDangGozhao gozhao=new DingDangGozhao(jsonObject1.getInt("id")+"",
                                jsonObject1.getString("orderNo"),
                                jsonObject1.getString("orderType"),
                                jsonObject1.getString("name"));
                        list.add(gozhao);
                    }
                    runOnUiThread(new Runnable() {
                        @Override
                        public void run() {
                            DingDangAdapter adapter=new DingDangAdapter(list,DingDangLieBiao.this);
                            recyclerView.setAdapter(adapter);
                        }
                    });
                }catch (Exception e){
                    e.printStackTrace();
                }
            }
        }).start();
    }
}

工具類,GongJuLei.java

import android.text.Editable;

import java.io.IOException;

import okhttp3.MediaType;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;

public class GongJuLei {
public String getDengLu(String username, String password) throws IOException {
        OkHttpClient client = new OkHttpClient().newBuilder()
                .build();
        MediaType mediaType = MediaType.parse("application/json");
        RequestBody body = RequestBody.create(mediaType, "{\r\n\"username\":\""+username+"\",\r\n\"password\":\""+password+"\"\r\n}");
        Request request = new Request.Builder()
                .url(url)
                .method("POST", body)
                .addHeader("Content-Type", "application/json")
                .build();
        Response response = client.newCall(request).execute();
        return response.body().string();
    }



    public String getZhuChe(String username,String phone, String password,String xinbie) throws IOException {
        OkHttpClient client = new OkHttpClient().newBuilder()
                .build();
        MediaType mediaType = MediaType.parse("application/json");
        RequestBody body = RequestBody.create(mediaType, "{\r\n\"userName\": \""+username+"\",\r\n\"password\": \""+password+"\",\r\n\"phonenumber\": \""+phone+"\",\r\n\"sex\": \""+xinbie+"\"\r\n}");
        Request request = new Request.Builder()
                .url(url)
                .method("POST", body)
                .addHeader("Content-Type", "application/json")
                .build();
        Response response = client.newCall(request).execute();
        return response.body().string();
    }


    public String getHuoquGeRenXingXi(String token) throws IOException {
        OkHttpClient client = new OkHttpClient().newBuilder()
                .build();
        Request request = new Request.Builder()
                .url(url)
                .method("GET", null)
                .addHeader("Authorization", token)
                .build();
        Response response = client.newCall(request).execute();
        return response.body().string();
    }


    public String getXiuGaiXingXi(String token,String name,String phone,String shengfengzheng,String xinbie) throws IOException {
        OkHttpClient client = new OkHttpClient().newBuilder()
                .build();
        MediaType mediaType = MediaType.parse("application/json");
        RequestBody body = RequestBody.create(mediaType, "{\r\n\"idCard\": \""+shengfengzheng+"\",\r\n\"nickName\": \""+name+"\",\r\n\"phonenumber\": \""+phone+"\",\r\n\"sex\": \""+xinbie+"\"\r\n}");
        Request request = new Request.Builder()
                .url(url)
                .method("PUT", body)
                .addHeader("Authorization", token)
                .addHeader("Content-Type", "application/json")
                .build();
        Response response = client.newCall(request).execute();
        return response.body().string();
    }



    public String getXiuGaiMiMa(String token,String jiumima,String xinmima) throws IOException {
        OkHttpClient client = new OkHttpClient().newBuilder()
                .build();
        MediaType mediaType = MediaType.parse("application/json");
        RequestBody body = RequestBody.create(mediaType, "{\r\n\"newPassword\": \""+xinmima+"\",\r\n\"oldPassword\": \""+jiumima+"\"\r\n}");
        Request request = new Request.Builder()
                .url(url)
                .method("PUT", body)
                .addHeader("Authorization", token)
                .addHeader("Content-Type", "application/json")
                .build();
        Response response = client.newCall(request).execute();
        return response.body().string();
    }

    public String getFangKuiXingXi(String token,String content) throws IOException {
        OkHttpClient client = new OkHttpClient().newBuilder()
                .build();
        MediaType mediaType = MediaType.parse("application/json");
        RequestBody body = RequestBody.create(mediaType, "{\r\n\"content\": \""+content+"\"\r\n}");
        Request request = new Request.Builder()
                .url(url)
                .method("POST", body)
                .addHeader("Authorization", token)
                .addHeader("Content-Type", "application/json")
                .build();
        Response response = client.newCall(request).execute();
        return response.body().string();
    }


    public String getDingDang(String token) throws IOException {
        OkHttpClient client = new OkHttpClient().newBuilder()
                .build();
        Request request = new Request.Builder()
                .url(url)
                .method("GET", null)
                .addHeader("Authorization", token)
                .build();
        Response response = client.newCall(request).execute();
        return response.body().string();
    }

}

轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/390657.html

標籤:其他

上一篇:swift tabbar頁面切換時重繪的方法

下一篇:RecyclerView的一些優化點

標籤雲
其他(157675) Python(38076) JavaScript(25376) Java(17977) C(15215) 區塊鏈(8255) C#(7972) AI(7469) 爪哇(7425) MySQL(7132) html(6777) 基礎類(6313) sql(6102) 熊猫(6058) PHP(5869) 数组(5741) R(5409) Linux(5327) 反应(5209) 腳本語言(PerlPython)(5129) 非技術區(4971) Android(4554) 数据框(4311) css(4259) 节点.js(4032) C語言(3288) json(3245) 列表(3129) 扑(3119) C++語言(3117) 安卓(2998) 打字稿(2995) VBA(2789) Java相關(2746) 疑難問題(2699) 细绳(2522) 單片機工控(2479) iOS(2429) ASP.NET(2402) MongoDB(2323) 麻木的(2285) 正则表达式(2254) 字典(2211) 循环(2198) 迅速(2185) 擅长(2169) 镖(2155) 功能(1967) .NET技术(1958) Web開發(1951) python-3.x(1918) HtmlCss(1915) 弹簧靴(1913) C++(1909) xml(1889) PostgreSQL(1872) .NETCore(1853) 谷歌表格(1846) Unity3D(1843) for循环(1842)

熱門瀏覽
  • 【從零開始擼一個App】Dagger2

    Dagger2是一個IOC框架,一般用于Android平臺,第一次接觸的朋友,一定會被搞得暈頭轉向。它延續了Java平臺Spring框架代碼碎片化,注解滿天飛的傳統。嘗試將各處代碼片段串聯起來,理清思緒,真不是件容易的事。更不用說還有各版本細微的差別。 與Spring不同的是,Spring是通過反射 ......

    uj5u.com 2020-09-10 06:57:59 more
  • Flutter Weekly Issue 66

    新聞 Flutter 季度調研結果分享 教程 Flutter+FaaS一體化任務編排的思考與設計 詳解Dart中如何通過注解生成代碼 GitHub 用對了嗎?Flutter 團隊分享如何管理大型開源專案 插件 flutter-bubble-tab-indicator A Flutter librar ......

    uj5u.com 2020-09-10 06:58:52 more
  • Proguard 常用規則

    介紹 Proguard 入口,如何查看輸出,如何使用 keep 設定入口以及使用實體,如何配置壓縮,混淆,校驗等規則。

    ......

    uj5u.com 2020-09-10 06:59:00 more
  • Android 開發技術周報 Issue#292

    新聞 Android即將獲得類AirDrop功能:可向附近設備快速分享檔案 谷歌為安卓檔案管理應用引入可安全隱藏資料的Safe Folder功能 Android TV新主界面將顯示電影、電視節目和應用推薦內容 泄露的Android檔案暗示了傳說中的谷歌Pixel 5a與折疊屏新機 谷歌發布Andro ......

    uj5u.com 2020-09-10 07:00:37 more
  • AutoFitTextureView Error inflating class

    報錯: Binary XML file line #0: Binary XML file line #0: Error inflating class xxx.AutoFitTextureView 解決: <com.example.testy2.AutoFitTextureView android: ......

    uj5u.com 2020-09-10 07:00:41 more
  • 根據Uri,Cursor沒有獲取到對應的屬性

    Android: 背景:呼叫攝像頭,拍攝視頻,指定保存的地址,但是回傳的Cursor檔案,只有名稱和大小的屬性,沒有其他諸如時長,連ID屬性都沒有 使用 cursor.getInt(cursor.getColumnIndexOrThrow(MediaStore.Video.Media.DURATIO ......

    uj5u.com 2020-09-10 07:00:44 more
  • Android連載29-持久化技術

    一、持久化技術 我們平時所使用的APP產生的資料,在記憶體中都是瞬時的,會隨著斷電、關機等丟失資料,因此android系統采用了持久化技術,用于存盤這些“瞬時”資料 持久化技術包括:檔案存盤、SharedPreference存盤以及資料庫存盤,還有更復雜的SD卡記憶體儲。 二、檔案存盤 最基本存盤方式, ......

    uj5u.com 2020-09-10 07:00:47 more
  • Android Camera2Video整合到自己專案里

    背景: Android專案里呼叫攝像頭拍攝視頻,原本使用的 MediaStore.ACTION_VIDEO_CAPTURE, 后來因專案需要,改成了camera2 1.Camera2Video 官方demo有點問題,下載后,不能直接整合到專案 問題1.多次拍攝視頻崩潰 問題2.雙擊record按鈕, ......

    uj5u.com 2020-09-10 07:00:50 more
  • Android 開發技術周報 Issue#293

    新聞 谷歌為Android TV開發者提供多種新功能 Android 11將自動填表功能整合到鍵盤輸入建議中 谷歌宣布Android Auto即將支持更多的導航和數字停車應用 谷歌Pixel 5只有XL版本 搭載驍龍765G且將比Pixel 4更便宜 [圖]Wear OS將迎來重磅更新:應用啟動時間 ......

    uj5u.com 2020-09-10 07:01:38 more
  • 海豚星空掃碼投屏 Android 接收端 SDK 集成 六步驟

    掃碼投屏,開放網路,獨占設備,不需要額外下載軟體,微信掃碼,發現設備。支持標準DLNA協議,支持倍速播放。視頻,音頻,圖片投屏。好點意思。還支持自定義基于 DLNA 擴展的操作動作。好像要收費,沒體驗。 這里簡單記錄一下集成程序。 一 跟目錄的build.gradle添加私有mevan倉庫 mave ......

    uj5u.com 2020-09-10 07:01:43 more
最新发布
  • 歡迎頁輪播影片

    如圖,引導開始,球從上落下,同時淡入文字,然后文字開始輪播,最后一頁時停止,點擊進入首頁。 在來看看效果圖。 重力球先不講,主要歡迎輪播簡單實作 首先新建一個類 TextTranslationXGuideView,用于影片展示 文本是類似的,最后會有個圖片箭頭影片,布局很簡單,就是一個 TextVi ......

    uj5u.com 2023-04-20 08:40:31 more
  • 【FAQ】關于華為推送服務因營銷訊息頻次管控導致服務通訊類訊息

    一. 問題描述 使用華為推送服務下發IM訊息時,下發訊息請求成功且code碼為80000000,但是手機總是收不到訊息; 在華為推送自助分析(Beta)平臺查看發現,訊息發送觸發了頻控。 二. 問題原因及背景 2023年1月05日起,華為推送服務對咨詢營銷類訊息做了單個設備每日推送數量上限管理,具體 ......

    uj5u.com 2023-04-20 08:40:11 more
  • 歡迎頁輪播影片

    如圖,引導開始,球從上落下,同時淡入文字,然后文字開始輪播,最后一頁時停止,點擊進入首頁。 在來看看效果圖。 重力球先不講,主要歡迎輪播簡單實作 首先新建一個類 TextTranslationXGuideView,用于影片展示 文本是類似的,最后會有個圖片箭頭影片,布局很簡單,就是一個 TextVi ......

    uj5u.com 2023-04-20 08:39:36 more
  • 【FAQ】關于華為推送服務因營銷訊息頻次管控導致服務通訊類訊息

    一. 問題描述 使用華為推送服務下發IM訊息時,下發訊息請求成功且code碼為80000000,但是手機總是收不到訊息; 在華為推送自助分析(Beta)平臺查看發現,訊息發送觸發了頻控。 二. 問題原因及背景 2023年1月05日起,華為推送服務對咨詢營銷類訊息做了單個設備每日推送數量上限管理,具體 ......

    uj5u.com 2023-04-20 08:39:13 more
  • iOS從UI記憶體地址到讀取成員變數(oc/swift)

    開發除錯時,我們發現bug時常首先是從UI顯示發現例外,下一步才會去定位UI相關連的資料的。XCode有給我們提供一系列debug工具,但是很多人可能還沒有形成一套穩定的除錯流程,因此本文嘗試解決這個問題,順便提出一個暴論:UI顯示例外問題只需要兩個步驟就能完成定位作業的80%: 定位例外 UI 組 ......

    uj5u.com 2023-04-19 09:16:23 more
  • FIDE重磅更新!性能飛躍!體驗有禮!

    FIDE 開發者工具重構升級啦!實作500%性能提升,誠邀體驗! 一直以來不少開發者朋友在社區反饋,在使用 FIDE 工具的程序中,時常會遇到諸如加載不及時、代碼預覽/渲染性能不如意的情況,十分影響開發體驗。 作為技術團隊,我們深知一件趁手的開發工具對開發者的重要性,因此,在2023年開年,FinC ......

    uj5u.com 2023-04-19 09:16:15 more
  • 游戲內嵌社區服務開放,助力開發者提升玩家互動與留存

    華為 HMS Core 游戲內嵌社區服務提供快速訪問華為游戲中心論壇能力,支持玩家直接在游戲內瀏覽帖子和交流互動,助力開發者擴展內容生產和觸達的場景。 一、為什么要游戲內嵌社區? 二、游戲內嵌社區的典型使用場景 1、游戲內打開論壇 您可以在游戲內繪制論壇入口,為玩家提供沉浸式發帖、瀏覽、點贊、回帖、 ......

    uj5u.com 2023-04-19 09:15:46 more
  • iOS從UI記憶體地址到讀取成員變數(oc/swift)

    開發除錯時,我們發現bug時常首先是從UI顯示發現例外,下一步才會去定位UI相關連的資料的。XCode有給我們提供一系列debug工具,但是很多人可能還沒有形成一套穩定的除錯流程,因此本文嘗試解決這個問題,順便提出一個暴論:UI顯示例外問題只需要兩個步驟就能完成定位作業的80%: 定位例外 UI 組 ......

    uj5u.com 2023-04-19 09:14:53 more
  • FIDE重磅更新!性能飛躍!體驗有禮!

    FIDE 開發者工具重構升級啦!實作500%性能提升,誠邀體驗! 一直以來不少開發者朋友在社區反饋,在使用 FIDE 工具的程序中,時常會遇到諸如加載不及時、代碼預覽/渲染性能不如意的情況,十分影響開發體驗。 作為技術團隊,我們深知一件趁手的開發工具對開發者的重要性,因此,在2023年開年,FinC ......

    uj5u.com 2023-04-19 09:14:08 more
  • 游戲內嵌社區服務開放,助力開發者提升玩家互動與留存

    華為 HMS Core 游戲內嵌社區服務提供快速訪問華為游戲中心論壇能力,支持玩家直接在游戲內瀏覽帖子和交流互動,助力開發者擴展內容生產和觸達的場景。 一、為什么要游戲內嵌社區? 二、游戲內嵌社區的典型使用場景 1、游戲內打開論壇 您可以在游戲內繪制論壇入口,為玩家提供沉浸式發帖、瀏覽、點贊、回帖、 ......

    uj5u.com 2023-04-19 09:08:34 more