Skip to content

Instantly share code, notes, and snippets.

:bowtie:
-

Kishan Vaghela Kishanjvaghela

:bowtie:
-
Block or report user

Report or block Kishanjvaghela

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View How to Use ImagePicker
private ImagePicker imagePicker;
// init
imagePicker = new ImagePicker(getActivity(), new ImageChooserListener() {
@Override
public void onImageChosen(final ChosenImage chosenImage) {
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
filePath = chosenImage.getFileThumbnail();
@Kishanjvaghela
Kishanjvaghela / ExpandableHeightGridView.java
Created Sep 12, 2015
ExpandableHeightListView and ExpandableHeightGridView
View ExpandableHeightGridView.java
import android.content.Context;
import android.util.AttributeSet;
import android.view.ViewGroup;
import android.widget.GridView;
public class ExpandableHeightGridView extends GridView {
boolean expanded = false;
public ExpandableHeightGridView(Context context) {
@Kishanjvaghela
Kishanjvaghela / CustomDatePickerDialog.java
Last active Feb 11, 2020
Set maximum date in DatePicker dialog
View CustomDatePickerDialog.java
import android.app.DatePickerDialog;
import android.content.Context;
import android.os.Build;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.DatePicker;
import java.util.Calendar;
import jp.likenote.android.R;
@Kishanjvaghela
Kishanjvaghela / prog.c
Created Feb 11, 2016
Program to print number 1..n as right triangle.
View prog.c
#include <stdio.h>
int main(void) {
int i,j,rows;
printf("Enter the nth number of series: ");
scanf("%d",&rows);
printf("\n");
for(i=1;i<=rows;++i)
{
for(j=1;j<=i;++j)
View EndlessRecyclerOnScrollListener.java
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
/**
* Created by DSK02 on 1/27/2016.
*/
public abstract class EndlessRecyclerOnScrollListener extends RecyclerView.OnScrollListener {
public static String TAG = "EndlessRecycler";
private int previousTotal = 0; // The total number of items in the dataset after the last load
View Utils.java
/**
* get android id of device.
*
* @param context app context
* @return android id
*/
public static String getAndroidID(Context context) {
if (context != null) {
return Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID);
} else {
View Add following dependencies into your gradle file
dependencies {
compile 'com.kbeanie:image-chooser-library:1.4.4@aar'
compile 'com.soundcloud.android:android-crop:1.0.1@aar'
}
View Android - onAttach(Context)
/*
* onAttach(Context) is not called on pre API 23 versions of Android and onAttach(Activity) is deprecated
* Use onAttachToContext instead
*/
@TargetApi(23)
@Override
public void onAttach(Context context) {
super.onAttach(context);
onAttachToContext(context);
}
View Age.java
public class Age {
private int days;
private int months;
private int years;
public Age(int days, int months, int years) {
this.days = days;
this.months = months;
this.years = years;
View Activity or Fragment
public class BaseActivity extends Activity implements DetectsSoftKeyboardLayout.OnSoftKeyboardListener
{
DetectsSoftKeyboardLayout rootlayout;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
rootLayout.setOnSoftKeyboardListener(this);
}
You can’t perform that action at this time.