Skip to content

Instantly share code, notes, and snippets.

View shihabmi7's full-sized avatar
🎯
Focusing

Muhammad Shihab Uddin shihabmi7

🎯
Focusing
  • Malaysia
View GitHub Profile
@shihabmi7
shihabmi7 / Application Class Multidex
Last active November 28, 2016 14:23
Multidex Enable
public class YourApplication extends Application {
@Override
protected void attachBaseContext(Context context) {
super.attachBaseContext(context);
MultiDex.install(this);
}
@Override
public void onCreate() {
super.onCreate();
@shihabmi7
shihabmi7 / gist:777bb978765d5e5de0f076947058b969
Created August 4, 2016 01:06
Edittext Ime , Hide keyboard
EditText
android:id="@+id/et_go"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:inputType="text"
android:imeOptions="actionGo"
android:hint="@string/hnt_et_go" />
@shihabmi7
shihabmi7 / AlertDialog
Last active December 15, 2016 10:10 — forked from emil2k/Connectivity.java
Android utility class for checking device's network connectivity and speed.
android.support.v7.app.AlertDialog.Builder builder1;
builder1 = new android.support.v7.app.AlertDialog.Builder(YourActivity.this);
builder1.setMessage("Please check your internet connection");
builder1.setCancelable(true);
builder1.setPositiveButton("Yes",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
});
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
@shihabmi7
shihabmi7 / get-the-sha1-fingerprint-certificate
Last active June 23, 2016 04:47
Map Keystore : get-the-sha1-fingerprint-certificate
# Step 1: Go to your java bin directory via the cmd:
C:\Program Files\Java\jdk1.7.0_71\bin>
# Step 2: Now type in the below command in your cmd:
keytool -list -v -keystore c:\users\your_user_name.android\debug.keystore -alias androiddebugkey -storepass android -keypass android
example:
@shihabmi7
shihabmi7 / Action Bar Heads Up Display
Created June 23, 2016 04:45
Action Bar Heads Up Display: Check Home Page & Set Back Button
ActionBar mActionBar = getSupportActionBar();
// checking either this is home actiivty or not for
// ActionBar.DISPLAY_HOME_AS_UP
if (this.getClass().getSimpleName()
.equalsIgnoreCase(RestaurentListActivity.class.getSimpleName())) {
mActionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE
| ActionBar.DISPLAY_SHOW_CUSTOM
| ActionBar.DISPLAY_SHOW_HOME);
} else {
@shihabmi7
shihabmi7 / Avoid starting activity which is already in stack
Created June 23, 2016 04:44
Avoid starting activity which is already in stack?
android:launchMode="singleInstance"
# add this to your activity
@shihabmi7
shihabmi7 / Text Marquee
Created June 23, 2016 04:42
Text Marquee
<TextView
android:id="@+id/textView_News_HeadLine"
style="@style/black_extra_large_heading_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="8dp"
android:ellipsize="marquee"
android:marqueeRepeatLimit="-1"
android:singleLine="true"
byte[] convertBitMapToByteArray(Bitmap bmp) {
ByteArrayOutputStream stream = new ByteArrayOutputStream();
bmp.compress(Bitmap.CompressFormat.PNG, 100, stream);
byte[] byteArray = stream.toByteArray();
return byteArray;
}
@shihabmi7
shihabmi7 / ImagePicker.java
Created May 29, 2016 05:18 — forked from Mariovc/ ImagePicker.java
Utility for picking an image from Gallery/Camera with Android Intents
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ResolveInfo;
import android.content.res.AssetFileDescriptor;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Matrix;
import android.media.ExifInterface;