Newer
Older
NemophilaClient / app / src / main / java / com / example / nemophila / TestActivity.java
package com.example.nemophila;

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

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

import com.example.nemophila.entities.Shop;
import com.example.nemophila.viewmodels.ShopsViewModel;

import java.util.Collection;

public class TestActivity extends AppCompatActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_test);

        //RoomViewModelへのアクセス
        ShopsViewModel shopsViewModel = new ViewModelProvider(this).get(ShopsViewModel.class);


        // setViewModelのテスト用
        Button setViewModelButton = (Button)findViewById(R.id.setViewModel);
        setViewModelButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                shopsViewModel.setViewArea(20.0, 40.0, 10.0, 30.0);
            }
        });
    }
}