Skip to content

Instantly share code, notes, and snippets.

Avatar
💻
Working

Parth Patel ParryPatel021

💻
Working
View GitHub Profile
View HelperFunctions.java
/**
* Get Image Uri from Image Bitmap
* @param inContext
* @param inImage
* @return Uri
*/
public Uri getImageUri(Context inContext, Bitmap inImage) {
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
inImage.compress(Bitmap.CompressFormat.JPEG, 100, bytes);
String path = MediaStore.Images.Media.insertImage(inContext.getContentResolver(), inImage, "NewsImage", null);
@ParryPatel021
ParryPatel021 / AppHelper.java
Created Sep 26, 2018 — forked from anggadarkprince/AppHelper.java
Upload file with Multipart Request Volley Android
View AppHelper.java
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import java.io.ByteArrayOutputStream;
/**
* Sketch Project Studio
* Created by Angga on 12/04/2016 14.27.
*/
public class AppHelper {
View DecodePoly.java
//Calling decodePoly
String polyline = (String)((JSONObject)((JSONObject)jSteps.get(k)).get("polyline")).get("points");
List<LatLng> list = decodePoly(polyline);
/*
where "polyline" & "points" are JSON key return from GoogleMap URl.
*/
// deocdePoly implementation
private List<LatLng> decodePoly(String encoded) {
@ParryPatel021
ParryPatel021 / checkInternetConnectionInAndroid.java
Created Jul 20, 2018
Check internet connection in android.
View checkInternetConnectionInAndroid.java
//This method will return true if internet available else return false.
public static boolean checkInternetConnection(Context mContext) {
ConnectivityManager connection = (ConnectivityManager) mContext.getSystemService(CONNECTIVITY_SERVICE);
if (connection != null) {
if (connection.getNetworkInfo(0).getState() == NetworkInfo.State.CONNECTED ||
connection.getNetworkInfo(0).getState() == NetworkInfo.State.CONNECTING ||
connection.getNetworkInfo(1).getState() == NetworkInfo.State.CONNECTED ||
connection.getNetworkInfo(1).getState() == NetworkInfo.State.CONNECTING) {
return true;
} else if (connection.getNetworkInfo(0).getState() == NetworkInfo.State.DISCONNECTED ||
@ParryPatel021
ParryPatel021 / getDateRange.php
Last active Jul 20, 2018
Retrieve Date range from start date to end date in an Array format.
View getDateRange.php
<?php
//Function calling
$dateRange=getDatesFromRange("2018-07-20", "2018-08-05", $format = 'Y-m-d')
//Function body
private function getDatesFromRange($start, $end, $format = 'Y-m-d')
{
$array = array();
$interval = new DateInterval('P1D');
@ParryPatel021
ParryPatel021 / hideShowFloatingbutton.java
Last active Jul 20, 2018
Hide and show Floating button based on scrolling of RecyclerView.
View hideShowFloatingbutton.java
import android.support.design.widget.FloatingActionButton;
import android.support.v7.widget.RecyclerView;
// View Declaration and initialization.
private FloatingActionButton floatingAddButton = view.findViewById(R.id.floatingAddButton);
private RecyclerView recyclerBookSeats = view.findViewById(R.id.recyclerBookSeats);
// Implementation of scrolling with Floating button hide & show.
recyclerBookSeats.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
@ParryPatel021
ParryPatel021 / build.gradle (Module : app)
Created Apr 4, 2018 — forked from jaisonfdo/build.gradle (Module : app)
It helps you to Automatically Sign Your APK using build.gradle in Android Studio. For more information, check out my detailed guide here : http://droidmentor.com/sign-apk-automatically/
View build.gradle (Module : app)
apply plugin: 'com.android.application'
ext.majorVersion = 1
ext.minorVersion = 0
ext.patchVersion = 1
ext.preRelease = "Alpha"
ext.minSdkVersion = 16
android {
You can’t perform that action at this time.