NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

MAİNACTİVİTY
package com.example.gencsoru1;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
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 {
SharedPreferences preferences;
SharedPreferences.Editor editor;
String mail_string,sifre_string;
Button giris,kayıt;
EditText kullanıcıadı,sifre;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
preferences =
PreferenceManager.getDefaultSharedPreferences(getApplicationContext());//pr
eferences objesi
editor = preferences.edit();
if(preferences.getBoolean("login", false)){
Intent i = new
Intent(getApplicationContext(),AnasayfaActivity.class);
startActivity(i);
finish();
}
kullanıcıadı = (EditText)findViewById(R.id.KullanıcıAdı);
sifre = (EditText)findViewById(R.id.Sifre);
giris = (Button) findViewById(R.id.btnGiris);
giris.setOnClickListener(new View.OnClickListener() {//giriş butonu
tıklandığı zaman
@Override
public void onClick(View v) {
mail_string = kullanıcıadı.getText().toString();
sifre_string = sifre.getText().toString();
if(mail_string.matches("") ||
sifre_string.matches("")){//bilgiler eksik ise
AlertDialog.Builder alertDialog = new
AlertDialog.Builder(MainActivity.this);
alertDialog.setTitle("Uyar˝");
alertDialog.setMessage("Eksiksiz Doldurunz!");
alertDialog.setPositiveButton("Tamam", new which
DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,int) { }});
alertDialog.show();
}else
Toast.makeText(MainActivity.this,"=="+email+sifre,Toast.LENGTH_SHORT).show(
);
String email = preferences.getString("email", "genc");
String sifre = preferences.getString("sifre", "123");
if(email.matches(mail_string) &&
sifre.matches(sifre_string)){
editor.putBoolean("login", true);
Intent i = new
Intent(getApplicationContext(),AnasayfaActivity.class);
startActivity(i);
finish();
}else{
AlertDialog.Builder alertDialog = new AlertDialog.Builder(
MainActivity.this);
alertDialog.setTitle("Hata");
alertDialog.setMessage("Mailiniz veya Şifreniz Uyuşmuyor!");
alertDialog.setPositiveButton("Tamam", new
DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,int which) {}});
alertDialog.show();}} } });}}
ANASAYFAACTİVİTY
public class AnasayfaActivity extends AppCompatActivity {
SharedPreferences preferences; //preferences nesne referansı
SharedPreferences.Editor editor;
TextView Sırala;
ListView sozluk;
Button ekle,sil;
Veritabanı vt;
String turkce, ingilizce, cumle;
String turkceStr, ingilizceStr, cumleStr, numberStr;
int id;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_anasayfa);
sozluk = findViewById(R.id.listViewSozluk);
ekle = findViewById(R.id.saddBtn);
sil = findViewById(R.id.silBtn);
ArrayList<String> sozlukList = new ArrayList<>();
vt = new Veritabanı(this);
SQLiteDatabase helper = vt.getWritableDatabase();
Cursor cursor = null;
cursor = helper.query("KAYIT", null, null, null, null, null, null);
preferences =
PreferenceManager.getDefaultSharedPreferences(getApplicationContext());//pr
eferences nesnesi oluşturuluyor ve prefernces referansına bağlanıyor
editor = preferences.edit();
sozluk = findViewById(R.id.listViewSozluk);
while (cursor.moveToNext()) {
turkce = cursor.getString(cursor.getColumnIndex("Turkce"));
id = cursor.getInt(cursor.getColumnIndex("ID"));
ingilizce =
cursor.getString(cursor.getColumnIndex("Ingılızce"));
cumle = cursor.getString(cursor.getColumnIndex("Cumle"));
sozlukList.add(id + "-" + turkce + "-" + ingilizce + "-" +
cumle);
}
cursor.close();
vt.close();
ArrayAdapter<String> veriAdapter = new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1, android.R.id.text1, sozlukList);
sozluk.setAdapter(veriAdapter);
ekle.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent listIntent= new
Intent(getApplicationContext(),Main2Activity.class);
startActivity(listIntent); }}); }}
MAİNACTİVİTY2
package com.example.gencsoru1;
public class Main2Activity extends AppCompatActivity {
EditText cumle,ing,tr;Button addBtn;Veritabanı db; ContentValues
contentValues; SQLiteDatabase sqLiteDatabase;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main2);
cumle = findViewById(R.id.cumleTxt);
ing = findViewById(R.id.ingilizceTxt);
tr = findViewById(R.id.turkceTxt);
addBtn = findViewById(R.id.addBtn);
db = new Veritabanı(this);
contentValues = new ContentValues();
sqLiteDatabase = db.getWritableDatabase();
addBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
contentValues.put("Turkce", tr.getText().toString());
//tablodak sutun isimleri
contentValues.put("Ingılızce", ing.getText().toString());
contentValues.put("Cumle", cumle.getText().toString());
long rowID = sqLiteDatabase.insert("KAYIT", null,
contentValues);
Toast.makeText(Main2Activity.this, ":" + rowID + "nolu
kayit yapildi", Toast.LENGTH_SHORT).show();
Intent listIntent= new
Intent(getApplicationContext(),AnasayfaActivity.class);
startActivity(listIntent);
} });
}}
     
 
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.