This website or its third-party tools use cookies which are necessary to its functioning and required to improve your experience. By clicking the consent button, you agree to allow the site to use, collect and/or store cookies.
Please click the consent button to view this website.
I accept
Deny cookies Go Back

Mobile app tutorials

  • Home
  • About
  • Contact
  • Login
You are here: Home / Kotlin Fragments / Kotlin sharing data using fragment interface

December 13, 2017 by nigel

Kotlin sharing data using fragment interface





The Kotlin sharing data using fragment interface Android development tutorial describes how to pass data from a fragment to an Activity using a fragment interface.

The Kotlin on Android example application will capture a video in one Android fragment. The Uri of the captured video will then be passed to the calling activity.

The video capture portion of the Kotlin on Android tutorial will be based on the Kotlin Video tutorial.

If you are new to Android and/or Kotlin I recommend the Kotlin Fragments series to be done prior to this Kotlin on Android tutorial.

The key concepts this Kotlin on Android tutorial will cover are

  1. Creating Android fragment including layout files and interface
  2. How to use Android fragment tags
  3. How to load an Android fragment from an Android activity
  4. Getting the Uri of a recorded video
  5. How create an interface in an Android fragment
  6. How to implement a fragment interface in an Android Activity

In this Kotlin on Android tutorial we will cover:

Episodes

  1. Fragment Interface
  2. Fragment Arguments
  3. ViewModel
To get access to the source code and code descriptions please fill out the form below to complete your free membership:
An account with your username and/or email address has been created. Log in here to access your products or complete a purchase. [Note: an account will be created even if your initial transaction failed at checkout. If this happened to you, simply log in and attempt your transaction again.]









Conclusion

In this Kotlin on Android development tutorial, we described a common method of returning data from an Android Fragment to an Android Activity.
And for the tutorial example, we used the captured video, Uri.

Android studio was used to create the Android fragment along with the interface. As well as the creation of the interface, the implementation of the fragment’s onAttach method is created. Which initializes the interface and also checks that the calling activity has implemented the fragment interface.

In the following Kotlin on Android tutorial, we will describe how to pass data from an Android activity to an Android Fragment.

Print Friendly

Filed Under: Kotlin Fragments Tagged With: Android, Android Application, Android Development Tutorials, Android Fragment, Android Software Development, Android Studio, Kotlin, Kotlin Fragment Interface

  • Facebook
  • Google+
  • Twitter
  • YouTube




Recent Forum Topics

  • Kotlin Fragments
  • Kotlin Camera2 API
  • HTTP Image Libraries

Recent Posts

  • Installing and running flutter
  • Kotlin Camera2 API MediaRecorder
  • Flutter IntelliJ Tips for Beginners
  • Migrating Fragments to Jetpack Navigation
  • Flutter TabBar

Recent Posts

  • Installing and running flutter
  • Kotlin Camera2 API MediaRecorder
  • Flutter IntelliJ Tips for Beginners
  • Migrating Fragments to Jetpack Navigation
  • Flutter TabBar

Search Form

  • Facebook
  • GitHub
  • Google+
  • Twitter
  • YouTube

© 2021 - WWW.MOBAPPTUTS.COM