Skip to content

Instantly share code, notes, and snippets.

View mikkipastel's full-sized avatar

Monthira Chayabanjonglerd mikkipastel

View GitHub Profile
@mikkipastel
mikkipastel / MainActivity.kt
Last active October 6, 2022 08:00
add second fragment in activity
package com.ascedncorp.androidbasic
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.ascedncorp.androidbasic.databinding.ActivityMainBinding
class MainActivity: AppCompatActivity() {
private val binding: ActivityMainBinding by lazy {
ActivityMainBinding.inflate(layoutInflater)
@mikkipastel
mikkipastel / SecondFragment.kt
Created October 6, 2022 04:11
add SecondFragment
package com.ascedncorp.androidbasic
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import com.ascedncorp.androidbasic.databinding.FragmentMainBinding
import com.ascedncorp.androidbasic.databinding.FragmentSecondBinding
@mikkipastel
mikkipastel / MainActivity.kt
Created October 5, 2022 04:06
move activity content to fragment
package com.ascedncorp.androidbasic
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.ascedncorp.androidbasic.databinding.ActivityMainBinding
class MainActivity: AppCompatActivity() {
private val binding: ActivityMainBinding by lazy {
ActivityMainBinding.inflate(layoutInflater)
@mikkipastel
mikkipastel / local.properties
Created October 3, 2022 02:59
sample upload pom file
url="/helloaar/"
username=USERNAME
password=PASSWORD
@mikkipastel
mikkipastel / MainActivity.kt
Created September 26, 2022 07:29
activity & fragment workshop : refactor code
package com.ascedncorp.androidbasic
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.ascedncorp.androidbasic.databinding.ActivityMainBinding
class MainActivity: AppCompatActivity() {
private val binding: ActivityMainBinding by lazy {
ActivityMainBinding.inflate(layoutInflater)
@mikkipastel
mikkipastel / MainActivity.kt
Created September 26, 2022 07:23
activity & fragment workshop : send EditText to show text of TextView at SecondActivity
package com.ascedncorp.androidbasic
import android.content.Intent
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.ascedncorp.androidbasic.databinding.ActivityMainBinding
class MainActivity: AppCompatActivity() {
private val binding: ActivityMainBinding by lazy {
@mikkipastel
mikkipastel / activity_main.xml
Created September 26, 2022 06:23
android & fragment workshop : change textview to edittext
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<EditText
android:id="@+id/edittext"
android:layout_width="match_parent"
@mikkipastel
mikkipastel / MainActivity.kt
Created September 21, 2022 11:15
start second activity by intent
package com.ascedncorp.androidbasic
import android.content.Intent
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.ascedncorp.androidbasic.databinding.ActivityMainBinding
class MainActivity: AppCompatActivity() {
private val binding: ActivityMainBinding by lazy {
@mikkipastel
mikkipastel / AndroidManifest.xml
Created September 21, 2022 10:39
add SecondActivity
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.ascedncorp.androidbasic">
<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
@mikkipastel
mikkipastel / activity_main.xml
Created September 21, 2022 10:03
add Button under TextView
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/textview"
android:layout_width="wrap_content"