skip to Main Content

How can I access a JSON file in the ViewModel class?

I'm trying to load a RecyclerView with JSON data in a local file located in 'assets'. Activity: class RecipesActivity : AppCompatActivity(), RecipeAdapter.RecipeItemListener { private lateinit var binding : ActivityRecipesBinding override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) binding = ActivityRecipesBinding.inflate(layoutInflater) setContentView(binding.root) setSupportActionBar(binding.mainToolBar.toolbar)…

VIEW QUESTION

Android Studio – i am trying to add name and number in my recyler view contact list but when i click add button the app stop working and close

MainActivity of my code package com.example.recycleview; import androidx.appcompat.app.AppCompatActivity; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import android.app.Dialog; import android.os.Bundle; import android.view.View; import android.widget.Adapter; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; import com.google.android.material.floatingactionbutton.FloatingActionButton; import java.util.ArrayList; public class MainActivity extends AppCompatActivity { ArrayList<ContactModel>arrContact= new ArrayList<>(); RecyclerContactAdapter…

VIEW QUESTION
Back To Top
Search