android-fragments

RecyclerView with multiple layouts, insert/delete function and click listener

那年仲夏 提交于 2020-03-05 03:06:33
问题 I am developing a job estimation app which stores information in a room database and holds a reference to it via a RecyclerView which user can use to access the data and make changes if needed. I am retrieving a reference to the information using Live Data via a view model with Observer method inside a Fragment. This information is stored in a database when the user completes a form and presses the save button. Currently I have developed two standard adapters, with different data sets and

RecyclerView with multiple layouts, insert/delete function and click listener

坚强是说给别人听的谎言 提交于 2020-03-05 03:06:09
问题 I am developing a job estimation app which stores information in a room database and holds a reference to it via a RecyclerView which user can use to access the data and make changes if needed. I am retrieving a reference to the information using Live Data via a view model with Observer method inside a Fragment. This information is stored in a database when the user completes a form and presses the save button. Currently I have developed two standard adapters, with different data sets and

Android NavigationUI startDestination class (not ID) programmatically

懵懂的女人 提交于 2020-03-04 18:57:21
问题 I need to set the start destination of a navigation graph programmatically depending on a condition. I have Fragment0, and also Fragment1, Fragment2, ... FragmentN all extending Fragment0, and being all of them (including Fragment0) able to be that wished start destination . I already know there is the method from NavGraph called setStartDestination(R.id.nav_fragment_X); but it is not useful for me because, if I am not wrong, it requires to have all these fragment0...N nodes declared in the

Android NavigationUI startDestination class (not ID) programmatically

陌路散爱 提交于 2020-03-04 18:56:49
问题 I need to set the start destination of a navigation graph programmatically depending on a condition. I have Fragment0, and also Fragment1, Fragment2, ... FragmentN all extending Fragment0, and being all of them (including Fragment0) able to be that wished start destination . I already know there is the method from NavGraph called setStartDestination(R.id.nav_fragment_X); but it is not useful for me because, if I am not wrong, it requires to have all these fragment0...N nodes declared in the

WebView in my app is not loading an HTTPS URL

旧城冷巷雨未停 提交于 2020-03-03 03:05:36
问题 When I try to load a URL in the WebView it only shows a blank screen. If I load https://www.google.com or https://www.facebook.com it is working fine. package com.example.hp.cccapp; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.webkit.WebView; import android.webkit.WebViewClient; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R

WebView in my app is not loading an HTTPS URL

不羁岁月 提交于 2020-03-03 03:02:05
问题 When I try to load a URL in the WebView it only shows a blank screen. If I load https://www.google.com or https://www.facebook.com it is working fine. package com.example.hp.cccapp; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.webkit.WebView; import android.webkit.WebViewClient; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R

Bottom Sheet Fragment causes error when called the second time

家住魔仙堡 提交于 2020-03-02 00:29:29
问题 I have a class BottomSheetFragment extends BottomSheetDialogFragment , which contains sub-fragments, and I call it from a fragment. The problem is that when I call it the second time, my app crashes with Binary XML file line #69: Duplicate id 0x7f090071, tag null, or parent id 0xffffffff with another fragment error. Bottom sheet class: public class BottomSheetFragment extends BottomSheetDialogFragment { public BottomSheetFragment() { // Required empty public constructor } @Override public

Fragment doesn't replace and hide another fragment

夙愿已清 提交于 2020-03-01 20:52:15
问题 I'm working on an android project and my fragment are not working... I'm trying to have this kind of UI -> http://developer.android.com/training/basics/fragments/fragment-ui.html However my second fragment doesn't replace or hide the first one, it's simply going under it! This is how I declare my first fragment in the main activity: setContentView(R.layout.finallayout); Bundle bundle = new Bundle(); bundle.putStringArrayList("urllist", URLlist); // set Fragmentclass Arguments MainFragment

NavController no current navigation node after device rotation

只谈情不闲聊 提交于 2020-02-28 06:59:47
问题 I am making app, which supports different device orientations. Navigation is carried out by Android Jetpack's Navigation. App main screen for landscape orientation is present below. It is list wrapper fragment (it is NavHostFragment , it is added to activity's layout in fragment tag), wrapper includes list fragment ( fragment ) and details fragment ( FrameLayout ). Portrait orientation is similar (wrapper and list in it, details is accessible throw navigation). My problem is after I change

How to make different menu options in different Fragment?

流过昼夜 提交于 2020-02-27 06:36:39
问题 I want to have completely different menu options in different fragment .I followed this post.But my fragment menu is adding with the activity menu.But i don't want to have activity menus in some of my fragments. In SlidingDrawerActivity : @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu_main, menu); return true; } In my fragment: public Friends_Status_Comment_Fragment(){ setHasOptionsMenu(true); } @Override public void onCreateOptionsMenu(Menu