NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

--------menulu hesap makinesi-----------
menü için app-res-menu-menu_main tasarımı burdan yap
activity_main den mektup simgesini sil

main_activity den şunu sil

fab.setOnClickListener { view ->
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show()
}
-------------------
main_activity

package com.example.serhan.myapplication

import android.os.Bundle
import android.support.design.widget.Snackbar
import android.support.v7.app.AppCompatActivity;
import android.view.Menu
import android.view.MenuItem

import kotlinx.android.synthetic.main.activity_main.*
import kotlinx.android.synthetic.main.content_main.*

class MainActivity : AppCompatActivity() {


var sonuc=0
var sayi1=0
var sayi2=0
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
setSupportActionBar(toolbar)


}

override fun onCreateOptionsMenu(menu: Menu): Boolean {
// Inflate the menu; this adds items to the action bar if it is present.
menuInflater.inflate(R.menu.menu_main, menu)
return true
}

override fun onOptionsItemSelected(item: MenuItem): Boolean {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
sayi1=eTxtSayi1.text.toString().toInt()
sayi2=eTxtSayi2.text.toString().toInt()

return when (item.itemId) {
R.id.Topla -> {
sonuc=sayi1+sayi2
txtSonuc.text=sonuc.toString()
true
}
R.id.Cikar->{
sonuc=sayi1-sayi2
txtSonuc.text=sonuc.toString()
true
}
R.id.Bol->{
sonuc=sayi1/sayi2
txtSonuc.text=sonuc.toString()
true
}
R.id.Carp->{
sonuc=sayi1*sayi2
txtSonuc.text=sonuc.toString()
true
}
else->super.onOptionsItemSelected(item)

}
}
}


-----------------sürekli resim degistirme--------------------

main activity

var sayac=0
btnResim.setOnClickListener{ it:view!
if(sayac==0){
ivResim.setImageResource(R.mipmap.sero_launcher)
sayac++
}else if (sayac==1){
ivResim.setImageResource(R.mipmap.sero_layer)
sayac++
}else {
ivResim.setImageResource(R.drawable.resim1)
sayac=0
}
}



-----------------------------------------------------------------------
RASTGELE SAYI ÜRETME MAİN ACTİVİTY
package com.example.isim.rasgelesayi

import android.graphics.Color
import android.support.v7.app.AppCompatActivity
import android.os.Bundle
import android.widget.ArrayAdapter
import android.widget.Toast
import kotlinx.android.synthetic.main.activity_main.*
import java.util.*

class MainActivity : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
var Limit= arrayOf("100","200","300","400")
var Adap = ArrayAdapter<String>(this,android.R.layout.simple_spinner_item,Limit)
spinnerAltSinir.adapter=Adap
spinnerUstLimir.adapter=Adap
spinnerUstLimir.setSelection(Limit.size-1)
var UretilenSayi=0
buttonSayiUret.setOnClickListener {
UretilenSayi=SayiUret(spinnerAltSinir.selectedItem.toString().toInt(),spinnerUstLimir.selectedItem.toString().toInt())
}
buttonDene.setOnClickListener {
var Deger=editTextTSayi.text.toString().toInt()
if (UretilenSayi<Deger){
Ekran.setBackgroundColor(Color.BLUE)
Toast.makeText(this,"Sayıyı Azalt",Toast.LENGTH_SHORT).show()
}
else if (UretilenSayi>Deger){
Ekran.setBackgroundColor(Color.YELLOW)
Toast.makeText(this,"Sayıyı Yükselt",Toast.LENGTH_SHORT).show()
}
else{
Ekran.setBackgroundColor(Color.GREEN)
Toast.makeText(this,"Tebrikler Bildiniz.",Toast.LENGTH_SHORT).show()
}
}
buttonPesEt.setOnClickListener {
Toast.makeText(this,"Bilemediğiniz Sayi :"+UretilenSayi,Toast.LENGTH_LONG).show()
UretilenSayi=SayiUret(spinnerAltSinir.selectedItem.toString().toInt(),spinnerUstLimir.selectedItem.toString().toInt())

}

}

fun SayiUret(BaslangicDegeri:Int,BitisDegeri:Int):Int{
var rand =Random()
var number=rand.nextInt(BitisDegeri)
while (number<spinnerAltSinir.selectedItem.toString().toInt()){
number=rand.nextInt(BitisDegeri)
}
return number

}
}

-----------------------------------------------------------------------------------
MENULU HESAP MAKİNASI
MAİN ACTİVİTY
package com.example.isim.menuhesapmakinesi

import android.os.Bundle
import android.support.design.widget.Snackbar
import android.support.v7.app.AppCompatActivity
import android.view.Menu
import android.view.MenuItem

import kotlinx.android.synthetic.main.activity_main.*
import kotlinx.android.synthetic.main.content_main.*

class MainActivity : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
setSupportActionBar(toolbar)

}

override fun onCreateOptionsMenu(menu: Menu): Boolean {
// Inflate the menu; this adds items to the action bar if it is present.
menuInflater.inflate(R.menu.menu_main, menu)
return true
}

override fun onOptionsItemSelected(item: MenuItem): Boolean {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
return when (item.itemId) {
R.id.Topla ->{//Topla Tıklandığında bu Kodlar çalışacak
textViewSonuc.text=(editTextSayi1.text.toString().toDouble()+editTextSayi2.text.toString().toDouble()).toString()
true
}
R.id.Cikar->{
textViewSonuc.text=(editTextSayi1.text.toString().toDouble()-editTextSayi2.text.toString().toDouble()).toString()
true
}
R.id.Carp->{
textViewSonuc.text=(editTextSayi1.text.toString().toDouble()*editTextSayi2.text.toString().toDouble()).toString()
true
}
R.id.Bol->{
textViewSonuc.text=(editTextSayi1.text.toString().toDouble()/editTextSayi2.text.toString().toDouble()).toString()
true
}
R.id.Temizle->{
textViewSonuc.text=""
editTextSayi1.text= null
editTextSayi2.text=null
true
}
else -> super.onOptionsItemSelected(item)
}
}
}

-----------------------------------------------------------------
MENULU YAPILACAKLAR MUTABLE LİSTELİ
MAİN ACTİVİTY
package com.example.isim.menuyapilacaklar

import android.os.Bundle
import android.support.design.widget.Snackbar
import android.support.v7.app.AppCompatActivity
import android.view.Menu
import android.view.MenuItem
import android.widget.ArrayAdapter
import android.widget.Toast

import kotlinx.android.synthetic.main.activity_main.*
import kotlinx.android.synthetic.main.content_main.*

class MainActivity : AppCompatActivity() {
var _List= mutableListOf<String>()
lateinit var Adap:ArrayAdapter<String>
var SecilenItem:String=""
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
setSupportActionBar(toolbar)
Adap=ArrayAdapter<String>(this,android.R.layout.simple_selectable_list_item,_List)
_ListView.adapter=Adap
_ListView.setOnItemClickListener { parent, view, position, id ->

SecilenItem=_List[position]
Toast.makeText(this,SecilenItem,Toast.LENGTH_LONG).show()
}
}

override fun onCreateOptionsMenu(menu: Menu): Boolean {
// Inflate the menu; this adds items to the action bar if it is present.
menuInflater.inflate(R.menu.menu_main, menu)
return true
}

override fun onOptionsItemSelected(item: MenuItem): Boolean {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
return when (item.itemId) {
R.id.isEkle->{//Menu Butonuna Tılandığın çalışacak kodlar

var IS:String= editTextIs.text.toString()
if (IS!=""){
_List.add(IS)
_ListView.adapter=Adap
// _List.add(editTextIs.text.toString())
}
else{
Toast.makeText(this,"Bir İş tanımı giriniz",Toast.LENGTH_LONG).show()
}


true
}
R.id.isSil ->{
_List.remove(SecilenItem)
_ListView.adapter=Adap
true
}
R.id.Cikisi ->{
//System.exit(0)
finish()

true
}
else -> super.onOptionsItemSelected(item)
}
}
}
--------------------------------------------------------------------------
VİZE - FİNAL SPİNNERLI
MAİN ACTİVİTY (1. SAYFA )
package com.example.isim.vizefinal

import android.content.Intent
import android.support.v7.app.AppCompatActivity
import android.os.Bundle
import android.widget.ArrayAdapter
import android.widget.Toast
import kotlinx.android.synthetic.main.activity_main.*

class MainActivity : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
var NotlarDizi= arrayOf("10","20","30","40","50","60","70","80","90","100")
var NotlarListe= listOf<String>("10","20","30","40","50","60","70","80","90","100")
var AdapDizi=ArrayAdapter(this,android.R.layout.simple_spinner_item,NotlarDizi)
var AdapListe=ArrayAdapter(this,android.R.layout.simple_spinner_item,NotlarListe)
spinnerVize.adapter=AdapDizi//Oluşturduğumuz Adaptor'ü Belirttik
spinnerFinal.adapter=AdapListe//Oluşturduğumuz Adaptor'ü Belirttik
button.setOnClickListener {
Toast.makeText(this,"Buttona basıldı",Toast.LENGTH_SHORT).show()
var Vize=spinnerVize.selectedItem.toString().toDouble()
//var Final=spinnerFinal.selectedItem.toString().toDouble()
var _intent=Intent(this,Main2Activity::class.java)
_intent.putExtra("Vize",Vize)
_intent.putExtra("Final",spinnerFinal.selectedItem.toString().toDouble())
startActivity(_intent)
}



}
}


ACTİVİTY MAİN 2 (2. SAYFA )
package com.example.isim.vizefinal

import android.graphics.Color
import android.support.v7.app.AppCompatActivity
import android.os.Bundle
import kotlinx.android.synthetic.main.activity_main2.*

class Main2Activity : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main2)
DegerYaz()
var Bnot=DegerDon()
textViewDegerDon.text=Bnot.toString()
HarfNotuHesaplaRenkVer(Bnot)
}
fun HarfNotuHesaplaRenkVer(Bnot:Double){
when(Bnot) {
in 0..30 ->{
textViewHarfNotu.text="FF"
Ekran.setBackgroundColor(Color.RED)
}
in 30..60 ->{
textViewHarfNotu.text="CC"
Ekran.setBackgroundColor(Color.MAGENTA)

}
in 60..80 -> {
textViewHarfNotu.text="BB"
Ekran.setBackgroundColor(Color.BLUE)

}
in 80..100->{
textViewHarfNotu.text="AA"
Ekran.setBackgroundColor(Color.GREEN)
}
}
}
fun DegerYaz(){
var Vize=intent.getDoubleExtra("Vize",0.0)
var Final=intent.getDoubleExtra("Final",0.0)
textViewDegerYaz.text=(Vize*0.40+Final*0.60).toString()
}
fun DegerDon():Double{
var Vize=intent.getDoubleExtra("Vize",0.0)
var Final=intent.getDoubleExtra("Final",0.0)
return (Vize*0.40+Final*0.60)

}
}
     
 
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.