This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MyFragment { | |
boolean loaded; | |
private void maybeLoad() { | |
if (!loaded && getUserVisibleHint()) { | |
loaded = true; | |
loadMyData(); | |
} | |
} | |
@Override |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
} | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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" |
OlderNewer