android-architecture-components

Correct way to close DialogFragment when using Navigation component?

房东的猫 提交于 2020-08-25 07:39:27
问题 I am using the Navigation component to show a DialogFragment ( <dialog...>...</dialog> in the navigation.xml ) and want to know what's the recommended way to close the Dialog. I tried myself and got the following results: 1) dismiss() in DialogFragment : seems to work fine 2) findNavController().navigateUp() : seems to work fine 3) findNavController().navigate(MyDialogFragmentDirections.actionMyDialogFragmentToMyNormalFragment()) : works, but loads a fresh version of the target destination,

Room using the @Relation annotation - one to many relationship where clause child relationship

拜拜、爱过 提交于 2020-08-25 03:56:06
问题 Using the @Relation annotation. I can query a one to many relationship using the following: @Dao public interface PostDao { @Query("SELECT * FROM post") List<PostWithComments> getPostWithComments(); } Here are the entities @Entity public class Post { @PrimrayKey private int id; private String title; private String content; } @Entity public class Comment { @PrimrayKey private int id; private int post_id; private String content; private String status; } public class PostWithComments { @Embedded

How to find a child Fragment with Navigation Architecture components

本秂侑毒 提交于 2020-08-10 19:36:57
问题 After learning basics about new architecture components, I decided to apply this knowledge and work a demo project. In this project I have been working with google map. In my navHost fragment, one of the fragment shows google map this way <fragment android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/map" android:name="com.google.android.gms.maps.SupportMapFragment"></fragment> from the code I have been trying to get this fragment class, the related code

How to find a child Fragment with Navigation Architecture components

柔情痞子 提交于 2020-08-10 19:35:33
问题 After learning basics about new architecture components, I decided to apply this knowledge and work a demo project. In this project I have been working with google map. In my navHost fragment, one of the fragment shows google map this way <fragment android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/map" android:name="com.google.android.gms.maps.SupportMapFragment"></fragment> from the code I have been trying to get this fragment class, the related code

Could not resolve android.arch.lifecycle:extensions:1.1.0

狂风中的少年 提交于 2020-08-06 17:33:32
问题 I am trying to add lifecycle:extensions to my project but i can not make it work . Each time it shows error . Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve android.arch.lifecycle:extensions:1.1.0. I have already read several threads but could not make it work by the answers given there. Project level gradle is: buildscript { repositories { google() jcenter() } dependencies { classpath 'com.android.tools.build:gradle:3.1.2' } } allprojects { repositories {

Could not resolve android.arch.lifecycle:extensions:1.1.0

六眼飞鱼酱① 提交于 2020-08-06 17:33:04
问题 I am trying to add lifecycle:extensions to my project but i can not make it work . Each time it shows error . Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve android.arch.lifecycle:extensions:1.1.0. I have already read several threads but could not make it work by the answers given there. Project level gradle is: buildscript { repositories { google() jcenter() } dependencies { classpath 'com.android.tools.build:gradle:3.1.2' } } allprojects { repositories {