Skip to content

Instantly share code, notes, and snippets.

@davidelp68
Created March 27, 2020 11:05
Android Studio - Tabbed Activity
package com.dm.tutorialtabactivity
import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import kotlinx.android.synthetic.main.fragment1.*
/**
* A simple [Fragment] subclass.
*/
class Fragment1 : Fragment() {
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,savedInstanceState: Bundle?): View? {
// Imposta il layout per questo frammento
return inflater.inflate(R.layout.fragment1, container, false)
}
//funzione principale dove inserire il proprio codice
override fun onResume() {
super.onResume()
//inserire qui il proprio codice
//gestione del pulsante con id=button
button.setOnClickListener {
textView.text = "Tab1"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment