Category : fragment

This is my code for a fragment and it doesn’t reach onCreateView. How do I access it? Also I’m getting this error : java.lang.ClassCastException: androidx.appcompat.widget.AppCompatTextView cannot be cast to android.view.ViewGroup I have also attached the fragment_profile.xml for reference. public class ProfileFragment extends Fragment { private EditText etName; private EditText etEmail; private EditText etPassword; @Override public ..

Read more

Trying to implement GridView in Fragment however my app keeps stopping. There is no errors in code. For your information bmifragment, portionfragment and profilefragment classes source code are not shown here as they are empty. RecipeActivity.java package com.bignerdranch.android.foodiepot; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.design.widget.BottomNavigationView; import android.support.v4.app.Fragment; import android.support.v7.app.AppCompatActivity; import android.view.MenuItem; public class RecipeActivity extends AppCompatActivity ..

Read more

I saw the implementation of ViewModel with fragments and I have a question about fragment reusability with it. Google implementation of ViewModel with fragments public class SharedViewModel extends ViewModel { private final MutableLiveData<Item> selected = new MutableLiveData<Item>(); public void select(Item item) { selected.setValue(item); } public LiveData<Item> getSelected() { return selected; } } public class MasterFragment ..

Read more

I want to sand data from LoginActivity to FragmentIndividual. I’ve been thinking about it for two days, but I haven’t solved it. I don’t know why NullPointer happens. I’d really appreciate it if you could attach the code together. Please help me .. @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_login); // Initialize Firebase Auth ..

Read more

Hello I have an android app with sqlite database and GreenDao. The database looks like: InventoryCategory (id, name) InventoryUnit(id, name) InventoryItem (id, name, amount, category_fk, unit_fk) In separate fragments I show list (using recyclerView) of these and user can add/edit/delete item/category/unit. My question is: How to do this in more generic way, because I think ..

Read more