System directories
| Method | Result |
|---|---|
| Environment.getDataDirectory() | /data |
| Environment.getDownloadCacheDirectory() | /cache |
| Environment.getRootDirectory() | /system |
External storage directories
| public static class ScaleToFitWidhtHeigthTransform implements Transformation { | |
| private int mSize; | |
| private boolean isHeightScale; | |
| public ScaleToFitWidhtHeigthTransform(int size, boolean isHeightScale){ | |
| mSize =size; | |
| this.isHeightScale = isHeightScale; | |
| } |
System directories
| Method | Result |
|---|---|
| Environment.getDataDirectory() | /data |
| Environment.getDownloadCacheDirectory() | /cache |
| Environment.getRootDirectory() | /system |
External storage directories
| package com.example; | |
| import android.content.Context; | |
| import com.squareup.okhttp.HttpResponseCache; | |
| import com.squareup.okhttp.OkHttpClient; | |
| import com.squareup.picasso.OkHttpDownloader; | |
| import com.squareup.picasso.Picasso; | |
| import javax.net.ssl.SSLContext; | |
| import java.io.File; |
| import android.content.res.Configuration; | |
| import android.os.Bundle; | |
| import android.support.v4.view.MenuItemCompat; | |
| import android.support.v4.widget.DrawerLayout; | |
| import android.support.v7.app.ActionBarActivity; | |
| import android.support.v7.app.ActionBarDrawerToggle; | |
| import android.support.v7.widget.SearchView; | |
| import android.util.Log; | |
| import android.view.Menu; | |
| import android.view.MenuItem; |
| Transformation blurTransformation = new Transformation() { | |
| @Override | |
| public Bitmap transform(Bitmap source) { | |
| Bitmap blurred = Blur.fastblur(LiveImageView.this.context, source, 10); | |
| source.recycle(); | |
| return blurred; | |
| } | |
| @Override | |
| public String key() { |
| // Slide up animation | |
| <?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android" > | |
| <translate | |
| android:duration="@android:integer/config_mediumAnimTime" | |
| android:fromYDelta="100%" | |
| android:interpolator="@android:anim/accelerate_interpolator" | |
| android:toXDelta="0" /> |
| 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); | |
| } |
| /** | |
| * A collection of authentication and account connection utilities. With strong inspiration from the Google IO session | |
| * app. | |
| * @author Dandré Allison | |
| */ | |
| public class AccountUtils { | |
| /** | |
| * Interface for interacting with the result of {@link AccountUtils#getUserProfile}. | |
| */ |
| try{ | |
| shareIntent.setAction(Intent.ACTION_SEND); | |
| //Target whatsapp: | |
| shareIntent.setPackage("com.whatsapp"); | |
| //Add text and then Image URI | |
| shareIntent.putExtra(Intent.EXTRA_TEXT, picture_text); | |
| shareIntent.putExtra(Intent.EXTRA_STREAM, imageUri); | |
| shareIntent.setType("image/jpeg"); | |
| shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); | |
| startActivity(shareIntent); |
| //Sticky Service | |
| public class StickyService extends Service | |
| { | |
| private static final String TAG = "StickyService"; | |
| @Override | |
| public IBinder onBind(Intent arg0) { | |
| // TODO Auto-generated method stub | |
| return null; |