Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ru.gigaser.hypersmm
- import android.os.Bundle
- import android.view.LayoutInflater
- import android.view.View
- import android.view.ViewGroup
- import android.widget.Button
- import android.widget.TextView
- import android.widget.Toast
- import androidx.core.os.bundleOf
- import androidx.fragment.app.Fragment
- import androidx.fragment.app.setFragmentResult
- class LoginFragment : Fragment() {
- override fun onCreateView(
- inflater: LayoutInflater, container: ViewGroup?,
- savedInstanceState: Bundle?
- ): View? {
- return inflater.inflate(R.layout.fragment_login, container, false)
- }
- override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
- super.onViewCreated(view, savedInstanceState)
- val activity = requireActivity()
- val button = activity.findViewById<Button>(R.id.accept)
- Toast.makeText(requireContext(), lifecycle.currentState.toString(), Toast.LENGTH_SHORT).show()
- button.setOnClickListener {
- setFragmentResult("loginRequestResult", bundleOf(
- "login" to activity.findViewById<TextView>(R.id.login_input).text.toString(),
- "password" to activity.findViewById<TextView>(R.id.login_password_input).text.toString()
- ))
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement