Notes
Notes - notes.io |
Maninactivity.java
package com.example.menuluhesap;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
EditText etS1,etS2;
TextView tvSonuc;
int S1 = 0;
int S2 = 0;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
etS1 = findViewById(R.id.etS1);
etS2 = findViewById(R.id.etS2);
tvSonuc = findViewById(R.id.tvSonuc);
FloatingActionButton fab = findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
S1 = Integer.parseInt(etS1.getText().toString());
S2 = Integer.parseInt(etS2.getText().toString());
int id = item.getItemId();
switch (id){
case R.id.Toplama:
int toplam = S1 + S2;
tvSonuc.setText(String.valueOf(toplam));
Toast.makeText(this, ""+S1, Toast.LENGTH_SHORT).show();
return true;
case R.id.Cikarma:
int kalan = S1 - S2;
tvSonuc.setText(String.valueOf(kalan));
return true;
case R.id.Carpma:
int carpim = S1 * S2;
tvSonuc.setText(String.valueOf(carpim));
return true;
case R.id.Bolme:
double bolum = S1 / S2;
tvSonuc.setText(String.valueOf(bolum));
return true;
}
return super.onOptionsItemSelected(item);
}
}
*******************************************************************************************************************
sayfa geçişli menülü hesap makinesi
Mainactivity.java
package com.example.menuhesap;
import android.content.Intent;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.EditText;
import android.widget.Switch;
import android.widget.TextView;
import android.widget.Toast;
import javax.sql.StatementEvent;
public class MainActivity extends AppCompatActivity {
EditText etS1,etS2;
int S1 = 0;
int S2 = 0;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
etS1 = findViewById(R.id.etS1);
etS2 = findViewById(R.id.etS2);
FloatingActionButton fab = findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
finish();
System.exit(0);
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
S1 = Integer.parseInt(etS1.getText().toString());
S2 = Integer.parseInt(etS2.getText().toString());
Intent i = new Intent(MainActivity.this,Sonucekran.class);
String Sonuc = null;
// 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.
int id = item.getItemId();
/* //noinspection SimplifiableIfStatement
if (id == R.id.Bolme) {
return true;
}*/
switch(id){
case R.id.Toplama:
Sonuc = S1+" + "+S2+" = "+(S1+S2);
i.putExtra("sonuc",Sonuc);
startActivity(i);
return true;
case R.id.Cikarma:
Sonuc = S1+" - "+S2+" = "+(S1-S2);
i.putExtra("sonuc",Sonuc);
startActivity(i);
return true;
case R.id.Carpma:
Sonuc = S1+" * "+S2+" = "+(S1*S2);
i.putExtra("sonuc",Sonuc);
startActivity(i);
return true;
case R.id.Bolme:
Sonuc = S1+" / "+S2+" = "+(S1/S2);
i.putExtra("sonuc",Sonuc);
startActivity(i);
return true;
case R.id.sil:
etS2.setText(null);
etS1.setText(null);
return true;
}
return super.onOptionsItemSelected(item);
}
}
-----------------------------------------------------------------------------------------
sonucekran.java
package com.example.menuhesap;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.TextView;
public class Sonucekran extends AppCompatActivity {
TextView tvSonuc;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sonucekran);
tvSonuc = findViewById(R.id.tvSonuc);
tvSonuc.setText(getIntent().getExtras().getString("sonuc"));
}
}
--************************************************************************************************************
isim soyisim yazıp sayfa geçişi yapan program
Mainactivity.java
package com.example.veriaktarma;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
public class MainActivity extends AppCompatActivity {
EditText etAd,etYas;
Button btnHesapla;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
etAd = findViewById(R.id.etAd);
etYas = findViewById(R.id.etYas);
btnHesapla = findViewById(R.id.btnYas);
btnHesapla.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String isim = etAd.getText().toString();
byte yas = Byte.parseByte(etYas.getText().toString());
Intent intentAktar = new Intent(MainActivity.this,GoruntuleActivity.class);
intentAktar.putExtra("ad",isim);
intentAktar.putExtra("yas",yas);
startActivity(intentAktar);
}
});
}
}
*--------------------------------------------------------------------------------------
GoruntuleActivity.java
package com.example.veriaktarma;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.TextView;
public class GoruntuleActivity extends AppCompatActivity {
TextView tvAd,tvDt;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_goruntule);
tvAd = findViewById(R.id.tvAd);
tvDt = findViewById(R.id.tvDt);
String ad = getIntent().getExtras().getString("ad");
tvAd.setText("İsminiz :"+ad);
byte yas = getIntent().getExtras().getByte("yas");
int dt = 2019-yas;
tvDt.setText("Doğum Tarihiniz :"+String.valueOf(dt));
}
}
---******************************************************************************************************
spinner vize final hesaplama harf notu sayfa geçişli
Mainactivity.java
package com.example.aktarmalvizfin;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
EditText etAd;
Spinner spVize,spFinal;
Button btnHesapla;
int vize = 0;
int fin = 0;
double bn = 0;
String vized [];
String finald [];
String harf ="" ;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
etAd =findViewById(R.id.etAd);
spVize = findViewById(R.id.spVize);
spFinal = findViewById(R.id.spFinal);
btnHesapla = findViewById(R.id.btnHesapla);
vized =getResources().getStringArray(R.array.Vizen);
finald = getResources().getStringArray(R.array.Finaln);
spVize.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
vize = Integer.parseInt(vized[position]);
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
});
spFinal.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
fin = Integer.parseInt(finald[position]);
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
});
btnHesapla.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
bn = vize*0.4+fin*0.6;
if (bn<40)
harf = "FF";
else if (bn<50)
harf = "DD";
else if (bn<60)
harf = "DC";
else if (bn<70)
harf ="CC";
else if (bn<80)
harf = "CB";
else if (bn<90)
harf = "BB";
else
harf = "AA";
String isim = etAd.getText().toString();
Intent aktarma = new Intent(MainActivity.this,sonucekrani.class);
aktarma.putExtra("bn",bn);
aktarma.putExtra("ad",isim);
aktarma.putExtra("hnot",harf);
startActivity(aktarma);
// Toast.makeText(MainActivity.this, ""+bn+harf, Toast.LENGTH_SHORT).show();
}
});
}
}
------------------------------------------------------------------------------------------
sonucekrani.java
package com.example.aktarmalvizfin;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.TextView;
import android.widget.Toast;
public class sonucekrani extends AppCompatActivity {
TextView tvSonuc;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sonucekrani);
tvSonuc = findViewById(R.id.tvSonuc);
String ad2 = getIntent().getExtras().getString("ad");
double bn2 = getIntent().getExtras().getDouble("bn");
String harf2 = getIntent().getExtras().getString("hnot");
tvSonuc.setText("İsminiz : "+ad2+"Başarı Notunuz : "+bn2+"Harf Karşılığı :"+harf2);
Toast.makeText(this, ""+ad2+bn2+harf2, Toast.LENGTH_SHORT).show();
}
}
---------------------------------------------------------------------------------------------
strings.xml
<resources>
<string name="app_name">aktarmalıvizfin</string>
<string name="ad">İsminizi Giriniz :</string>
<string name="hesap">Hesapla</string>
<string name="viz">Vize</string>
<string name="fin">Final</string>
<string-array name="Vizen">
<item>10</item>
<item>20</item>
<item>30</item>
<item>40</item>
<item>50</item>
<item>60</item>
<item>70</item>
<item>80</item>
<item>90</item>
<item>100</item>
</string-array>
<string-array name="Finaln">
<item>10</item>
<item>20</item>
<item>30</item>
<item>40</item>
<item>50</item>
<item>60</item>
<item>70</item>
<item>80</item>
<item>90</item>
<item>100</item>
</string-array>
</resources>
|
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