Skip to content

Instantly share code, notes, and snippets.

View kuraydev's full-sized avatar
❤️‍🔥
Working Hard

Kuray kuraydev

❤️‍🔥
Working Hard
View GitHub Profile
@kuraydev
kuraydev / Fitting full scale an image in RecyclerView
Created January 4, 2016 16:49
In RecyclerView, using setImageResource, sometimes does not fit full scale an image, so this is the solution ! :)
//Fitting full view of an image
imageView.setImageResource(R.drawable.deadpool);
imageView.setScaleType(ImageView.ScaleType.FIT_XY);
@kuraydev
kuraydev / Fitting full scale an image in RecyclerView
Created January 4, 2016 17:15
In RecyclerView, using setImageResource, sometimes does not fit full scale an image, so this is the solution ! :) Raw
holder.imageView.setImageResource(R.drawable.deadpool);
holder.imageView.setScaleType(ImageView.ScaleType.FIT_XY);
@kuraydev
kuraydev / Closing Pop-Keyboard
Created January 7, 2016 21:39
Prevent & Close pop-keyboard immediately
//Preventing & Closing Pop-Keyboard Immediately
InputMethodManager inputManager = (InputMethodManager)
getSystemService(Context.INPUT_METHOD_SERVICE);
inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(),
InputMethodManager.HIDE_NOT_ALWAYS);
@kuraydev
kuraydev / How to get current day
Created January 9, 2016 21:36
This is how to get current day
Calendar calendar = Calendar.getInstance();
int day = calendar.get(Calendar.DAY_OF_WEEK);
switch (day){
case Calendar.SUNDAY:
//Your code
break;
case Calendar.MONDAY:
//Your code
@kuraydev
kuraydev / Current Date by Formatting
Created January 9, 2016 21:37
Format the current date
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
String now = df.format(new Date());
@kuraydev
kuraydev / decimalValueFormatting.md
Last active March 26, 2020 08:36
How to set a decimal value formatting into a TextView on Android? Article: https://freakycoder.com/android-notes-14-decimal-value-formatting-31cbb6a3466e
// Float and double is working with this code
float average = 9.333333333f;
double average_d = 9.55555555;
tv.setText(new DecimalFormat("##.##").format(average));
tv.setText(new DecimalFormat("##.##").format(average_d));
@kuraydev
kuraydev / How to vibrate device
Created January 21, 2016 14:02
How to vibrate device on Android
Vibrator v = (Vibrator) this.getApplicationContext().getSystemService(Context.VIBRATOR_SERVICE);
// Vibrate for 1000 milliseconds
v.vibrate(1000);
@kuraydev
kuraydev / BitMap Decoding Image
Created January 21, 2016 15:13
BitMap decoding the certain image
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
/**
* Created by FreakyCoder on 06/10/15.
*/
public class BitMap {
@kuraydev
kuraydev / Example of AsyncTask Pojo
Created January 24, 2016 23:23
Example of AsyncTask Pojo
/**
* Created by freakycoder on 21/01/16.
*/
public class MyTaskParams {
String method;
String username;
String password;
String email;
String gender;
@kuraydev
kuraydev / Example of AsyncTask with multiple parameters
Created January 24, 2016 23:33
Example of AsyncTask with multiple parameters
/**
* Created by freakycoder on 21/01/16.
*/
public class BackgroundTask extends AsyncTask<MyTaskParams,Void,String> {
Context context;
public BackgroundTask(Context context) {