NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

package
com.x.sinavalkin
import
android.support.v7.app.AppCompatActivity
import
android.os.Bundle
import
android.widget.Toast
import
kotlinx.android.synthetic.main.activity_main2.*
import
android.graphics.BitmapFactory
import
android.graphics.Bitmap
import
android.graphics.Canvas
import
android.graphics.Paint
import
android.graphics.Paint.
ANTI_ALIAS_FLAG
import
android.R.attr.
src
import
android.opengl.ETC1.getHeight
import
android.opengl.ETC1.getWidth
class
Main2Activity : AppCompatActivity() {
var
person
: Person = Person(
""
,
0
,
""
)
override fun
onCreate(savedInstanceState: Bundle?) {
super
.onCreate(savedInstanceState)
setContentView(R.layout.
activity_main2
)
getPerson()
}
fun
getPerson() {
person
=
getIntent().getExtras().getSerializable(
"person"
)
as
Person
var
school =
""
when
(
person
.
age
) {
in
0
..
8
-> school =
"
İ
lkokula Gitmiyor"
in
9
..
12
-> school =
"
İ
lkokula Gidiyor"
in
13
..
16
-> school =
"Orta Okula Gidiyor"
else
-> school =
"Çalı
ş
ıyor"
}
txtDescription.
text
=
"
${
person
.
name
}
isimli
ş
ahıs
ş
u
anda
$
school
ve
${
person
.
age
}
ya
ş
ında"
if
(
person
.
gender
==
"Kadın"
) {
imgGender.setImageResource(R.drawable.
female
)
return
}
imgGender.setImageResource(R.drawable.
male
)
}
}



-----------------------------------------------------------------------------------------------------
package
com.x.sinavalkin
import
android.content.Intent
import
android.support.v7.app.AppCompatActivity
import
android.os.Bundle
import
android.view.View
import
android.widget.ArrayAdapter
import
android.widget.Button
import
android.widget.Spinner
import
android.widget.Toast
import
kotlinx.android.synthetic.main.activity_main.*
import
android.widget.RadioButton
import
java.io.Serializable
class
MainActivity : AppCompatActivity() {
val
birthdayNumbers: ArrayList<Int> = ArrayList()
val
currentNumbers: ArrayList<Int> = ArrayList()
override fun
onCreate(savedInstanceState: Bundle?) {
super
.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
createArrays()
fillSpinner(R.id.spnBirthday, birthdayNumbers)
fillSpinner(R.id.spnCurrentDate, currentNumbers)
btnNext.setOnClickListener
{
createPerson()
}
}
fun
createArrays() {
for
(i
in
1970
..
2010
step
5
) {
birthdayNumbers.add(i)
}
for
(i
in
2005
..
2015
) {
currentNumbers.add(i)
}
}
fun
fillSpinner(id: Int, array: ArrayList<Int>) {
val
birthDaySpinner = findViewById(id)
as
Spinner
var
adapter=
ArrayAdapter(
this
,android.R.layout.simple_list_item_1,array)
birthDaySpinner.adapter=adapter
}
fun
createPerson() {
var
d1 =
spnCurrentDate.selectedItem.toString().toInt()
var
d2 = spnBirthday.selectedItem.toString().toInt()
val
selectedId = rdgGender.getCheckedRadioButtonId()
var
rdb = findViewById<View>(selectedId)
as
RadioButton
var
newPerson = Person(txtName.text.toString(), d1 -
d2, rdb.text)
changePage(newPerson)
}
fun
changePage(person: Person) {
val
intent = Intent(
this
, Main2Activity::
class
.java)
intent.putExtra(
"person"
, person)
baseContext.startActivity(intent)
}
}
data class
Person(
val
name: String,
val
age: Int,
val
gender:
CharSequence): Serializable {
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.