NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

EDİT TEXT NOT EKLEME DİĞER SAYFAYA GÖNDERME
-----------------------------------------------------------

public class MainActivity extends AppCompatActivity {
public static ArrayList<String> list = new ArrayList<String>(); //EKLEME YAPMAK İÇİN STATİC
EditText et1 ;
Button btnGecis;
String yazi;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
et1 = findViewById(R.id.et1);
btnGecis = findViewById(R.id.btnGecis);
btnGecis.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
yazi = et1.getText().toString();
Intent intent = new Intent(MainActivity.this,sonucActivity.class);
intent.putExtra("yazi",yazi);
startActivity(intent);
}
});
}
}
-------------------------------------------------------------
public class sonucActivity extends AppCompatActivity {
int pos;
ListView lv ;
Button btnSil ;
String gelenveri;
ArrayAdapter<String> adapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sonuc);
lv=findViewById(R.id.lv);
gelenveri = getIntent().getExtras().getString("yazi","");
MainActivity.list.add(gelenveri); //GLOBAL TANIMLAMAK İÇİN ACTİVİTY ADINI YAZIYORUZ
btnSil = findViewById(R.id.btnSil);
adapter = new ArrayAdapter<>(this,R.layout.support_simple_spinner_dropdown_item,MainActivity.list); //LİSTEYİ ADAPTERE AKTARIYORUZ
lv.setAdapter(adapter); //ADAPTERİ LİSTVİEWEE AKTARMA
adapter.notifyDataSetChanged();

lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) { //TIKLANDIGINDAKİ POSİTİONU YAKAMA

pos = position;
}
});

btnSil.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
MainActivity.list.remove(pos); //SİLME
adapter.notifyDataSetChanged();
}
});
}
}
-------------------------------------------------------------------
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/ekran"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">

<EditText
android:id="@+id/et1"
android:layout_width="287dp"
android:layout_height="0dp"
android:layout_marginStart="8dp"
android:layout_marginTop="168dp"
android:layout_marginEnd="8dp"
android:ems="10"
android:inputType="textPersonName"
android:text="Name"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<Button
android:id="@+id/btnGecis"
android:layout_width="165dp"
android:layout_height="92dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="113dp"
android:layout_marginBottom="8dp"
android:text="Ekle"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/et1" />

</android.support.constraint.ConstraintLayout>
-------------------------------------------------------------

RADİO BUTON KULLANIMI
-----------------------------
public class MainActivity extends AppCompatActivity {
ConstraintLayout ekran;
RadioGroup rbgrup;
RadioButton rb_kirmizi,rb_sari,rb_mavi,rb_siyah;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

ekran=findViewById(R.id.ekran);
rbgrup=findViewById(R.id.rbgrup);
rb_kirmizi=findViewById(R.id.rb_kirmizi);
rb_sari=findViewById(R.id.rb_sari);
rb_siyah=findViewById(R.id.rb_siyah);
rb_mavi=findViewById(R.id.rb_mavi);
rbgrup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup radioGroup, int i) {
if (rb_kirmizi.isChecked()) {

ekran.setBackgroundColor(Color.RED);
}
else if (rb_mavi.isChecked()) {

ekran.setBackgroundColor(Color.BLUE);
}
else if (rb_siyah.isChecked()) {

ekran.setBackgroundColor(Color.BLACK);
}
else if (rb_sari.isChecked()) {

ekran.setBackgroundColor(Color.YELLOW);
}

}
});
}
}
----------------------------------------------
TASARIM KISMI
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/ekran"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">

<RadioGroup
android:id="@+id/rbgrup"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">

<RadioButton
android:id="@+id/rb_kirmizi"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Kırmızı"
tools:layout_editor_absoluteX="54dp"
tools:layout_editor_absoluteY="60dp" />

<RadioButton
android:id="@+id/rb_sari"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Sarı"
tools:layout_editor_absoluteX="54dp"
tools:layout_editor_absoluteY="171dp" />

<RadioButton
android:id="@+id/rb_siyah"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Siyah"
tools:layout_editor_absoluteX="54dp"
tools:layout_editor_absoluteY="230dp" />

<RadioButton
android:id="@+id/rb_mavi"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Mavi"
tools:layout_editor_absoluteX="54dp"
tools:layout_editor_absoluteY="115dp" />
</RadioGroup>

</android.support.constraint.ConstraintLayout>
--------------------------------------------------
HESAP MAKİNESİ
-----------------------------------
public class MainActivity extends AppCompatActivity {
EditText etS1,etS2;
TextView tvS;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
etS1=findViewById(R.id.etS1);
etS2=findViewById(R.id.etS2);
tvS=findViewById(R.id.tvS);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
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) {
// 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 s1,s2,sonuc;
s1=Integer.parseInt(etS1.getText().toString());
s2=Integer.parseInt(etS2.getText().toString());


int id = item.getItemId();

//noinspection SimplifiableIfStatement
if (id == R.id.Topla) {
sonuc=s1+s2;
tvS.setText(s1+ "+" +s2+ "="+sonuc);
return true;
} else if (id == R.id.Cıkar){
sonuc=s1-s2;
tvS.setText(s1+ "-" +s2+ "="+sonuc);
return true;
}
else if (id == R.id.Carp){
sonuc=s1*s2;
tvS.setText(s1+ "*" +s2+ "="+sonuc);
return true;
}
else if (id == R.id.Bol){
sonuc=s1/s2;
tvS.setText(s1+ "/" +s2+ "="+sonuc);
return true;
}
else if (id == R.id.Sil){
etS1.setText("");
etS2.setText(null);
tvS.setText("");
return true;
}


return super.onOptionsItemSelected(item);
}
}

------------------------------------------
MENU MAİN XML
--------------
<item
android:id="@+id/Cıkar"
android:orderInCategory="100"
android:title="Cıkar"
android:icon="@drawable/cikar"
app:showAsAction="always" />


-----------------------------------------------
TOAST MESAJ 3 Tane
-----------------------------
public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}

public void basitToast(View view) {

Toast.makeText(this,"Basit Toasta Basıldı!!",Toast.LENGTH_LONG).show();


}

public void resimliToast(View view) {
ImageView winx =new ImageView(MainActivity.this);
winx.setImageResource(R.drawable.bloom);
Toast toast=new Toast(getApplicationContext());
toast.setView(winx);
toast.setDuration(Toast.LENGTH_LONG);
toast.show();
}

public void ozelToast(View view) {
TextView yazi =new TextView(getApplicationContext());
yazi.setTextSize(25);
yazi.setTextColor(Color.GREEN);
yazi.setText("Süslü yazı");
Toast toast =new Toast(getApplicationContext());
toast.setView(yazi);
toast.setDuration(Toast.LENGTH_LONG);
toast.show();
}
}
----------------------------
NESNELER
--------------
public class MainActivity extends AppCompatActivity {
ToggleButton tbTitresim;
TextView tvToggle;
Vibrator titresim;
Button btnKaydet;
CheckBox cbOnay;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
tbTitresim=findViewById(R.id.tbTitresim);
tvToggle=findViewById(R.id.tvToggle);
cbOnay=findViewById(R.id.cbOnay);
btnKaydet=findViewById(R.id.btnKaydet);
titresim=(Vibrator)this.getSystemService(Context.VIBRATOR_SERVICE);
tbTitresim.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View view){
boolean on=((ToggleButton)view).isChecked();
if (on) {
tvToggle.setText("Açık");
titresim.vibrate(10000);

} else {
tvToggle.setText("Kapalı");
titresim.cancel();
}
}
});
cbOnay.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
boolean durum=cbOnay.isChecked();
if(durum==true)
{
btnKaydet.setVisibility(View.VISIBLE);
btnKaydet.setEnabled(true);
} else {
btnKaydet.setVisibility(View.INVISIBLE);
btnKaydet.setEnabled(false);
}
}
});
btnKaydet.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View view){
Toast.makeText(MainActivity.this,"KAYDEDİLDİ",Toast.LENGTH_SHORT).show();
btnKaydet.setVisibility(View.INVISIBLE);
btnKaydet.setEnabled(false);
cbOnay.setChecked(false);
}
});

}
}
-------------------
Andoid manifest
--------------
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.metin.nesneler">
<uses-permission android:name="android.permission.VIBRATE"></uses-permission>

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

</manifest>
---------------------------
Spinner Kullanımı
--------------------------------
public class MainActivity extends AppCompatActivity {
EditText etSayi1,etsayi2;
Spinner menu;

ArrayAdapter veriAdaptoru;
String islemler [] = {"Toplama","Cikarma","Carpma","Bolme","Silme"};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
etSayi1=findViewById(R.id.etSayi1);
etsayi2=findViewById(R.id.etSayi2);
Spinner menu =(Spinner)findViewById(R.id.menu);
ArrayAdapter<String> veriAdaptoru = new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,android.R.id.text1,islemler);
menu.setAdapter(veriAdaptoru);


menu.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
if(menu.getSelectedItem().toString().equals(islemler[0])) {
float s1=Float.parseFloat(etSayi1.getText().toString());
float s2=Float.parseFloat(etsayi2.getText().toString());
float sonuc=(float) (s1+s2);

Intent a= new Intent(MainActivity.this,Sonuc_Activity.class);
a.putExtra("sonuc",s1+"+"+s2+"="+sonuc);


} else if(menu.getSelectedItem().toString().equals(islemler[1])) {
float s1=Float.parseFloat(etSayi1.getText().toString());
float s2=Float.parseFloat(etsayi2.getText().toString());
float sonuc=(float) (s1-s2);
Intent a= new Intent(MainActivity.this,Sonuc_Activity.class);
a.putExtra("sonuc",s1+"-"+s2+"="+sonuc);

}


else if(menu.getSelectedItem().toString().equals(islemler[2])) {
float s1=Float.parseFloat(etSayi1.getText().toString());
float s2=Float.parseFloat(etsayi2.getText().toString());
float sonuc=(float) (s1*s2);
Intent a= new Intent(MainActivity.this,Sonuc_Activity.class);
a.putExtra("sonuc",s1+"*"+s2+"="+sonuc);

}


else if(menu.getSelectedItem().toString().equals(islemler[3])) {
float s1=Float.parseFloat(etSayi1.getText().toString());
float s2=Float.parseFloat(etsayi2.getText().toString());
float sonuc=(float) (s1/s2);
Intent a= new Intent(MainActivity.this,Sonuc_Activity.class);
a.putExtra("sonuc",s1+"/"+s2+"="+sonuc);

}


else if(menu.getSelectedItem().toString().equals(islemler[4])) {

etSayi1.getText().clear();
//etSayi1.setText( " ");
etsayi2.getText().clear();

}}
});
}}



sonuç_Activity
public class Sonuc_Activity extends AppCompatActivity {
TextView tvSonuc;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sonuc_);
tvSonuc=findViewById(R.id.tvSonuc);

float sonuc= getIntent().getExtras().getFloat("sonuc",(float) 0);
tvSonuc.setText(String.valueOf(sonuc));


}

}

     
 
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.