package com.mayi.fastdevelop.base;

import android.os.Bundle;

import androidx.lifecycle.ViewModel;

import java.lang.reflect.ParameterizedType;


public class BaseVMActivity<T extends ViewModel> extends BaseActivity{

    protected T viewmodel;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        viewmodel= getDefaultViewModelProviderFactory().create
                ((Class<T>) ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[0]);
    }
}
