title: MVVM with Hilt,RxJava 3,Retrofit, Live Data and View Binding
body: <p>I currently get stock on this part. I want to display simple data from GSON and I practice using MVVM structure and with Hilt and &quot;RxJava&quot;.</p>
  <p>This is my &quot;View Model&quot; and I don't know what to do.(This is my first time using this structure and dependencies.)
  At my &quot;getTip()&quot; function under my View Model how can i transfer the data from &quot;tipsModel&quot; to arraylist and if i did something wrong at my codes.</p>
  <pre><code>public class TipsViewModel extends ViewModel {
  
  
  private static final String TAG = &quot;TipsViewModel&quot;;
  
  private Repository repository;
  private MutableLiveData&lt;ArrayList&lt;TipsModel&gt;&gt; tipsList = new MutableLiveData&lt;&gt;();
  
  @ViewModelInject
  public TipsViewModel(Repository repository){
      this.repository = repository;
  }
  
  
  public MutableLiveData&lt;ArrayList&lt;TipsModel&gt;&gt; getTipsList(){
      return tipsList;
  }
  
  
  public void getTips(){
      repository.getTips()
              .subscribeOn(Schedulers.io())
              .map(new Function&lt;TipsModel, ArrayList&lt;TipsModel&gt;&gt;() {
                  @Override
                  public ArrayList&lt;TipsModel&gt; apply(TipsModel tipsModel) throws Throwable {
                      // What i have to put here to transfer the data from &quot;tipsModel&quot; to my ArrayList.
                      return null;
                  }
              })
              .observeOn(AndroidSchedulers.mainThread())
              .subscribe(result -&gt; tipsList.setValue(result),
                  error -&gt; Log.e(TAG,&quot;getTips: &quot;+error.getMessage()));
  }
  </code></pre>
  <p>}</p>
  <p>This is my Repository</p>
  <pre><code>public class Repository {
  
  
  private TipsApiService apiService;
  
  @Inject
  public Repository(TipsApiService apiService){
      this.apiService = apiService;
  }
  
  
  public Observable&lt;TipsModel&gt; getTips(){
      return apiService.getTips();
  }
  </code></pre>
  <p>}</p>
  <p>And this is my Model. it a simple model.</p>
  <pre><code>public class TipsModel {
  
  private Integer id;
  private String gameName;
  private String gameMenu;
  private String subtitle;
  private String description;
  private Object image;
  
  public TipsModel(Integer id, String gameName, String gameMenu, String subtitle, String description, Object image) {
      this.id = id;
      this.gameName = gameName;
      this.gameMenu = gameMenu;
      this.subtitle = subtitle;
      this.description = description;
      this.image = image;
  }
  
  
  public Integer getId() {
      return id;
  }
  
  public String getGameName() {
      return gameName;
  }
  
  public String getGameMenu() {
      return gameMenu;
  }
  
  public String getSubtitle() {
      return subtitle;
  }
  
  public String getDescription() {
      return description;
  }
  
  public Object getImage() {
      return image;
  }
  
  public void setId(Integer id) {
      this.id = id;
  }
  
  public void setGameName(String gameName) {
      this.gameName = gameName;
  }
  
  public void setGameMenu(String gameMenu) {
      this.gameMenu = gameMenu;
  }
  
  public void setSubtitle(String subtitle) {
      this.subtitle = subtitle;
  }
  
  public void setDescription(String description) {
      this.description = description;
  }
  
  public void setImage(Object image) {
      this.image = image;
  }
  </code></pre>
  <p>}</p>
  <p>This is my Code on my fragment</p>
  <pre><code>@Nullable
  @Override
  public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
      binding = ActivityTipsViewBinding.inflate(inflater,container,false);
      return binding.getRoot();
  }
  
  @Override
  public void onViewCreated(@Nonnull View view, @Nullable Bundle savedInstanceState){
      super.onViewCreated(view, savedInstanceState);
  
      viewModel = new ViewModelProvider(this).get(TipsViewModel.class);
  
      initRecyclerView();
      observeData();
      viewModel.getTips();
  }
  
  
  private void observeData(){
      viewModel.getTipsList().observe(getViewLifecycleOwner(), new Observer&lt;ArrayList&lt;TipsModel&gt;&gt;() {
                  @Override
                  public void onChanged(ArrayList&lt;TipsModel&gt; tipsModels) {
                      Log.e(TAG,&quot;onChanged: &quot;+ tipsModels.size());
                      tipsAdapter.updateList(tipsModels);
                  }
              });
  }
  
  private void initRecyclerView(){
      binding.tipsRecyclerview.setLayoutManager(new LinearLayoutManager((getContext())));
      tipsAdapter = new TipsAdapter(getContext(),tipsModels);
      binding.tipsRecyclerview.setAdapter(tipsAdapter);
  }
  </code></pre>
  <p>}</p>