// 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));
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Fitting full view of an image | |
| imageView.setImageResource(R.drawable.deadpool); | |
| imageView.setScaleType(ImageView.ScaleType.FIT_XY); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| holder.imageView.setImageResource(R.drawable.deadpool); | |
| holder.imageView.setScaleType(ImageView.ScaleType.FIT_XY); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Preventing & Closing Pop-Keyboard Immediately | |
| InputMethodManager inputManager = (InputMethodManager) | |
| getSystemService(Context.INPUT_METHOD_SERVICE); | |
| inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), | |
| InputMethodManager.HIDE_NOT_ALWAYS); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd"); | |
| String now = df.format(new Date()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Vibrator v = (Vibrator) this.getApplicationContext().getSystemService(Context.VIBRATOR_SERVICE); | |
| // Vibrate for 1000 milliseconds | |
| v.vibrate(1000); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import android.content.res.Resources; | |
| import android.graphics.Bitmap; | |
| import android.graphics.BitmapFactory; | |
| /** | |
| * Created by FreakyCoder on 06/10/15. | |
| */ | |
| public class BitMap { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Created by freakycoder on 21/01/16. | |
| */ | |
| public class MyTaskParams { | |
| String method; | |
| String username; | |
| String password; | |
| String email; | |
| String gender; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Created by freakycoder on 21/01/16. | |
| */ | |
| public class BackgroundTask extends AsyncTask<MyTaskParams,Void,String> { | |
| Context context; | |
| public BackgroundTask(Context context) { |