16 Kasım 2017 Perşembe
BLE LİB
https://github.com/douglasjunior/AndroidBluetoothLibrary?utm_source=android-arsenal.com&utm_medium=referral&utm_campaign=5821
3 Kasım 2017 Cuma
13 Eylül 2017 Çarşamba
22 Ağustos 2017 Salı
7 Ağustos 2017 Pazartesi
1 Ağustos 2017 Salı
Bluetooth Socket Android Not
https://developer.android.com/guide/topics/connectivity/bluetooth.html#SettingUp
-------------
Not : Connect İçin Bir Class + Input ve Outpur lar için Bir class Kullan (Thread Run *)Aksi takdir de Uygulama Kitleniyor.
BluetoothDevice btDevice = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
Etrafta olan bluetootlar ;
----
Set<BluetoothDevice> bondedDevices = bluetoothAdapter.getBondedDevices();
daha öncedende olan eşleşen bluetoothlar
***************
-------------
Not : Connect İçin Bir Class + Input ve Outpur lar için Bir class Kullan (Thread Run *)Aksi takdir de Uygulama Kitleniyor.
BluetoothDevice btDevice = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
Etrafta olan bluetootlar ;
----
Set<BluetoothDevice> bondedDevices = bluetoothAdapter.getBondedDevices();
daha öncedende olan eşleşen bluetoothlar
***************
22 Temmuz 2017 Cumartesi
13 Temmuz 2017 Perşembe
Devexpress Notlar
https://documentation.devexpress.com/WindowsForms/3940/Controls-and-Libraries/Chart-Control/Fundamentals/Series-Views/2D-Series-Views/Area-Series-Views/Stacked-Spline-Area-Chart
20 Haziran 2017 Salı
facebook login
http://abdullahbalta.com/android-facebook-sdkv4-entegrasyonu/
http://blog.nkdroidsolutions.com/android-facebook-login-example-v4/
http://blog.nkdroidsolutions.com/android-facebook-login-example-v4/
7 Haziran 2017 Çarşamba
Android Token-- . net Token Beare
http://www.gokhan-gokalp.com/asp-net-web-api-token-based-authentication/
.net
------------------------------
android
https://yadi.sk/d/pmQLcOes3JviuK
---------------------------------
.net
------------------------------
android
https://yadi.sk/d/pmQLcOes3JviuK
---------------------------------
Json Object Parse
https://paste.ubuntu.com/24800939/
-----------------------------
package com.example.argede_8.wsclient;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import com.google.gson.JsonParser;
import org.java_websocket.client.WebSocketClient;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.Map;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import okhttp3.WebSocket;
import okhttp3.WebSocketListener;
import okio.ByteString;
public class MainActivity extends AppCompatActivity {
private OkHttpClient okHttpClient;
private final class EchoWebSocketListener extends WebSocketListener{
private static final int Normal_Clouruse_Status = 1000;
@Override public void onOpen(okhttp3.WebSocket webSocket, Response response) {
Log.e("asdasd","onopen");
}
@Override public void onMessage(WebSocket webSocket, ByteString bytes) {
Log.e("Geldi On Mesage =", String.valueOf(bytes));
//JSONObject jsonObject = new JSONObject((Map) bytes); //JsonParseObdData(jsonObject); }
@Override public void onMessage(WebSocket webSocket, String text) {
Log.e("OnMessage =",text);
text.replace("","|wroomTXT|");
JSONObject jsonObject = null;
try {
jsonObject = new JSONObject(text);
} catch (JSONException e) {
Log.e("jsonExcept = ",e.toString());
}
JsonParseObdData(jsonObject);
}
@Override public void onClosing(WebSocket webSocket, int code, String reason) {
webSocket.close(Normal_Clouruse_Status,null);
Log.e("OnClosing","code ="+ String.valueOf(code) +" reason ="+reason);
Dinle();
}
@Override public void onFailure(WebSocket webSocket, Throwable t, Response response) {
Log.e("OnError",t.toString());
Dinle();
}
}
private TextView a,b,c,d,e,f;
private Button btn_dinle;
@Override protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
okHttpClient = new OkHttpClient();
a = (TextView)findViewById(R.id.a);
b = (TextView)findViewById(R.id.b);
c =(TextView)findViewById(R.id.c);
d =(TextView)findViewById(R.id.d);
e = (TextView)findViewById(R.id.e);
f = (TextView)findViewById(R.id.f);
btn_dinle = (Button)findViewById(R.id.btn_dinle);
btn_dinle.setOnClickListener(new View.OnClickListener() {
@Override public void onClick(View v) {
Dinle();
}
});
}
public void Dinle(){
Request request = new Request.Builder().url("ws://192.168.43.239:80").build();
EchoWebSocketListener listener = new EchoWebSocketListener();
WebSocket ws = okHttpClient.newWebSocket(request,listener);
// okHttpClient.dispatcher().executorService().shutdown(); }
private void JsonParseObdData(JSONObject data){
JSONObject jsonObject = (JSONObject) data;
final Iot_Arac_OBD_Model model = new Iot_Arac_OBD_Model();
try {
model.seta(jsonObject.getString("a").toString());
model.setb(jsonObject.getString("b").toString());
model.setc(jsonObject.getString("c").toString());
model.setd(jsonObject.getString("d").toString());
model.sete(jsonObject.getString("e").toString());
model.setf(jsonObject.getString("f").toString());
} catch (JSONException e) {
Log.e("JsonparseHata =",e.toString());
}
runOnUiThread(new Runnable() {
public void run(){
a.setText("(1)"+model.geta());
b.setText("(2)"+model.getb());
c.setText("(3)"+model.getc());
d.setText("(4)"+model.getd());
e.setText("(5)"+model.gete());
f.setText("(6)"+model.getf());
}
});
}
}
----------------------------------------
package com.example.argede_8.wsclient; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; /** * Created by ARGEDE_8 on 6/7/2017. */ public class Iot_Arac_OBD_Model { @SerializedName("a") @Expose private String a; @SerializedName("b") @Expose private String b; @SerializedName("c") @Expose private String c; @SerializedName("d") @Expose private String d; @SerializedName("e") @Expose private String e; @SerializedName("f") @Expose private String f; public void seta(String a){ this.a = a; } public String geta(){ return this.a; } public void setb(String b){ this.b = b; } public String getb(){ return this.b; } public void setc(String c){ this.c = c; } public String getc(){ return this.c; } public void setd(String d){ this.d = d; } public String getd(){ return this.d; } public void sete(String e){ this.e = e; } public String gete(){ return this.e; } public void setf(String f){ this.f = f; } public String getf(){ return this.f; } }
-------------------
https://paste.ubuntu.com/24800942/
5 Haziran 2017 Pazartesi
İçinden Scrol+ itemler veya Scrol + Scroll Bulunan Layoutlar için Yapılandırma
public class MyGridView extends GridView {
public MyGridView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public MyGridView(Context context) {
super(context);
}
public MyGridView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
@Override public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2,
MeasureSpec.AT_MOST);
super.onMeasure(widthMeasureSpec, expandSpec);
}
}
---------------------------------------------------------------------------
public class NonScrollExpandableListView extends ExpandableListView { public NonScrollExpandableListView(Context context) { super(context); } public NonScrollExpandableListView(Context context, AttributeSet attrs) { super(context, attrs); } public NonScrollExpandableListView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } @Override public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { int heightMeasureSpec_custom = MeasureSpec.makeMeasureSpec( Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST); super.onMeasure(widthMeasureSpec, heightMeasureSpec_custom); ViewGroup.LayoutParams params = getLayoutParams(); params.height = getMeasuredHeight(); } }
----------------------------------------------------------------------
<android.support.v4.widget.NestedScrollView android:layout_below="@+id/Arama" android:layout_width="match_parent" android:layout_height="match_parent"> <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent"> <com.example.argede_8.birseylazimmi.customGrid.MyGridView android:id="@+id/listeolustur_Gridview" android:layout_width="wrap_content" android:layout_height="wrap_content" android:columnWidth="90dp" android:numColumns="auto_fit" android:stretchMode="columnWidth" android:gravity="center" android:layout_marginLeft="15dp" android:layout_marginRight="15dp" /> <com.example.argede_8.birseylazimmi.customGrid.NonScrollExpandableListView android:groupIndicator="@null" android:layout_marginTop="5dp" android:layout_below="@+id/listeolustur_Gridview" android:id="@+id/expand_listview" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginLeft="15dp" android:layout_marginRight="15dp" android:layout_marginBottom="10dp" > </com.example.argede_8.birseylazimmi.customGrid.NonScrollExpandableListView> </RelativeLayout> </android.support.v4.widget.NestedScrollView>
6 Mayıs 2017 Cumartesi
token Header
OkHttpClient client = new OkHttpClient.Builder().addInterceptor(new Interceptor() {
@Override
public Response intercept(Chain chain) throws IOException {
Request newRequest = chain.request().newBuilder()
.addHeader("Authorization", "Bearer " + token)
.build();
return chain.proceed(newRequest);
}
}).build();
Retrofit retrofit = new Retrofit.Builder()
.client(client)
.baseUrl(/** your url **/)
.addConverterFactory(GsonConverterFactory.create())
.build();
sms atma telefon açma web site açma
https://www.mobilhanem.com/android-uygulamadan-telefon-acma-sms-atma-mail-atma-web-sitesini-tarayicida-acma/
5 Mayıs 2017 Cuma
c# web servis Prosedür hızlandırma ## Kod kalabalığını azaltma
https://paste.ubuntu.com/24515932/
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
namespace Argede_WebService.Sql_Prosodur_Otomatik
{
public class Sql_Prosodur_DirektBaglanti
{
private List<Model> arrayliststatic = new List<Model>();
public class Model
{
public string Prosedur_Adi { get; set; }
public SqlDbType Prosedur_Tipi { get; set; }
public string Prosedur_YuklencekVeri { get; set; }
public string Prosedur_Nvarcharsa_Uzunluk { get; set; }
}
public bool Pro_Calistir(string prosedur_Adi)
{
SqlConnection myConnection = new SqlConnection("Data Source=" + staticdegerler.DataSource + ";Initial Catalog=" + staticdegerler.Catalog + ";Integrated Security=True");
bool response = true;
try
{
SqlCommand sqlCmd = new SqlCommand();
sqlCmd.Connection = myConnection;
myConnection.Open();
sqlCmd.CommandType = System.Data.CommandType.StoredProcedure;
sqlCmd.CommandText = prosedur_Adi;
foreach (Model eleman in arrayliststatic)
{
if (eleman.Prosedur_Tipi.Equals(SqlDbType.NVarChar))
{
sqlCmd.Parameters.Add(eleman.Prosedur_Adi, eleman.Prosedur_Tipi,Convert.ToInt32(eleman.Prosedur_Nvarcharsa_Uzunluk));
}
else
{
sqlCmd.Parameters.Add(eleman.Prosedur_Adi, eleman.Prosedur_Tipi);
}
sqlCmd.Parameters[eleman.Prosedur_Adi].Value = eleman.Prosedur_YuklencekVeri;
}
sqlCmd.ExecuteNonQuery();
myConnection.Close();
}
catch (Exception ex)
{
response = false;
}
return response;
}
public void ProsedurEkle(string Prosedur_Adi, SqlDbType tip, string veri, string charuzuluk)
{ // sqldatatype ayrı al
Model model = new Model();
model.Prosedur_Adi = Prosedur_Adi;
model.Prosedur_Tipi = tip;
model.Prosedur_YuklencekVeri = veri;
model.Prosedur_Nvarcharsa_Uzunluk = charuzuluk;
arrayliststatic.Add(model);
}
}
}
--------------------------
namespace Argede_WebService.Sql_Prosodur_Otomatik
{
public class staticdegerler
{
public static string DataSource = "AHMET";
public static string Catalog = "Argede_Next_Database";
}
}
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
namespace Argede_WebService.Sql_Prosodur_Otomatik
{
public class Sql_Prosodur_DirektBaglanti
{
private List<Model> arrayliststatic = new List<Model>();
public class Model
{
public string Prosedur_Adi { get; set; }
public SqlDbType Prosedur_Tipi { get; set; }
public string Prosedur_YuklencekVeri { get; set; }
public string Prosedur_Nvarcharsa_Uzunluk { get; set; }
}
public bool Pro_Calistir(string prosedur_Adi)
{
SqlConnection myConnection = new SqlConnection("Data Source=" + staticdegerler.DataSource + ";Initial Catalog=" + staticdegerler.Catalog + ";Integrated Security=True");
bool response = true;
try
{
SqlCommand sqlCmd = new SqlCommand();
sqlCmd.Connection = myConnection;
myConnection.Open();
sqlCmd.CommandType = System.Data.CommandType.StoredProcedure;
sqlCmd.CommandText = prosedur_Adi;
foreach (Model eleman in arrayliststatic)
{
if (eleman.Prosedur_Tipi.Equals(SqlDbType.NVarChar))
{
sqlCmd.Parameters.Add(eleman.Prosedur_Adi, eleman.Prosedur_Tipi,Convert.ToInt32(eleman.Prosedur_Nvarcharsa_Uzunluk));
}
else
{
sqlCmd.Parameters.Add(eleman.Prosedur_Adi, eleman.Prosedur_Tipi);
}
sqlCmd.Parameters[eleman.Prosedur_Adi].Value = eleman.Prosedur_YuklencekVeri;
}
sqlCmd.ExecuteNonQuery();
myConnection.Close();
}
catch (Exception ex)
{
response = false;
}
return response;
}
public void ProsedurEkle(string Prosedur_Adi, SqlDbType tip, string veri, string charuzuluk)
{ // sqldatatype ayrı al
Model model = new Model();
model.Prosedur_Adi = Prosedur_Adi;
model.Prosedur_Tipi = tip;
model.Prosedur_YuklencekVeri = veri;
model.Prosedur_Nvarcharsa_Uzunluk = charuzuluk;
arrayliststatic.Add(model);
}
}
}
--------------------------
namespace Argede_WebService.Sql_Prosodur_Otomatik
{
public class staticdegerler
{
public static string DataSource = "AHMET";
public static string Catalog = "Argede_Next_Database";
}
}
4 Mayıs 2017 Perşembe
android network provider ##iyileştirilmiş sonuç almak için
https://paste.ubuntu.com/24513203/
---------------------
Wifiac();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
requestPermissions(new String[]{Manifest.permission.ACCESS_COARSE_LOCATION}, 1);
Log.e("asdasdas", "chek ilk if");
} else {
NetworkProvider();
Log.e("CurrenCalisti", "gpsCofig");
}
@Overridepublic void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
switch (requestCode) {
case 1:
// If request is cancelled, the result arrays are empty. if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
NetworkProvider();
} else {
// permission denied
}
break;
}
}
---------------
private void NetworkProvider(){
locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
return;
}
locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 100, 0, new LocationListener() {
@Override public void onLocationChanged(Location location) {
String currentLat = String.valueOf(location.getLatitude());
String currentLot = String.valueOf(location.getLongitude());
TabbedActivity._curLat =location.getLatitude();
TabbedActivity._curLng =location.getLongitude();
Log.e("Curren= ", currentLat + "," + currentLot);
}
@Override public void onStatusChanged(String s, int i, Bundle bundle) {
}
@Override public void onProviderEnabled(String s) {
}
@Override public void onProviderDisabled(String s) {
}
});
}
---------------
public void Wifiac(){
WifiManager wifiManager = (WifiManager)getSystemService(Context.WIFI_SERVICE);
boolean enabled = wifiManager.setWifiEnabled(true);
Log.e("wifiDurum", String.valueOf(enabled));
}
-----------------
C# WEB SERVİS CLAS İÇİNDE LİST TANIMLAMA #JSON
public class BayiListe
{
public Boolean Durum { get; set; }
public string BayiAdi { get; set; }
}
//////////////// MODEL
public class Kullanici_Profili
{
public string KullaniciAdi { get; set; }
public string Bölge { get; set; }
public string TelNo { get; set; }
public string Resim { get; set; }
public List<BayiListe> BayiListe = new List<BayiListe>();
}
////////////////MODEL
SqlDataReader reader = null;
SqlCommand sqlCmd = new SqlCommand();
sqlCmd.CommandType = System.Data.CommandType.StoredProcedure;
sqlCmd.CommandText = "sp_BayiListesi";
sqlCmd.Parameters.Add("@UserID", SqlDbType.Int);
sqlCmd.Parameters["@UserID"].Value = UserId;
sqlCmd.Connection = myConnection;
myConnection.Open();
reader = sqlCmd.ExecuteReader();
Kullanici_Profili model = new Kullanici_Profili();
while (reader.Read())
{
BayiListe model2 = new BayiListe();
model2.Durum = Convert.ToBoolean(reader.GetValue(0));
model2.BayiAdi = reader.GetValue(1).ToString();
model.BayiListe.Add(model2);
}
myConnection.Close();
////////////////////////
SqlDataReader reader2 = null;
SqlCommand sqlCmd2 = new SqlCommand();
sqlCmd2.CommandType = System.Data.CommandType.StoredProcedure;
sqlCmd2.CommandText = "sp_Kullanici_Profili";
sqlCmd2.Parameters.Add("@Userid", SqlDbType.Int);
sqlCmd2.Parameters["@Userid"].Value = UserId;
sqlCmd2.Connection = myConnection;
myConnection.Open();
reader2 = sqlCmd2.ExecuteReader();
while (reader2.Read())
{
model.KullaniciAdi = reader2.GetValue(0).ToString();
model.Bölge = reader2.GetValue(1).ToString();
model.TelNo = reader2.GetValue(2).ToString();
model.Resim = reader2.GetValue(3).ToString();
break;
}
myConnection.Close();
return model;
{
public Boolean Durum { get; set; }
public string BayiAdi { get; set; }
}
//////////////// MODEL
public class Kullanici_Profili
{
public string KullaniciAdi { get; set; }
public string Bölge { get; set; }
public string TelNo { get; set; }
public string Resim { get; set; }
public List<BayiListe> BayiListe = new List<BayiListe>();
}
////////////////MODEL
SqlDataReader reader = null;
SqlCommand sqlCmd = new SqlCommand();
sqlCmd.CommandType = System.Data.CommandType.StoredProcedure;
sqlCmd.CommandText = "sp_BayiListesi";
sqlCmd.Parameters.Add("@UserID", SqlDbType.Int);
sqlCmd.Parameters["@UserID"].Value = UserId;
sqlCmd.Connection = myConnection;
myConnection.Open();
reader = sqlCmd.ExecuteReader();
Kullanici_Profili model = new Kullanici_Profili();
while (reader.Read())
{
BayiListe model2 = new BayiListe();
model2.Durum = Convert.ToBoolean(reader.GetValue(0));
model2.BayiAdi = reader.GetValue(1).ToString();
model.BayiListe.Add(model2);
}
myConnection.Close();
////////////////////////
SqlDataReader reader2 = null;
SqlCommand sqlCmd2 = new SqlCommand();
sqlCmd2.CommandType = System.Data.CommandType.StoredProcedure;
sqlCmd2.CommandText = "sp_Kullanici_Profili";
sqlCmd2.Parameters.Add("@Userid", SqlDbType.Int);
sqlCmd2.Parameters["@Userid"].Value = UserId;
sqlCmd2.Connection = myConnection;
myConnection.Open();
reader2 = sqlCmd2.ExecuteReader();
while (reader2.Read())
{
model.KullaniciAdi = reader2.GetValue(0).ToString();
model.Bölge = reader2.GetValue(1).ToString();
model.TelNo = reader2.GetValue(2).ToString();
model.Resim = reader2.GetValue(3).ToString();
break;
}
myConnection.Close();
return model;
## Android Socket istemci -- LocalHost sunucu haberleşme ##Socket io ##ağ programlam odev 2
SOCKET KULLARAK ANDROİD İLE SUNUCU HABERLEŞMESİ
NOT : JAVA SQL BAGLANMAK İÇİN SQLJDBC BİLGİSAYARA KURUP PROJE İÇİNE EXTRADAN ENTEGRE EDİLMESİ LAZIM
PROJE İÇERİĞİ KODLAR
https://yadi.sk/d/RMynh4nl3HgHor
## BİTİRME PROJESİ SON AŞAMA ## SAÜ BİLGİSAYAR MÜHENDİSLİĞİ
RAPOR
Githup : Android
https://github.com/yenenahmet/bitirme/tree/master/ErasmusApp/app/src/main/java/com/example/ahmet/erasmusapp
Githup : Servis
https://github.com/yenenahmet/bitirme_servis/tree/master/Bitirme_Ekonomistler
https://github.com/yenenahmet/bitirme/tree/master/ErasmusApp/app/src/main/java/com/example/ahmet/erasmusapp
Githup : Servis
https://github.com/yenenahmet/bitirme_servis/tree/master/Bitirme_Ekonomistler
--------------------------------------------------------------------------------------------------------------------------
2 Nisan 2017 Pazar
19 Mart 2017 Pazar
sqllite
https://paste.ubuntu.com/24209958/
package com.example.ahmet.erasmusapp; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; import android.util.Log; import com.example.ahmet.erasmusapp.SQL_Veritabanı_MesajModel; import java.util.ArrayList; import java.util.List; /** * Created by Yenen on 13.3.2017. */ public class SQL_MesajVeritabanı extends SQLiteOpenHelper { private static final String DATABASE_NAME = "Mesajlar"; // Contacts table name private static final String TABLE_COUNTRIES = "ÖzelMesaj"; public SQL_MesajVeritabanı(Context context) { super(context, DATABASE_NAME, null, 2); } @Override public void onCreate(SQLiteDatabase db) { String sql = "CREATE TABLE " + TABLE_COUNTRIES + "(baskaUserid INTEGER,KullaniciAdi TEXT,Mesaj TEXT,TarihZaman TEXT" + ")"; Log.d("DBHelper", "SQL : " + sql); db.execSQL(sql); } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { db.execSQL("DROP TABLE IF EXISTS " + TABLE_COUNTRIES); onCreate(db); } public void insertCountry(SQL_Veritabanı_MesajModel sql_veritabanı_mesajModel) { SQLiteDatabase db = this.getWritableDatabase(); ContentValues values = new ContentValues(); values.put("baskaUserid", sql_veritabanı_mesajModel.getBaskaUserid()); values.put("KullaniciAdi", sql_veritabanı_mesajModel.getKullanıcıAdi()); values.put("Mesaj",sql_veritabanı_mesajModel.getMesaj()); values.put("TarihZaman",sql_veritabanı_mesajModel.getTarihZaman()); db.insert(TABLE_COUNTRIES, null, values); db.close(); } public void MesajlariSilme(int SilinecekId){ try{ SQLiteDatabase db = this.getReadableDatabase(); db.delete(TABLE_COUNTRIES,"baskaUserid"+"="+SilinecekId,null); Log.e("Veritabanısilme","Silindi"); }catch (Exception ex){ Log.e("Veritabanısilme","Hata oluştu"); } } public List<SQL_Veritabanı_MesajModel> getKullanıcıOZelmesajlarıçek(int baskaUserid) { List<SQL_Veritabanı_MesajModel> ozelmesaj = new ArrayList<SQL_Veritabanı_MesajModel>(); SQLiteDatabase db = this.getWritableDatabase(); String sqlQuery = "SELECT * FROM " + TABLE_COUNTRIES +" Where baskaUserid="+baskaUserid; Cursor cursor = db.rawQuery(sqlQuery, null); while (cursor.moveToNext()) { SQL_Veritabanı_MesajModel model = new SQL_Veritabanı_MesajModel(); model.setBaskaUserid(cursor.getInt(0)); model.setKullanıcıAdi(cursor.getString(1)); model.setMesaj(cursor.getString(2)); model.setTarihZaman(cursor.getString(3)); ozelmesaj.add(model); } return ozelmesaj; } }
Kaydol:
Kayıtlar (Atom)