android studio get shared preferences

Yazmak için

if(jsonResult == 1){
Intent intent = new Intent(MainActivity.this, LoginActivity.class); intent.putExtra("USERNAME", enteredUsername); intent.putExtra("MESSAGE", "You have been successfully login");
SharedPreferences userDetails = getApplicationContext().getSharedPreferences("kullanicibilgisi", MODE_PRIVATE); SharedPreferences.Editor edit = userDetails.edit(); edit.clear(); edit.putString("kullaniciadi", username.getText().toString()); edit.putString("parola", password.getText().toString()); edit.commit();

okumak için

protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); setContentView(R.layout.activity_main);
SharedPreferences userDetails = getSharedPreferences("kullanicibilgisi", MODE_PRIVATE); String test1 = userDetails.getString("kullaniciadi", ""); String test2 = userDetails.getString("parola", ""); Toast.makeText(getApplicationContext(), test1, Toast.LENGTH_LONG).show(); Toast.makeText(getApplicationContext(), test2, Toast.LENGTH_LONG).show();

php gmail yolla

Önce gmailinde bu özelliği aktif et https://accounts.google.com/DisplayUnlockCaptcha

 

daha sonra burdan php maileri indir https://github.com/PHPMailer/PHPMailer/ ve ftpne at

mail yollamak php kodları aşağıdadır

 

<?php
date_default_timezone_set('America/Toronto');
require 'PHPMailerAutoload.php';
require_once('class.phpmailer.php');
//include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded

$mail             = new PHPMailer();

$body             = "gdssdh";
//$body             = eregi_replace("[\]",'',$body);

$mail->IsSMTP(); // telling the class to use SMTP
$mail->Host       = "ssl://smtp.gmail.com"; // SMTP server
$mail->SMTPDebug  = 1;                     // enables SMTP debug information (for testing)
                                           // 1 = errors and messages
                                           // 2 = messages only
$mail->SMTPAuth   = true;                  // enable SMTP authentication
$mail->SMTPSecure = "tls";                 // sets the prefix to the servier
$mail->Host       = "smtp.gmail.com";      // sets GMAIL as the SMTP server
$mail->Port       = 587;                   // set the SMTP port for the GMAIL server
$mail->Username   = "sender@gmail.com";  // GMAIL username
$mail->Password   = "senderpass";            // GMAIL password

$mail->SetFrom('receiver@gmail.com', 'PRSPS');

//$mail->AddReplyTo("receiver2@gmail.com', 'First Last");

$mail->Subject    = "PRSPS password";

//$mail->AltBody    = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test

$mail->MsgHTML($body);

$address = "receiver@gmail.com";
$mail->AddAddress($address, "user2");

//$mail->AddAttachment("images/phpmailer.gif");      // attachment
//$mail->AddAttachment("images/phpmailer_mini.gif"); // attachment

if(!$mail->Send()) {
  echo "Mailer Error: " . $mail->ErrorInfo;
} else {
  echo "Message sent!";
}

?>

android studio shared preferences

Define some statics to store the preference file name and the keys you’re going to use:
public static final String PREFS_NAME = "MyPrefsFile";
private static final String PREF_USERNAME = "username";
private static final String PREF_PASSWORD = "password";
You’d then save the username and password as follows:
getSharedPreferences(PREFS_NAME,MODE_PRIVATE)
.edit()
.putString(PREF_USERNAME, username)
.putString(PREF_PASSWORD, password)
.commit();
So you would retrieve them like this:
SharedPreferences pref = getSharedPreferences(PREFS_NAME,MODE_PRIVATE);   
String username = pref.getString(PREF_USERNAME, null);
String password = pref.getString(PREF_PASSWORD, null);

if (username == null || password == null) {
//Prompt for username and password
}
Alternatively, if you don’t want to name a preferences file you can just use the default:
SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(this);

android studio php json tips

android studioda php kullanırken notepad++da encoding in utf-8 olması gerekir bomsuz olması gerekir.
phpde jsonda dönen degerde turkce karakter hatalıysa

<?php
header(‘Content-Type: text/html; charset=utf-8’);
require_once(“baglan.php”);//database bağlantısı gercekleştirdik
………….

….

echo utf8_encode(json_encode($cevap));// json verisini yazdırdık
}else{
echo “Giriş Engellendi”;
}
?>

httpclient and HttpURLConnection

                    HttpClient httpclient = new DefaultHttpClient();
                    HttpPost httppost = new HttpPost(“http://192.168.43.94/spinner.php&#8221;);
                    HttpResponse response = httpclient.execute(httppost);
                    is = entity.getContent();
                    Log.e(“Fail 1”, “3”);

——————————–

                    URL url = new URL(“http://192.168.43.94/spinner.php&#8221;);
                    urlConnection = (HttpURLConnection) url.openConnection();
                    urlConnection.connect();
                    is = urlConnection.getInputStream();

apk inspector

İnstalling firstt 
Windows:

  1. Download Windows wrapper script (Right click, Save Link As apktool.bat)
  2. Download apktool-2 (find newest here)
  3. Rename downloaded jar to apktool.jar
  4. Move both files (apktool.jar & apktool.bat) to your Windows directory (Usually C://Windows)
  5. If you do not have access to C://Windows, you may place the two files anywhere then add that directory to your Environment Variables System PATH variable.
  6. Try running apktool via command prompt

then put in same directory the apk u want to decompile and
run cmd and go to directory a.apk
and apktool if a.apk
and apktool d a.apk d:\a\decompiledapk

ANDROID STUDIO ARRAY LIST

public class RemindersActivity extends ActionBarActivity {
private ListView mListView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_reminders);
mListView = (ListView) findViewById(R.id.reminders_list_view);
//The arrayAdatper is the controller in our
//model-view-controller relationship. (controller)
ArrayAdapter arrayAdapter = new ArrayAdapter(
//context
this,
//layout (view)
R.layout.reminders_row,
//row (view)
R.id.row_text,
//data (model) with bogus data to test our listview
new String[]{“first record”, “second record”, “third record”});
mListView.setAdapter(arrayAdapter);
}
//