Skip to content

Commit

Permalink
Merge pull request #1627 from DataDog/xgouchet/RUM-985/3_fix_webview_…
Browse files Browse the repository at this point in the history
…sample_app

RUM-985 fix the WebView fragment in sample app
  • Loading branch information
xgouchet authored Sep 20, 2023
2 parents 27c542b + 2063bf5 commit 49dfa8d
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import android.webkit.WebViewClient
import androidx.fragment.app.Fragment
import androidx.lifecycle.ViewModelProviders
import com.datadog.android.sample.R
import com.datadog.android.sample.SampleApplication
import com.datadog.android.webview.WebViewTracking

internal class WebFragment : Fragment() {
Expand Down Expand Up @@ -44,7 +45,8 @@ internal class WebFragment : Fragment() {

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
viewModel = ViewModelProviders.of(this).get(WebViewModel::class.java)
val factory = SampleApplication.getViewModelFactory(requireContext())
viewModel = ViewModelProviders.of(this, factory).get(WebViewModel::class.java)
}

override fun onResume() {
Expand Down

0 comments on commit 49dfa8d

Please sign in to comment.