parent
9d552eeae4
commit
334316f200
@ -0,0 +1,47 @@
|
|||||||
|
package com.example.Cat.activity.activity;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.database.sqlite.SQLiteDatabase;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.example.Cat.R;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class UserMessageActivity extends AppCompatActivity implements View.OnClickListener {
|
||||||
|
private TextView usernameText,sexText,addressText;
|
||||||
|
private String username;
|
||||||
|
List<UserInfo> list ;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.user_msg);
|
||||||
|
init();
|
||||||
|
setData();
|
||||||
|
}
|
||||||
|
private void setData() {
|
||||||
|
Intent intent = UserMessageActivity.this.getIntent();
|
||||||
|
username = intent.getStringExtra("username");
|
||||||
|
User_Database user=new User_Database(UserMessageActivity.this);
|
||||||
|
SQLiteDatabase sqLiteDatabase=user.getReadableDatabase();
|
||||||
|
list=user.queryByName(sqLiteDatabase,username);
|
||||||
|
usernameText.setText(String.format("%s", list.get(0).username));
|
||||||
|
sexText.setText(String.format("%s",list.get(0).sex));
|
||||||
|
addressText.setText(String.format("%s", list.get(0).city));
|
||||||
|
}
|
||||||
|
private void init() {
|
||||||
|
usernameText = findViewById(R.id.username);
|
||||||
|
sexText = findViewById(R.id.sex);
|
||||||
|
addressText = findViewById(R.id.address);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,90 @@
|
|||||||
|
<?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="match_parent"
|
||||||
|
android:orientation="vertical"
|
||||||
|
>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="370dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
android:background="#C9CDD4"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="20dp"
|
||||||
|
android:text="用户名:"
|
||||||
|
android:textColor="#000000"
|
||||||
|
android:textSize="22sp"
|
||||||
|
android:textStyle="italic" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/username"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
android:text="Cat"
|
||||||
|
android:textColor="#000000"
|
||||||
|
android:textSize="22sp"
|
||||||
|
android:textStyle="italic" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="370dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
android:background="#C9CDD4"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="20dp"
|
||||||
|
android:text="性别:"
|
||||||
|
android:textColor="#000000"
|
||||||
|
android:textSize="22sp"
|
||||||
|
android:textStyle="italic" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/sex"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
android:text="Cat"
|
||||||
|
android:textColor="#000000"
|
||||||
|
android:textSize="22sp"
|
||||||
|
android:textStyle="italic" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="370dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
android:background="#C9CDD4"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="20dp"
|
||||||
|
android:text="地址:"
|
||||||
|
android:textColor="#000000"
|
||||||
|
android:textSize="22sp"
|
||||||
|
android:textStyle="italic" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/address"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
android:text="Cat"
|
||||||
|
android:textColor="#000000"
|
||||||
|
android:textSize="22sp"
|
||||||
|
android:textStyle="italic" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
</LinearLayout>
|
Loading…
Reference in new issue