Skip to content

Instantly share code, notes, and snippets.

View RahulSDeshpande's full-sized avatar
☑️
Code • Jam • Shoot | Repeat

Rahul RahulSDeshpande

☑️
Code • Jam • Shoot | Repeat
View GitHub Profile
public class MyAsyncTask extends AsyncTask<Void, Void, Cursor> {
@Override
protected Cursor doInBackground(Void... params) {
DatabaseHelper helper = new DatabaseHelper(MainActivity.this);
return helper.getReadableDatabase().rawQuery("SELECT * FROM myTable", null);
}
@Override
@Pierry
Pierry / IsConnected.java
Created November 22, 2014 17:41
IsConnected class
public static boolean is(Context context) {
try {
ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
if (cm.getNetworkInfo(ConnectivityManager.TYPE_WIFI).isConnected()) {
return true;
} else if(cm.getNetworkInfo(ConnectivityManager.TYPE_MOBILE).isConnected()){
return true;
} else {
return false;
}
@Pierry
Pierry / android-imageview-load.java
Created February 20, 2015 17:05
image-load-from-path-android
// get download directory
File imgFile = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);
if(imgFile.exists()) {
Bitmap myBitmap = BitmapFactory.decodeFile(imgFile.getPath() + "/ovo.jpg");
ivImagem.setImageBitmap(myBitmap);
}
}
Loaded 7643 mappings
gradle/topics/gradle-signing-with-incorrect-key maps to topic 5227
gradle/topics/how_do_you_use_variables_on_the_eclipse_plugin_to_generate_the_classpath maps to topic 3175
gradle/topics/why-are-replace-tokens-and-expand-properties-not-part-of-the-inputs-of-the-copy-task maps to topic 5232
mapping missing for Showing an example of running Selenium2 WebDriver on Groovy using Gradle 245
gradle/topics/remove-native-build-tasks maps to topic 5231
gradle/topics/friendlier_way_to_customize_a_generated_pom maps to topic 4968
gradle/topics/copy_w_duplicatesstrategy_exclude_overwrites_files maps to topic 1945
mapping missing for Compile groovy with debugging information 5226
gradle/topics/can-i-tell-which-tasks-were-explicitly-run-i-e-tell-primary-tasks-from-dependencies maps to topic 5228
package robotograph;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
import android.util.AttributeSet;
@Pierry
Pierry / TypeFont.java
Last active December 18, 2015 01:39
Copy your font to assets folder
Typeface face = Typeface.createFromAsset(getAssets(), "yourfont.ttf");
@gabrielemariotti
gabrielemariotti / ListFragment.java
Last active January 1, 2016 07:29
Cardslib: Simple (raw and ugly) layouts for CardListView.It provides all custom layout for your list and your cards.
public class ListFragment extends Fragment {
//DAO datasource;
//List<Joke> values;
public ListFragment(){}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.test_fragment_list, container, false);
@ignasi
ignasi / db_getter.sh
Created January 30, 2014 11:43
Get database from an Android app (Android 4.3+)
#!/bin/bash
# Android 4.3+ changes app's internal directory permissions and you can not just pull your
# databases to your computer, so I did this as a workaround to extract my databases.
# I only use it for debug, use it under your responsability.
package=$1
db_name=$2
path="/data/data/$package/"
@jbayer
jbayer / Server.xml
Created June 7, 2012 05:09
Disable the Tomcat shutdown port.
<Server port=”-1” command=”SHUTDOWN”>
@SeanJM
SeanJM / generateId.ts
Last active September 20, 2017 14:39
A TypeScript function to generate a random ID
interface ILib {
alpha: string[],
number: string[],
symbols: string[]
}
type Key = keyof ILib;
const lib : ILib = {
alpha: [