title: Setprogress for a progress bar across fragments android using Kotlin
body: <p>I am an amateur to both, android studio and kotlin. I am implementing a scenario where I have some fragments, as and when we finish with one fragment, the progress is shown on the main layout. These fragments replace the main frame layout and switching from one fragment to next is done in the previous fragment using the <code>setonclicklistener</code>. However, the problem is that I am unable to see the update happening to the progressbar. By the way, I am not using any progress dialogue. All I need is to update the progress bar as I switch from one fragment to another. When I run the App, it doesn't crash but the update doesn't happen. The main_layout file as given below and the frame layout is replaced by the fragments.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout
  xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
  android:layout_height="match_parent"&gt;
  
  &lt;ProgressBar
      android:id="@+id/parentmain_progress"
      android:layout_width="match_parent"
      android:layout_height="25dp"
  
  style="@style/Base.Widget.AppCompat.ProgressBar.Horizontal"
      android:scaleY="2"/&gt;
  &lt;FrameLayout
      android:id="@+id/parentmain_frame"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:layout_below="@id/parentmain_progress"&gt;
  &lt;/FrameLayout&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>One of the fragments where the progress is not updated:</p>
  
  <pre><code>class ParentChildInfoFragment : Fragment() {
  
  override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,savedInstanceState: Bundle?): View? {
      // Inflate the layout for this fragment
      return inflater.inflate(R.layout.fragment_parent_info_relation, container, false)
  
  }
  
  override fun onCreate(savedInstanceState: Bundle?) {
      super.onCreate(savedInstanceState)
  }
  
  override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
      super.onViewCreated(view, savedInstanceState)
      headerparentrelation_text?.text= arguments?.getString("name")
      parentmain_progress?.max=4
      parentmain_progress?.setProgress(3)
      val string = "Your Cild is a....\n Girl/Boy"
      specifying_relation_txt?.text = string
  
      relation_mom_image?.setImageResource(R.drawable.girl)
      relation_dad_image?.setImageResource(R.drawable.boy)
  
      val girlstring = "Girl"
      mom_txt?.text = girlstring
  
      val boystring = "Boy"
      dad_txt?.text=boystring
  
      nextbtn_parentrelation.setOnClickListener {
          fragmentManager?.beginTransaction()?.replace(R.id.parentmain_frame,ParentInfoFragment())?.commit()
      }
    }
  }
  </code></pre>
  
  <p>Any help appreciated.</p>