Muennighoff/xP3x-sample huggingface dataset:
inputs: Given the following code:
mView.setOnTouchListener(new OnTouchListener() {
    @Override
    public boolean onTouch(View v, MotionEvent event) {
        //show dialog here
        return false;
    }
});
Describe it:
targets: How do I detect touch input on the Android
inputs: Description:
How to return to home screen from Activity

Implementation:
targets: Intent intent = new Intent(Intent.ACTION_MAIN);
    intent.addCategory(Intent.CATEGORY_HOME);
    startActivity(intent);
inputs: Given the following code:
map.setMyLocationEnabled(true);
map.getUiSettings().setMyLocationButtonEnabled(false);
Describe it:
targets: Disable center button in MyLocation at Google Map API V2
inputs: Given the following code:
yourTextView.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0);
yourTextView.setText("The Text You Need In There");
Describe it:
targets: How to remove drawableleft
inputs: Description:
(Retrofit) Could not locate converter for class crashing app

Implementation:
targets: Retrofit retrofit = new Retrofit.Builder()
            .baseUrl(Constants.API_BASE_URL)
            .addConverterFactory(GsonConverterFactory.create())
            .build();
inputs: Description:
Crashlytics deprecated method disabled()

Implementation:
targets: CrashlyticsCore core = new CrashlyticsCore.Builder().disabled(BuildConfig.DEBUG).build();
Fabric.with(this, new Crashlytics.Builder().core(core).build());
inputs: Given the following code:
mSwipeRefreshLayout.post(new Runnable() {
        @Override
        public void run() {
            mSwipeRefreshLayout.setRefreshing(true);
        }
    });
Describe it:
targets: SwipeRefreshLayout trigger programmatically
inputs: Description:
make a phone call click on a button

Implementation:
targets: Intent callIntent = new Intent(Intent.ACTION_CALL);
    callIntent.setData(Uri.parse("tel:123456789"));
    startActivity(callIntent);
inputs: Given the following code:
File f = context.getDatabasePath(dbName);
long dbSize = f.length();
Describe it:
targets: How to get the current sqlite database size or package size in Android?
inputs: Description:
Disable ScrollView Programmatically?

Implementation:
targets: scrollView.setOnTouchListener(new View.OnTouchListener() {

    @Override
    public boolean onTouch(View v, MotionEvent event) {
      // TODO Auto-generated method stub
      return isBlockedScrollView;
    }
  });
inputs: Given the following code:
  int today  = calendar.get(Calendar.DAY_OF_WEEK);
  boolean isWeekend = (today == Calendar.SUNDAY) || (today == Calendar.SATURDAY);
  if(isWeekend && noWeekends == true) {
        //Alarm is not wanted on the weekend
        try {
            Thread.sleep(1);  
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
Describe it:
targets: Prevent repeating alarm from occurring on weekend
inputs: Description:
How to access drawable resources (color) in java

Implementation:
targets: myButton.setBackgroundColor(Color.parseColor("#RRGGBB"));
inputs: Description:
How to ignore accent in SQLite query (Android)

Implementation:
targets: String asciiName = Normalizer.normalize(unicodeName, Normalizer.Form.NFD)
    .replaceAll("[^\\p{ASCII}]", "");
inputs: Given the following code:
@Override
public int getItemPosition(Object object) {
    return POSITION_NONE;
}
Describe it:
targets: Destroy Pages on ViewPager and FragmentStatePagerAdapter
inputs: Description:
How to blur background images in Android

Implementation:
targets: Blurry.with(context)
  .radius(10)
  .sampling(8)
  .color(Color.argb(66, 255, 255, 0))
  .async()
  .onto(rootView);
inputs: Given the following code:
String s = "Line 1"
           + System.getProperty ("line.separator")
           + "Line 2"
           + System.getProperty ("line.separator");
Describe it:
targets: How to add a line break in an Android TextView?
inputs: Given the following code:
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(editTextField.getWindowToken(), 0);
Describe it:
targets: How to clear focus and remove keyboard on Android?
inputs: Given the following code:
if (disableButtonFlag) {
    menu.findItem(R.id.your_item).setEnabled(false);
} else {
    menu.findItem(R.id.your_item).setEnabled(true);
}
Describe it:
targets: Disable Action Bar button in Android
inputs: Given the following code:
browserInt.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP|
                    Intent.FLAG_ACTIVITY_SINGLE_TOP);
Describe it:
targets: onNewIntent is not called
inputs: Description:
How to call a .NET Webservice from Android using KSOAP2?

Implementation:
targets: SoapPrimitive result = (SoapPrimitive)envelope.getResponse();
String strRes = result.toString();
inputs: Given the following code:
LocationManager mgr = 
(LocationManager)getActivity().getSystemService(Context.LOCATION_SERVICE);
Describe it:
targets: How to get a reference to LocationManager inside a Fragment
inputs: Given the following code:
if (locationManager != null) {
    if (checkSelfPermission(Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED
            || checkSelfPermission(Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
        locationManager.removeUpdates(GPSListener.this);
    }
}
Describe it:
targets: Location Manager remove updates permission
inputs: Given the following code:
Intent goToNextActivity = new Intent(getApplicationContext(), YourNewClass.class);
startActivity(goToNextActivity);
Describe it:
targets: Moving from One activity to next in Android
inputs: Description:
Android Center text on canvas

Implementation:
targets: int xPos = (canvas.getWidth() / 2);
 int yPos = (int) ((canvas.getHeight() / 2) - ((textPaint.descent() + textPaint.ascent()) / 2)) ; 
 //((textPaint.descent() + textPaint.ascent()) / 2) is the distance from the baseline to the center.

 canvas.drawText("Hello", xPos, yPos, textPaint);
inputs: Given the following code:
getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE,
                           WindowManager.LayoutParams.FLAG_SECURE);
Describe it:
targets: How to prevent Screen Capture in Android
inputs: Description:
Disable center button in MyLocation at Google Map API V2

Implementation:
targets: map.setMyLocationEnabled(true);
map.getUiSettings().setMyLocationButtonEnabled(false);
inputs: Given the following code:
Intent callIntent = new Intent(Intent.ACTION_CALL);
callIntent.setData(Uri.parse("tel:123456789"));
startActivity(callIntent);
Describe it:
targets: android: How to call the number by android application
inputs: Description:
Close/hide the Android Soft Keyboard

Implementation:
targets: // Check if no view has focus:
View view = this.getCurrentFocus();
if (view != null) {   InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);  imm.hideSoftInputFromWindow(view.getWindowToken(), 0);}
inputs: Description:
When do we use the recyclerView.setHasFixedSize?

Implementation:
targets: RecyclerView recyclerView = (RecyclerView) findViewById(R.id.list);
recyclerView.setHasFixedSize(true);
inputs: Description:
How to get accent color programmatically?

Implementation:
targets: private int fetchAccentColor() {
    TypedValue typedValue = new TypedValue();

    TypedArray a = mContext.obtainStyledAttributes(typedValue.data, new int[] { R.attr.colorAccent });
    int color = a.getColor(0, 0);

    a.recycle();

    return color;
}
inputs: Given the following code:
setCustomAnimations(R.anim.enter_from_left, R.anim.enter_from_left,
        R.anim.exit_to_left, R.anim.exit_to_left);
Describe it:
targets: Android pop fragment from backstack with animation
inputs: Description:
android webview.loadUrl won't load another webpage

Implementation:
targets: myWebView.post(new Runnable() {
    @Override
    public void run() {
        webviewLoadURL("file:///android_asset/test1.html");
    }
});
inputs: Description:
What should I pass for root when inflating a layout to use for a MenuItem's ActionView?

Implementation:
targets: public MenuItem setActionView(int resId) {
    final Context context = mMenu.getContext();
    final LayoutInflater inflater = LayoutInflater.from(context);
    setActionView(inflater.inflate(resId, new LinearLayout(context), false));
    return this;
}
inputs: Given the following code:
public void onDestroy() {
        super.onDestroy();
        android.os.Process.killProcess(android.os.Process.myPid());
    }
Describe it:
targets: How to kill my own Activity - the hard way
inputs: Given the following code:
webSettings.setAllowFileAccessFromFileURLs(true);
webSettings.setAllowUniversalAccessFromFileURLs(true);
Describe it:
targets: Framework7 inside webview pages not loading
inputs: Given the following code:
// Calculate ActionBar height
TypedValue tv = new TypedValue();
if (getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true))
{
    actionBarHeight = TypedValue.complexToDimensionPixelSize(tv.data,getResources().getDisplayMetrics());
}
Describe it:
targets: How to get the ActionBar height?
inputs: Given the following code:
textcontent.setText(Html.fromHtml(item.get_text()));
textcontent.setAutoLinkMask(Linkify.WEB_URLS);
Describe it:
targets: Android: How can I add HTML links inside a ListView?
inputs: Given the following code:
intentForMcuService.setComponent(new ComponentName("com.admetric.modemwatcher",
        "com.admetric.modemwatcher.ModemWatcherService"));
Describe it:
targets: Binding to a service from another app
inputs: Given the following code:
LayoutInflater inflater = (LayoutInflater)getApplicationContext().getSystemService
 (Context.LAYOUT_INFLATER_SERVICE);
View view = inflater.inflate(R.layout.new_layout,null);
main.addView(view);
Describe it:
targets: How to Inflate view from XML in Android?
inputs: Given the following code:
System.setProperty(
    "dexmaker.dexcache",
    getInstrumentation().getTargetContext().getCacheDir().getPath());
Describe it:
targets: Mockito + Dexmaker on Android
inputs: Given the following code:
PendingIntent.getBroadcast(context, 0, intent, 
                           PendingIntent.FLAG_UPDATE_CURRENT).cancel();
Describe it:
targets: Cancelling a PendingIntent
inputs: Description:
Triggering event when Button is pressed down in Android

Implementation:
targets: button.setOnTouchListener(new OnTouchListener() {

  @Override
  public boolean onTouch(View v, MotionEvent event) {
   // TODO Auto-generated method stub
   return false;
  }
  });
inputs: Given the following code:
getWindow().setSoftInputMode(
    WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
Describe it:
targets: OnScreen keyboard opens automatically when Activity starts
inputs: Given the following code:
if ((getResources().getConfiguration().screenLayout & 
  Configuration.SCREENLAYOUT_SIZE_MASK) == 
    Configuration.SCREENLAYOUT_SIZE_LARGE) {
  // on a large screen device ...

}
Describe it:
targets: How to determine device screen size category (small, normal, large, xlarge) using code?
inputs: Given the following code:
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                     WindowManager.LayoutParams.FLAG_FULLSCREEN);
Describe it:
targets: How to disable status bar / notification bar on android programmatically?
inputs: Given the following code:
statePagerAdapter = new FragmentStatePagerAdapter(fragmentManager) {
  @Override
  public CharSequence getPageTitle(int position) {
    return "Title Here";
  }
};
Describe it:
targets: Adding titles to ViewPager
inputs: Given the following code:
myVideoView.setOnPreparedListener(new OnPreparedListener() {

        @Override
        public void onPrepared(MediaPlayer mp) {
            // TODO Auto-generated method stub
            mp.setLooping(true);

        }
    });
Describe it:
targets: Android VideoView repetition
inputs: Given the following code:
String newUA= "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.4) Gecko/20100101 Firefox/4.0";
 mWebView.getSettings().setUserAgentString(newUA);
Describe it:
targets: Setting WebView to view Desktop Site and Not Mobile Site
inputs: Description:
How do I prevent Android taking a screenshot when my app goes to the background?

Implementation:
targets: if(android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) {
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE);
}
inputs: Given the following code:
ArrayAdapter<String> karant_adapter = new ArrayAdapter<String>(this,
     android.R.layout.simple_spinner_item, return_likes);
Describe it:
targets: Android Spinner using ArrayList<String>
inputs: Description:
How to disable cache in android webview?

Implementation:
targets: mWebView.getSettings().setAppCacheEnabled(false);
        mWebView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
inputs: Description:
Height of statusbar?

Implementation:
targets: public int getStatusBarHeight() {
   int result = 0;
   int resourceId = getResources().getIdentifier("status_bar_height", "dimen", "android");
   if (resourceId > 0) {
      result = getResources().getDimensionPixelSize(resourceId);
   }
   return result;
}
inputs: Description:
Android 4.4 translucent Status and Navigation bars style on Android 5.0

Implementation:
targets: getWindow().getDecorView().setSystemUiVisibility(
        View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
inputs: Description:
MPAndroidChart: bottom x-axis and multiple y-axes

Implementation:
targets: XAxis xAxis = chart.getXAxis();
xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
inputs: Description:
How to push recylerView up when keyboard appear?

Implementation:
targets: mRecyclerView.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
 @Override

public void onLayoutChange(View v, int left, int top, int right,int bottom, int oldLeft, int oldTop,int oldRight, int oldBottom)
{

mRecyclerView.scrollToPosition(mMessages.size()-1);

}
    });
inputs: Description:
Email and phone Number Validation in android

Implementation:
targets: android.util.Patterns.EMAIL_ADDRESS.matcher(input).matches();
android.util.Patterns.PHONE.matcher(input).matches();
inputs: Given the following code:
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(myEditText.getWindowToken(), 0);
Describe it:
targets: Android dismiss keyboard
inputs: Given the following code:
getActivity().setResult(Activity.RESULT_OK, intent);
getActivity().finish();
Describe it:
targets: Android: setResult not working
inputs: Given the following code:
// The original URLSpan needs to be removed to block the behavior of browser opening
    strBuilder.removeSpan(span);
Describe it:
targets: The onClick() of ClickableSpan is not working for URLSpan?
inputs: Description:
Disable WebView touch events in Android

Implementation:
targets: mWebView.setOnTouchListener(new View.OnTouchListener() {
    @Override
    public boolean onTouch(View v, MotionEvent event) {
        return true;
    }
});
inputs: Description:
How to edit or create custom error page for WebView?

Implementation:
targets: myWebView.setWebViewClient(new WebViewClient() {
    public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
        myWebView.loadUrl("file:///android_asset/custom_url_error.htm");

    }
});
inputs: Given the following code:
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("market://details?id=com.example.android"));
startActivity(intent);
Describe it:
targets: Android: Special url to open Marketplace to a specific app?
inputs: Description:
How to Share Entire Android App with Share Intent

Implementation:
targets: Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_TEXT,
    "Hey check out my app at: https://play.google.com/store/apps/details?id=com.google.android.apps.plus");
sendIntent.setType("text/plain");
startActivity(sendIntent);
inputs: Description:
Soft keyboard enter key event handle

Implementation:
targets: if (keyCode == KeyEvent.KEYCODE_ENTER && event.getAction() == KeyEvent.ACTION_DOWN) {
    Log.d(TAG, "enter_key_called");
}
inputs: Given the following code:
Intent startMain = new Intent(Intent.ACTION_MAIN);
startMain.addCategory(Intent.CATEGORY_HOME);
startMain.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(startMain);
Describe it:
targets: How to minimize whole application in android?
inputs: Description:
Height of status bar in Android

Implementation:
targets: public int getStatusBarHeight() {
    int result = 0;
    int resourceId = getResources().getIdentifier("status_bar_height", "dimen", "android");
    if (resourceId > 0) {
        result = getResources().getDimensionPixelSize(resourceId);
    }
    return result;
}
inputs: Given the following code:
JsonObjectRequest jsonObjReq = new JsonObjectRequest();
jsonObjReq.setRetryPolicy(new DefaultRetryPolicy(
    0,
    DefaultRetryPolicy.DEFAULT_MAX_RETRIES,
    DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
Describe it:
targets: Android volley sending data twice
inputs: Description:
Open Twitter application user profile from Android application

Implementation:
targets: try {
   startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("twitter://user?screen_name=" + twitter_user_name)));
}catch (Exception e) {
   startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://twitter.com/#!/" + twitter_user_name)));
}
inputs: Given the following code:
public boolean isRecyclerScrollable(RecyclerView recyclerView) {
    return recyclerView.computeHorizontalScrollRange() > recyclerView.getWidth() || recyclerView.computeVerticalScrollRange() > recyclerView.getHeight();
}
Describe it:
targets: Check if RecyclerView is scrollable
inputs: Given the following code:
NetworkInfo ni = cm.getActiveNetworkInfo();
if (ni == null) {
    // There are no active networks.
    return false;
}
Describe it:
targets: How can i check whether an android device is connected to the web?
inputs: Description:
Prevent repeating alarm from occurring on weekend

Implementation:
targets: int today  = calendar.get(Calendar.DAY_OF_WEEK);
  boolean isWeekend = (today == Calendar.SUNDAY) || (today == Calendar.SATURDAY);
  if(isWeekend && noWeekends == true) {
        //Alarm is not wanted on the weekend
        try {
            Thread.sleep(1);  
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
inputs: Given the following code:
if (mGoogleApiClient != null && mGoogleApiClient.isConnected()) {
   // signed in. Show the "sign out" button and explanation.
   // ...
} else {
   // not signed in. Show the "sign in" button and explanation.
   // ...
}
Describe it:
targets: Android Google Sign In: check if User is signed in
inputs: Description:
onNewIntent is not called

Implementation:
targets: browserInt.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP|
                    Intent.FLAG_ACTIVITY_SINGLE_TOP);
inputs: Given the following code:
Intent intent = getIntent();
finish();
startActivity(intent);
Describe it:
targets: Programmatically relaunch/recreate an activity?
inputs: Given the following code:
FileBackupHelper hosts = new FileBackupHelper(this,
    "../databases/" + HostDatabase.DB_NAME);
addHelper(HostDatabase.DB_NAME, hosts);
Describe it:
targets: Android backup/restore: how to backup an internal database?
inputs: Description:
How to prevent the screen of an android device to turn off during the execution of an Activity?

Implementation:
targets: if (keepScreenOn)
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
else
    getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
inputs: Given the following code:
GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
                .requestIdToken(getString(R.string.default_web_client_id))
                .requestEmail()
                .build();
Describe it:
targets: Token null Sign-in Google Account
inputs: Given the following code:
//webview being your WebView object reference.
webview.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
Describe it:
targets: webview showing white bar on right side
inputs: Description:
Android Reading from an Input stream efficiently

Implementation:
targets: BufferedReader r = new BufferedReader(new InputStreamReader(inputStream));
StringBuilder total = new StringBuilder();
String line;
while ((line = r.readLine()) != null) {
    total.append(line).append('\n');
}
inputs: Given the following code:
BitmapFactory.Options options = new BitmapFactory.Options();
 options.inJustDecodeBounds = false;
 options.inPreferredConfig = Config.RGB_565;
 options.inDither = true;
Describe it:
targets: BitmapFactory.decodeFile out of memory with images 2400x2400
inputs: Given the following code:
if(uniqueId == null) { 
uniqueId = UUID.randomUUID().toString(); 
}
Describe it:
targets: how to create random UUID in Android when button click event happens?
inputs: Description:
How to prompt user to enable GPS_PROVIDER and/or NETWORK_PROVIDER?

Implementation:
targets: Intent gpsOptionsIntent = new Intent(  
    android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS);  
startActivity(gpsOptionsIntent);
inputs: Description:
Resume the Activity instead of Starting if already exists in back stack

Implementation:
targets: intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
inputs: Given the following code:
mScrollView.setOnTouchListener( new OnTouchListener() {

            @Override
            public boolean onTouch(View v, MotionEvent event) 
            {
                  return true;
            }
});
Describe it:
targets: How to disable and enable the scrolling on android ScrollView?
inputs: Given the following code:
Intent mainIntent = new Intent(Intent.ACTION_MAIN, null);
mainIntent.addCategory(Intent.CATEGORY_LAUNCHER);
List<ResolveInfo> pkgAppsList = context.getPackageManager().queryIntentActivities( mainIntent, 0);
Describe it:
targets: How to get a list of installed android applications and pick one to run
inputs: Given the following code:
Intent i = getBaseContext().getPackageManager()
             .getLaunchIntentForPackage( getBaseContext().getPackageName() );
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(i);
Describe it:
targets: Force application to restart on first activity
inputs: Description:
How can I launch the 'Add Contact' activity in android

Implementation:
targets: Intent intent = new Intent(Intent.ACTION_INSERT, 
                               ContactsContract.Contacts.CONTENT_URI);
    startActivity(intent);
inputs: Given the following code:
Intent emailIntent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts(
            "mailto","abc@gmail.com", null));
emailIntent.putExtra(Intent.EXTRA_SUBJECT, "EXTRA_SUBJECT");
startActivity(Intent.createChooser(emailIntent, "Send email..."));
Describe it:
targets: Send email via gmail
inputs: Given the following code:
if(mPlayer.isPlaying()){
    mPlayer.pause();
} else {
    mPlayer.start();
}
Describe it:
targets: Android Media Player play/pause Button
inputs: Description:
How to get the ActionBar height?

Implementation:
targets: // Calculate ActionBar height
TypedValue tv = new TypedValue();
if (getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true))
{
    actionBarHeight = TypedValue.complexToDimensionPixelSize(tv.data,getResources().getDisplayMetrics());
}
inputs: Given the following code:
private class HelloWebViewClient extends WebViewClient {
  @Override
  public boolean shouldOverrideUrlLoading(WebView view, String url) {
    view.loadUrl(url);
    return true;
  }
}
Describe it:
targets: Clicking URLs opens default browser
inputs: Given the following code:
public static ViewAction swipeUp() {  
return new GeneralSwipeAction(Swipe.FAST, GeneralLocation.BOTTOM_CENTER,  
    GeneralLocation.TOP_CENTER, Press.FINGER);  
}
Describe it:
targets: Drag & Drop Espresso
inputs: Description:
How to make a callback after the view is completely rendered?

Implementation:
targets: @Override
public void onWindowFocusChanged(boolean hasFocus) {
    super.onWindowFocusChanged(hasFocus);
    doWhateverAfterScreenViewIsRendered();
}
inputs: Description:
How to hide "Navigation" and "GPS Pointer" buttons when I click the marker on the android google map

Implementation:
targets: //Disable Map Toolbar:
mMap.getUiSettings().setMapToolbarEnabled(false);
inputs: Description:
How to exit from the application and show the home screen?

Implementation:
targets: Intent intent = new Intent(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_HOME);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
inputs: Description:
Android: How can I add HTML links inside a ListView?

Implementation:
targets: textcontent.setText(Html.fromHtml(item.get_text()));
textcontent.setAutoLinkMask(Linkify.WEB_URLS);
inputs: Description:
How to handle Back button with in the dialog?

Implementation:
targets: dialog.setOnCancelListener(new DialogInterface.OnCancelListener() {     
  @Override
  public void onCancel(DialogInterface dialog) {
    //do whatever you want the back key to do
  }
});
inputs: Description:
Mockito + Dexmaker on Android

Implementation:
targets: System.setProperty(
    "dexmaker.dexcache",
    getInstrumentation().getTargetContext().getCacheDir().getPath());
inputs: Description:
Is there a way an app can check if it is allowed to access notifications?

Implementation:
targets: String enabledListeners = Settings.Secure.getString(context.getContentResolver(), 
    "enabled_notification_listeners");
inputs: Description:
Navigation drawer - Disable click through on items behind the drawer

Implementation:
targets: mFragmentContainerView.setOnTouchListener(new View.OnTouchListener() {
    @Override
    public boolean onTouch(View v, MotionEvent event) {
      return true;
    }
  });
inputs: Description:
Getting device os version in Android programmatically

Implementation:
targets: String myVersion = android.os.Build.VERSION.RELEASE; // e.g. myVersion := "1.6"
int sdkVersion = android.os.Build.VERSION.SDK_INT; // e.g. sdkVersion := 8;
inputs: Description:
Don't navigate to other pages in WebView,disable links and references

Implementation:
targets: webView.setWebViewClient(new WebViewClient(){
    public boolean shouldOverrideUrlLoading(WebView view, String url) {
        return true;
    }
});
inputs: Given the following code:
if (locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)){
        //Do what you need if enabled...
    }else{
        //Do what you need if not enabled...
    }
Describe it:
targets: How can I check if GPS is enabled before I try to use it
inputs: Description:
Location Manager remove updates permission

Implementation:
targets: if (locationManager != null) {
    if (checkSelfPermission(Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED
            || checkSelfPermission(Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
        locationManager.removeUpdates(GPSListener.this);
    }
}
inputs: Description:
How to reveal that screen is locked?

Implementation:
targets: KeyguardManager myKM = (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE);
if( myKM.inKeyguardRestrictedInputMode()) {
 //it is locked
} else {
 //it is not locked
}
inputs: Given the following code:
i = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
startActivityForResult(i, CHOOSE_IMAGE);
Describe it:
targets: Android KitKat securityException when trying to read from MediaStore
inputs: Description:
Android - width and height of bitmap without loading it

Implementation:
targets: BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
BitmapFactory.decodeResource(getResources(), R.id.myimage, options);
int imageHeight = options.outHeight;
int imageWidth = options.outWidth;
inputs: Description:
How to handle an intent which does not have data at first call of an activity?

Implementation:
targets: if( getIntent().getExtras() != null)
{
  //do here
}
inputs: Given the following code:
((InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE)).
    toggleSoftInput(InputMethodManager.SHOW_FORCED,
                    InputMethodManager.HIDE_IMPLICIT_ONLY);
Describe it:
targets: Showing the soft keyboard for SearchView on ActionBar
inputs: Description:
What is the size of ActionBar in pixels?

Implementation:
targets: final TypedArray styledAttributes = getContext().getTheme().obtainStyledAttributes(
                    new int[] { android.R.attr.actionBarSize });
mActionBarSize = (int) styledAttributes.getDimension(0, 0);
styledAttributes.recycle();
inputs: Given the following code:
Intent goToAppstore = new Intent(Intent.ACTION_VIEW,Uri.parse("http://www.amazon.com/gp/mas/dl/andro" +"id?p=com.yapp.blah"));
goToAppstore.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(goToAppstore);
Describe it:
targets: Linking back to amazon app store for ratings
inputs: Description:
How to determine which platform the current app is running on in LibGDX?

Implementation:
targets: if(Gdx.app.getType() == ApplicationType.iOS) {
    //Do awesome stuff for iOS here
}
inputs: Description:
Android: checkbox listener

Implementation:
targets: satView.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

    @Override
    public void onCheckedChanged(CompoundButton buttonView,boolean isChecked) {

    }
  }
);
inputs: Given the following code:
map.setMyLocationEnabled(false);
map.getUiSettings().setMyLocationButtonEnabled(false);
Describe it:
targets: How to hide current location in google map?
inputs: Description:
Going to home screen programmatically

Implementation:
targets: Intent startMain = new Intent(Intent.ACTION_MAIN);
startMain.addCategory(Intent.CATEGORY_HOME);
startMain.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(startMain);
inputs: Description:
How to disable status bar / notification bar on android programmatically?

Implementation:
targets: requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                     WindowManager.LayoutParams.FLAG_FULLSCREEN);
inputs: Description:
Android DialogFragment disappears after orientation change

Implementation:
targets: @Override
 public void onDestroyView() {
     if (getDialog() != null && getRetainInstance()) {
         getDialog().setDismissMessage(null);
     }
     super.onDestroyView();
 }
inputs: Description:
Start new navigation without exiting from previous navigation in Google Map

Implementation:
targets: intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
inputs: Description:
Android "Roboto Light" pixelation

Implementation:
targets: int flags = textView.getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG
            | Paint.ANTI_ALIAS_FLAG;
textView.setPaintFlags(flags);
inputs: Description:
How to get main Activity class or class name of my application?

Implementation:
targets: String packageName = context.getPackageName();
Intent launchIntent = context.getPackageManager().getLaunchIntentForPackage(packageName);
String className = launchIntent.getComponent().getClassName();
inputs: Given the following code:
@Override
public void onWindowFocusChanged(boolean hasFocus) {
    super.onWindowFocusChanged(hasFocus);
    doWhateverAfterScreenViewIsRendered();
}
Describe it:
targets: How to make a callback after the view is completely rendered?
inputs: Description:
How To Show and hide ActionBar with AppCompat v.7

Implementation:
targets: getSupportActionBar().hide();  // for hiding
getSupportActionBar().show();  // for showing
inputs: Given the following code:
BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
BitmapFactory.decodeResource(getResources(), R.id.myimage, options);
int imageHeight = options.outHeight;
int imageWidth = options.outWidth;
Describe it:
targets: Android - width and height of bitmap without loading it
inputs: Given the following code:
//to show soft keyboard
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);

//to hide it, call the method again
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);
Describe it:
targets: How to close Android Soft KeyBoard programmatically?
inputs: Description:
Move snackbar above the bottom bar

Implementation:
targets: Snackbar snack = Snackbar.make(findViewById(R.id.coordinatorLayout),
    "Your message", Snackbar.LENGTH_LONG);
CoordinatorLayout.LayoutParams params = (CoordinatorLayout.LayoutParams)
snack.getView().getLayoutParams();
params.setMargins(leftMargin, topMargin, rightMargin, bottomBar.height);
snack.getView().setLayoutParams(params);
snack.show();
inputs: Description:
Start Google search query from activity - Android

Implementation:
targets: Intent intent = new Intent(Intent.ACTION_WEB_SEARCH);
intent.putExtra(SearchManager.QUERY, query); // query contains search string
startActivity(intent);
inputs: Description:
Video recording format(.3gp or mp4) in android?

Implementation:
targets: recorder = new MediaRecorder(); 
recorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
inputs: Given the following code:
startActivity(intent);

overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left);
Describe it:
targets: How to start an Activity with an animation set entirely programmatically
inputs: Description:
How to minimize whole application in android?

Implementation:
targets: Intent startMain = new Intent(Intent.ACTION_MAIN);
startMain.addCategory(Intent.CATEGORY_HOME);
startMain.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(startMain);
inputs: Given the following code:
String newtext = editText.getText().toString() + "the new text";
editText.setText("");
editText.append(newtext);
Describe it:
targets: Move cursor to end of EditText?
inputs: Description:
How to detect device is Android phone or Android tablet?

Implementation:
targets: public static boolean isTablet(Context context) {
    return (context.getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK)
            >= Configuration.SCREENLAYOUT_SIZE_LARGE;
}
inputs: Description:
how do I restart an activity in android?

Implementation:
targets: Intent intent = getIntent();
finish();
startActivity(intent);
inputs: Description:
How to lock phone orientation in Android to prevent landscape mode

Implementation:
targets: // This forces a vertical screen.
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
inputs: Description:
Custom android AccelerateDecelerateInterpolator

Implementation:
targets: public class MVAccelerateDecelerateInterpolator implements Interpolator {

    // easeInOutQuint
    public float getInterpolation(float t) {
        float x = t*2.0f;
        if (t<0.5f) return 0.5f*x*x*x*x*x;
        x = (t-0.5f)*2-1;
        return 0.5f*x*x*x*x*x+1;
    }
}
inputs: Given the following code:
String packageName = context.getPackageName();
Intent launchIntent = context.getPackageManager().getLaunchIntentForPackage(packageName);
String className = launchIntent.getComponent().getClassName();
Describe it:
targets: How to get main Activity class or class name of my application?
inputs: Description:
Is it possible that when click edittext it will show dialog message?

Implementation:
targets: mDateDisplay.setClickable(true);
mDateDisplay.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
        showDialog(DATE_DIALOG_ID);
    }
});
inputs: Description:
Android How to use MediaScannerConnection scanFile

Implementation:
targets: sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED, Uri.parse("file://"
            + Environment.getExternalStorageDirectory())));
inputs: Given the following code:
// This forces a vertical screen.
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
Describe it:
targets: How to lock phone orientation in Android to prevent landscape mode
inputs: Given the following code:
mSwipeRefreshLayout.post(new Runnable() {
  @Override
  public void run() {
    mSwipeRefreshLayout.setRefreshing(true);
  }
});
Describe it:
targets: SwipeRefreshLayout setRefreshing() not showing indicator initially
inputs: Description:
How can one detect airplane mode on Android?

Implementation:
targets: /**
* Gets the state of Airplane Mode.
* 
* @param context
* @return true if enabled.
*/
private static boolean isAirplaneModeOn(Context context) {

   return Settings.System.getInt(context.getContentResolver(),
           Settings.System.AIRPLANE_MODE_ON, 0) != 0;

}
inputs: Given the following code:
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("market://details?id=com.android.example"));
startActivity(intent);
Describe it:
targets: Android Link to Market from inside another app
inputs: Given the following code:
String extStorage = Environment.getExternalStorageState();
path = extStorage+"/Android/data/com.mydomain.myapp/";
Describe it:
targets: Android, how to choose save file location?
inputs: Description:
Android open camera from button

Implementation:
targets: Intent intent = new Intent("android.media.action.IMAGE_CAPTURE");
startActivity(intent);
inputs: Description:
Android pop fragment from backstack with animation

Implementation:
targets: setCustomAnimations(R.anim.enter_from_left, R.anim.enter_from_left,
        R.anim.exit_to_left, R.anim.exit_to_left);
inputs: Description:
Android Media Player play/pause Button

Implementation:
targets: if(mPlayer.isPlaying()){
    mPlayer.pause();
} else {
    mPlayer.start();
}
inputs: Description:
Check for navigation bar

Implementation:
targets: boolean hasMenuKey = ViewConfiguration.get(context).hasPermanentMenuKey();
boolean hasBackKey = KeyCharacterMap.deviceHasKey(KeyEvent.KEYCODE_BACK);

if(!hasMenuKey && !hasBackKey) {
    // Do whatever you need to do, this device has a navigation bar
}
inputs: Given the following code:
if( getIntent().getExtras() != null)
{
  //do here
}
Describe it:
targets: How to handle an intent which does not have data at first call of an activity?
inputs: Description:
How can I post on Twitter with Intent Action_send?

Implementation:
targets: String url = "http://www.twitter.com/intent/tweet?url=YOURURL&text=YOURTEXT";
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
startActivity(i);
inputs: Given the following code:
switch (item.getItemId()) {
    case android.R.id.home:
        finish();
        return true;
    default:        
         return super.onOptionsItemSelected(item);
}
Describe it:
targets: How to set multiple parent activities for using android back button
inputs: Description:
Call removeView() on the child's parent first

Implementation:
targets: ((ViewGroup)scrollChildLayout.getParent()).removeView(scrollChildLayout);
//scrollView.removeView(scrollChildLayout);
inputs: Given the following code:
mFragmentContainerView.setOnTouchListener(new View.OnTouchListener() {
    @Override
    public boolean onTouch(View v, MotionEvent event) {
      return true;
    }
  });
Describe it:
targets: Navigation drawer - Disable click through on items behind the drawer
inputs: Given the following code:
satView.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

    @Override
    public void onCheckedChanged(CompoundButton buttonView,boolean isChecked) {

    }
  }
);
Describe it:
targets: Android: checkbox listener
inputs: Description:
Binding to a service from another app

Implementation:
targets: intentForMcuService.setComponent(new ComponentName("com.admetric.modemwatcher",
        "com.admetric.modemwatcher.ModemWatcherService"));
inputs: Given the following code:
Intent i = new Intent(this, Wakeup.class);
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
Describe it:
targets: Calling startActivity() from outside of an Activity?
inputs: Given the following code:
if(android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) {
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE);
}
Describe it:
targets: How do I prevent Android taking a screenshot when my app goes to the background?
inputs: Given the following code:
getActivity().getWindow().setSoftInputMode(
            WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
Describe it:
targets: How to hide the soft keyboard from inside a fragment?
inputs: Given the following code:
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.list);
recyclerView.setHasFixedSize(true);
Describe it:
targets: When do we use the recyclerView.setHasFixedSize?
inputs: Description:
startForeground() does not show my Notification

Implementation:
targets: startForeground(0, notification); // Doesn't work...

startForeground(1, notification); // Works!!!
inputs: Description:
Programmatically relaunch/recreate an activity?

Implementation:
targets: Intent intent = getIntent();
finish();
startActivity(intent);
inputs: Description:
How to make a phone call using intent in Android?

Implementation:
targets: Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + "Your Phone_number"));
startActivity(intent);
inputs: Given the following code:
Intent i = new Intent(Intent.ACTION_MAIN);
i.addCategory(Intent.CATEGORY_HOME);
startActivity(i);
Describe it:
targets: Android - Simulate Home click
inputs: Given the following code:
public static Bitmap RotateBitmap(Bitmap source, float angle)
{
   Matrix matrix = new Matrix();
   matrix.postRotate(angle);
   return Bitmap.createBitmap(source, 0, 0, source.getWidth(), source.getHeight(), matrix, true);
}
Describe it:
targets: Android: How to rotate a bitmap on a center point
inputs: Description:
Android: How to get a custom View's height and width?

Implementation:
targets: @Override
protected void onSizeChanged(int xNew, int yNew, int xOld, int yOld){
    super.onSizeChanged(xNew, yNew, xOld, yOld);

    viewWidth = xNew;
    viewHeight = yNew;
}
inputs: Given the following code:
if (keyCode == KeyEvent.KEYCODE_ENTER && event.getAction() == KeyEvent.ACTION_DOWN) {
    Log.d(TAG, "enter_key_called");
}
Describe it:
targets: Soft keyboard enter key event handle
inputs: Given the following code:
TypedValue outValue = new TypedValue();
getContext().getTheme().resolveAttribute(android.R.attr.selectableItemBackground, outValue, true);
cardView.setBackgroundResource(outValue.resourceId);
Describe it:
targets: Programatically set '?selectableItemBackground' on Android view
inputs: Given the following code:
setTitle("Title");
getSupportActionBar().hide();
Describe it:
targets: Actionbar Sherlock: Setting and hiding title bar
inputs: Description:
Android activity over default lock screen

Implementation:
targets: getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON|
            WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD|
            WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED|
            WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
inputs: Given the following code:
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
 navigationView.setItemIconTintList(null);
 navigationView.setNavigationItemSelectedListener(this);
Describe it:
targets: Navigation drawer menu icon is not displayed correctly
inputs: Given the following code:
EditText editText = (EditText)findViewById(R.id.yourId);
String editTextStr = editText.getText().toString();
Describe it:
targets: How to Retrieve Text from Textbox in Android widget?
inputs: Description:
Google Maps v2 - set both my location and zoom in

Implementation:
targets: CameraUpdate center=
    CameraUpdateFactory.newLatLng(new LatLng(40.76793169992044,
                         -73.98180484771729));
  CameraUpdate zoom=CameraUpdateFactory.zoomTo(15);

  map.moveCamera(center);
  map.animateCamera(zoom);
inputs: Given the following code:
Intent intent = new Intent("android.media.action.IMAGE_CAPTURE");
startActivity(intent);
Describe it:
targets: Android open camera from button
inputs: Given the following code:
mDateDisplay.setClickable(true);
mDateDisplay.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
        showDialog(DATE_DIALOG_ID);
    }
});
Describe it:
targets: Is it possible that when click edittext it will show dialog message?
inputs: Given the following code:
public static boolean isTablet(Context context) {
    return (context.getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK)
            >= Configuration.SCREENLAYOUT_SIZE_LARGE;
}
Describe it:
targets: How to detect device is Android phone or Android tablet?
inputs: Description:
Click on notification starts activity twice

Implementation:
targets: notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP
                            |Intent.FLAG_ACTIVITY_SINGLE_TOP);
inputs: Given the following code:
wv.setWebViewClient(new WebViewClient() {
public boolean shouldOverrideUrlLoading(WebView view, String url) {
          view.loadUrl(url);
          return true;
           }});
Describe it:
targets: Opening webview not in new browser
inputs: Given the following code:
int resource = context.getResources().getIdentifier("status_bar_height", "dimen", "android");
    if (resource > 0) {
        statusBarHeight = context.getResources().getDimensionPixelSize(resource);
    }
Describe it:
targets: Height of screen without status bar, actionBar and tabs
inputs: Given the following code:
if(Gdx.app.getType() == ApplicationType.iOS) {
    //Do awesome stuff for iOS here
}
Describe it:
targets: How to determine which platform the current app is running on in LibGDX?
inputs: Description:
How to get the build/version number of your Android application?

Implementation:
targets: try {
  PackageInfo pInfo = this.getPackageManager().getPackageInfo(getPackageName(), 0);
  String version = pInfo.versionName;
} catch (PackageManager.NameNotFoundException e) {
  e.printStackTrace();
}
inputs: Description:
Android Status Bar Notifications - Intent getting the old extras on the second time

Implementation:
targets: PendingIntent pintent = 
   PendingIntent.getActivity(context,0,intent,PendingIntent.FLAG_CANCEL_CURRENT);
inputs: Given the following code:
try {
  PackageInfo pInfo = this.getPackageManager().getPackageInfo(getPackageName(), 0);
  String version = pInfo.versionName;
} catch (PackageManager.NameNotFoundException e) {
  e.printStackTrace();
}
Describe it:
targets: How to get the build/version number of your Android application?
inputs: Description:
How do I detect touch input on the Android

Implementation:
targets: mView.setOnTouchListener(new OnTouchListener() {
    @Override
    public boolean onTouch(View v, MotionEvent event) {
        //show dialog here
        return false;
    }
});
inputs: Given the following code:
myDataset.remove(position); // myDataset is List<MyObject>
mAdapter.notifyItemRemoved(position);
Describe it:
targets: No animation on item removal on RecyclerView
inputs: Given the following code:
videoView.setOnPreparedListener(new OnPreparedListener() {
    @Override
    public void onPrepared(MediaPlayer mp) {
        mp.setLooping(true);
    }
});
Describe it:
targets: Seamless video Loop with VideoView
inputs: Description:
How to know if an activity is called using startActivityForResult or simply called by using startActivity?

Implementation:
targets: if (getCallingActivity() == null) {
    //This Activity was called by startActivity 
} else {
   //This Activity was called by startActivityForResult
}
inputs: Description:
How do I know if my app is running with Robolectric?

Implementation:
targets: public static boolean isRoboUnitTest() {
    return "robolectric".equals(Build.FINGERPRINT);
}
inputs: Description:
Seamless video Loop with VideoView

Implementation:
targets: videoView.setOnPreparedListener(new OnPreparedListener() {
    @Override
    public void onPrepared(MediaPlayer mp) {
        mp.setLooping(true);
    }
});
inputs: Given the following code:
String message = "Text I want to share.";
Intent share = new Intent(Intent.ACTION_SEND);
share.setType("text/plain");
share.putExtra(Intent.EXTRA_TEXT, message);

startActivity(Intent.createChooser(share, "Title of the dialog the system will open"));
Describe it:
targets: Android - Share on Facebook, Twitter, Mail, ecc
inputs: Given the following code:
// Check if we're running on Android 5.0 or higher
if (Build.VERSION.SDK_INT >= 21) {
    // Call some material design APIs here
} else {
    // Implement this feature without material design
}
Describe it:
targets: Android version check