android-fragments

OnActivityResult method is deprecated, what is the alternative?

走远了吗. 提交于 2020-12-25 01:40:21
问题 Recently I faced the onActivtyResult is deprecated . what should we do for handle it? any alternative introduced for that? 回答1: A basic training is available at developer.android.com. Here is an example on how to convert the existing code with the new one: The old way: public void openSomeActivityForResult() { Intent intent = new Intent(this, SomeActivity.class); startActivityForResult(intent, 123); } @Override protected void onActivityResult (int requestCode, int resultCode, Intent data) {

Android Bottom Nav Activity

萝らか妹 提交于 2020-12-16 03:43:06
问题 I am trying to use Bottom Navigation Activity. I use the default 3 menu items with their fragments. My problem is, I am seeing a gap between the ActionBar and the fragment. In the activity_main, I set the height to match_parent . I tried to see if anyone else has this problem but could not come across. In the activity_main.xml file, I have the code that comes with a creation of a new activity: <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res

Android Bottom Nav Activity

穿精又带淫゛_ 提交于 2020-12-16 03:43:00
问题 I am trying to use Bottom Navigation Activity. I use the default 3 menu items with their fragments. My problem is, I am seeing a gap between the ActionBar and the fragment. In the activity_main, I set the height to match_parent . I tried to see if anyone else has this problem but could not come across. In the activity_main.xml file, I have the code that comes with a creation of a new activity: <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res

Android : Call a Fragment Method from a service

做~自己de王妃 提交于 2020-12-15 06:46:24
问题 Have a Firebase Cloud messagin Service running , and i want each time i receive a new message a methode in a specif fragment is called. public class FirebaseMsgService extends FirebaseMessagingService { public FirebaseMsgService() { } @Override public void onMessageReceived(RemoteMessage remoteMessage) { super.onMessageReceived(remoteMessage); ServiceConnector serviceconnector =null; JSONObject data; String json = remoteMessage.getData().toString(); try{ data= new JSONObject(json); **Fragment

How to implement databinding with Reflection in BaseFragment()

偶尔善良 提交于 2020-12-15 06:33:29
问题 I'm trying to implement a BaseFragment in which I will pass the layout resource on it and it should outputs the binding to work in the fragment itself instead of need to do it everytime the fragment is extended. For example I have this BaseFragment open class BaseFragment(@LayoutRes contentLayoutId : Int = 0) : Fragment(contentLayoutId) { private lateinit var onInteractionListener: OnFragmentInteractionListener val toolbar : Toolbar? get() { return if(activity is BaseActivity) (activity as

How to implement databinding with Reflection in BaseFragment()

∥☆過路亽.° 提交于 2020-12-15 06:32:15
问题 I'm trying to implement a BaseFragment in which I will pass the layout resource on it and it should outputs the binding to work in the fragment itself instead of need to do it everytime the fragment is extended. For example I have this BaseFragment open class BaseFragment(@LayoutRes contentLayoutId : Int = 0) : Fragment(contentLayoutId) { private lateinit var onInteractionListener: OnFragmentInteractionListener val toolbar : Toolbar? get() { return if(activity is BaseActivity) (activity as

How to implement databinding with Reflection in BaseFragment()

為{幸葍}努か 提交于 2020-12-15 06:31:31
问题 I'm trying to implement a BaseFragment in which I will pass the layout resource on it and it should outputs the binding to work in the fragment itself instead of need to do it everytime the fragment is extended. For example I have this BaseFragment open class BaseFragment(@LayoutRes contentLayoutId : Int = 0) : Fragment(contentLayoutId) { private lateinit var onInteractionListener: OnFragmentInteractionListener val toolbar : Toolbar? get() { return if(activity is BaseActivity) (activity as

How to pass ParcelableArrayList from Fragment to Fragment?

大城市里の小女人 提交于 2020-12-15 05:30:50
问题 I have been trying to find the way to pass a ParcelableArrayList from one Fragment to Another and for some reason when I receive the ParcelableArrayList it's empty. I have checked many posts about this problem but I don't make it work. This is my Activity that holds the Fragments in a FrameLayout: package com.blumonpay.restaurant.customer.presentation.activities; import androidx.appcompat.app.AppCompatActivity; import androidx.fragment.app.Fragment; import android.os.Bundle; import android

How to pass ParcelableArrayList from Fragment to Fragment?

瘦欲@ 提交于 2020-12-15 05:30:45
问题 I have been trying to find the way to pass a ParcelableArrayList from one Fragment to Another and for some reason when I receive the ParcelableArrayList it's empty. I have checked many posts about this problem but I don't make it work. This is my Activity that holds the Fragments in a FrameLayout: package com.blumonpay.restaurant.customer.presentation.activities; import androidx.appcompat.app.AppCompatActivity; import androidx.fragment.app.Fragment; import android.os.Bundle; import android

How to use Android Fragment in Flutter plugin?

寵の児 提交于 2020-12-13 03:32:41
问题 I need to wrap SDK created in native code iOS/Android into Flutter. On Android side there is some functionality where my Fragment or Activity needs to extend SDK Fragment or Activity to implement custom view. My question is how I can wrap SDK Fragment or Activity in Flutter plugin and let extends this on flutter project side using my plugin ? I other words I would like to have a Widget which can extend Fragment or Activity using my plugin to have ability to show Widget ui in SDK . Using