Skip to content

Instantly share code, notes, and snippets.

compile 'com.android.volley:volley:1.0.0'
compile 'com.squareup.retrofit2:retrofit:2.2.0'
compile 'com.squareup.retrofit2:converter-gson:2.2.0'
compile 'com.android.support:design:25.3.1'
compile 'com.google.code.gson:gson:2.7'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.google.android.gms:play-services-maps:10.2.1'
compile 'com.google.android.gms:play-services-location:10.2.1'
@donrokzon
donrokzon / Picasso
Last active May 15, 2017 06:28
Picasso load image
Picasso.with(context).load("http://i.imgur.com/DvpvklR.png").into(imageView);
Picasso.with(context)
.load(url)
.resize(50, 50)
.centerCrop()
.into(imageView)
Picasso.with(context)
.load(url)
NotificationManager manager;
private void createNotification() {
NotificationCompat.Builder mBuilder =
new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.notification)
.setContentTitle("My notification")
.setOngoing(true)
.setContentText("Hello World!");
Intent notificationIntent = new Intent(this, MainActivity.class);
<?php
if($_SERVER['REQUEST_METHOD']=='POST'){
$username = $_POST['username'];
$email = $_POST['email'];
$password = $_POST['password'];
define('HOST','localhost');
define('USER','root');
define('PASS','root');
<!DOCTYPE HTML>
<html>
<body>
<form method="post" action="volleyRegister.php">
Name: <input type="text" name="username"><br>
E-mail: <input type="text" name="email"><br>
Password: <input type="text" name="password"><br>
<input type="submit">
</form>
Getting JSON Response from a link.....
implementation 'com.android.volley:volley:1.1.1'
<uses-permission android:name="android.permission.INTERNET" />
if (progressDialog != null) {
progressDialog.show();
if (ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA)
== PackageManager.PERMISSION_DENIED) {
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.CAMERA}, MY_CAMERA_REQUEST_CODE);
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
if (requestCode == MY_CAMERA_REQUEST_CODE) {
@donrokzon
donrokzon / Shared Preference.java
Last active June 29, 2018 04:36
Shared Preference
SharedPreferences sharedPreferences;
SharedPreferences.Editor editor;
sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);
editor = sharedPreferences.edit();
editor.putString("ID", id);
editor.commit();
Realm realm;
Realm.init(this);
realm = Realm.getDefaultInstance();
realm.executeTransaction(new Realm.Transaction() {
@Override
public void execute(Realm realm) {
try {
final Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
//Do something after 100ms
}
}, 100);