Newer
Older
NemophilaClient / app / src / main / java / com / example / nemophila / MyPageActivity.java
k-suzuki on 15 Jun 2023 2 KB MyPageActivityを作った
package com.example.nemophila;

import androidx.appcompat.app.AppCompatActivity;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProvider;

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

import com.example.nemophila.FriendActivity;
import com.example.nemophila.MainActivity;
import com.example.nemophila.MyPageEditorActivity;
import com.example.nemophila.R;
import com.example.nemophila.RequestedActivity;
import com.example.nemophila.entities.Account;
import com.example.nemophila.viewmodels.AccountViewModel;

public class MyPageActivity extends AppCompatActivity {
//MyPageActivity画面の作成
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_mypage);
//ボタンを押した場合の画面遷移
        Button friendButton = (Button) findViewById(R.id.friend);
        friendButton.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                Intent intent = new Intent(MyPageActivity.this, FriendActivity.class);
                startActivity(intent);

            }
        });
        Button changeMyPageButton = (Button) findViewById(R.id.changeMyPage);
        changeMyPageButton.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                Intent intent = new Intent(MyPageActivity.this, MyPageEditorActivity.class);
                startActivity(intent);
            }

        });

        Button cancelButton = (Button) findViewById(R.id.cancel);
        cancelButton.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                Intent intent = new Intent(MyPageActivity.this, MainActivity.class);
                startActivity(intent);
            }
        });
        Button RequestedButton = (Button) findViewById(R.id.requested);
        RequestedButton.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                Intent intent = new Intent(MyPageActivity.this, RequestedActivity.class);
                startActivity(intent);
            }
        });
//AccountViewModelとの通信とテキストの表示
        AccountViewModel accountViewModel = new ViewModelProvider(this).get(AccountViewModel.class);
        Nemophila nemophila = (Nemophila) getApplication();
        String uid = nemophila.getUid();
//        String name  = nemophila.
//        TextView name = (TextView) findViewById(R.id.name);
//        TextView id = (TextView) findViewById(R.id.id);

    }
}