Skip to content

Instantly share code, notes, and snippets.

View fida1989's full-sized avatar
😀
Hello World!

Fida Muntaseer fida1989

😀
Hello World!
View GitHub Profile
package com.discoverbangladesh.utils;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.ArrayList;
import android.content.Context;
import android.database.Cursor;
public class AnimatedActivity extends Activity
{
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
//opening transition animations
overridePendingTransition(R.anim.activity_open_translate,R.anim.activity_close_scale);
}
public class MyFragment {
boolean loaded;
private void maybeLoad() {
if (!loaded && getUserVisibleHint()) {
loaded = true;
loadMyData();
}
}
@Override
package com.emil.android.util;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.telephony.TelephonyManager;
/**
* Check device's network connectivity and speed
* @author emil http://stackoverflow.com/users/220710/emil
@fida1989
fida1989 / README
Created August 10, 2017 13:32 — forked from MarsVard/README
android drawable to imitate google cards.
put card.xml in your drawables directory, put colors.xml in your values directory or add the colors to your colors.xml file.
set the background of a view to card,
as you can see in card.xml the drawable handles the card margin, so you don't have to add a margin to your view
``` xml
<View
android:layout_width="fill_parent"
@fida1989
fida1989 / colors.xml
Last active November 3, 2017 10:19
Android color resource xml.
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="White">#ffffff</color>
<color name="Ivory">#fffff0</color>
<color name="LightYellow">#ffffe0</color>
<color name="Yellow">#ffff00</color>
<color name="Snow">#fffafa</color>
<color name="FloralWhite">#fffaf0</color>
<color name="LemonChiffon">#fffacd</color>
<color name="Cornsilk">#fff8dc</color>
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder
.setMessage("Are you sure?")
.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
// Yes-code
}
})
@fida1989
fida1989 / MainActivity.java
Last active November 21, 2017 16:28
Reading text file from sdcard
package com.hungrydroid.textread;
import android.Manifest;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.os.Environment;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
public String getCardPath() {
String removableStoragePath = "";
File fileList[] = new File("/storage/").listFiles();
for (File file : fileList) {
if (!file.getAbsolutePath().equalsIgnoreCase(Environment.getExternalStorageDirectory().getAbsolutePath()) && file.isDirectory() && file.canRead()) {
removableStoragePath = file.getAbsolutePath();
}
}
return removableStoragePath;
@fida1989
fida1989 / shadow.xml
Created January 14, 2018 06:10 — forked from lecho/shadow.xml
Android shadow drawable xml.
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<!-- Drop Shadow Stack -->
<item>
<shape>
<padding
android:bottom="1dp"
android:left="1dp"
android:right="1dp"