Skip to content

Instantly share code, notes, and snippets.

View sheerazam's full-sized avatar

Sheeraz Ahmed Memon sheerazam

  • Constellation1 USA (Remote)
  • Pakistan
View GitHub Profile
class BitmapLruCache extends LruCache<String, Bitmap> implements ImageLoader.ImageCache {
public BitmapLruCache(int maxSize) {
super(maxSize);
}
@Override
protected int sizeOf(String key, Bitmap value) {
return value.getRowBytes() * value.getHeight();
}
<?xml version="1.0" encoding="utf-8"?>
<!-- The important thing to note here is the added fitSystemWindows -->
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/my_drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
>
// Add the Google Play services version to your app's manifest
// Edit your application's AndroidManifest.xml file, and add the following declaration within the <application> element. This embeds the version of Google Play services that the app was compiled with.
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
@sheerazam
sheerazam / ForSaleListLoader.java
Created April 11, 2016 09:21
Custom Loader with Gson Network Request
public class ForSaleListLoader extends AsyncTaskLoader<List<ForSale>> {
private static final String TAG = "AppointmentListLoader";
private static final boolean DEBUG = false;
// We hold a reference to the Loaders data here.
private List<ForSale> mSales;
String select;
Uri uri;
String[] projection;
String SortOrder;
@sheerazam
sheerazam / ForSaleArrayAdapter.java
Created April 11, 2016 09:23
Custom Array Adapter
public class ForSaleArrayAdapter extends ArrayAdapter<ForSale> {
Context context;
int layout;
public ForSaleArrayAdapter(Context context, List<ForSale> sales , int layout) {
super(context, 0, sales);
this.layout = layout;
this.context = context;
}
@sheerazam
sheerazam / ForSaleCursorAdapter
Created April 11, 2016 09:23
Custom Cursor Adapter
public class ForSaleCursorAdapter extends CursorAdapter {
int layout;
public ForSaleCursorAdapter(Context context, Cursor cursor, int layout) {
super(context, cursor, 0);
this.layout = layout;
}
// The newView method is used to inflate a new view and return it,
// you don't bind any data to the view at this point.
@sheerazam
sheerazam / links.txt
Created April 11, 2016 09:24
Creating Multiple Flavors of Project in Android Studio
@sheerazam
sheerazam / AppCompatVersions.txt
Created April 11, 2016 09:25
Android AppCompat Support Library Versions
https://android.googlesource.com/platform/prebuilts/maven_repo/android/+/refs/heads/master/com/android/support/appcompat-v7/maven-metadata.xml
<?xml version="1.0" encoding="UTF-8"?>
<metadata>
<groupId>com.android.support</groupId>
<artifactId>appcompat-v7</artifactId>
<version>18.0.0</version>
<versioning>
<versions>
<version>18.0.0</version>
@sheerazam
sheerazam / googleapps
Created April 11, 2016 09:25
Genymotion G-Apps Download
http://forum.xda-developers.com/showthread.php?t=2528952
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="true"
android:drawable="@drawable/cbchk_blue"
android:state_focused="false">
</item>
<item android:state_checked="true"
android:drawable="@drawable/cbchk_blue"
android:state_focused="true">
</item>