[Demonstration 1]

[Buggy Method]
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();
    if (id == R.id.knot_info) {
        Intent i = new Intent(Intent.ACTION_SEND);
        i.setType("message/rfc822");
        i.putExtra(Intent.EXTRA_EMAIL, new String[] { "knotit@forkthecode.com" });
        i.putExtra(Intent.EXTRA_SUBJECT, "Feedback");
        i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        try {
            startActivity(Intent.createChooser(i, "Send mail..."));
        } catch (android.content.ActivityNotFoundException ex) {
            Toast.makeText(this, getString(R.string.no_email_client), Toast.LENGTH_SHORT).show();
        }
        return true;
    } else if (id == R.id.knot_delt) {
        final Context context = this;
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setMessage(getString(R.string.clear_all_question)).setPositiveButton(getString(R.string.clear_data), new DialogInterface.OnClickListener() {

            public void onClick(DialogInterface dialog, int id) {
                KnotitOpenHelper openHelper = KnotitOpenHelper.getInstance(context);
                SQLiteDatabase db = openHelper.getWritableDatabase();
                db.delete(KnotitOpenHelper.TRASH_KNOTS_TABLE_NAME, null, null);
                db.delete(KnotitOpenHelper.ARCHIVED_KNOTS_TABLE_NAME, null, null);
                ArrayList<Knot> list = tools.getKnotsArrayList(context, KnotitOpenHelper.KNOTS_TABLE_NAME);
                for (int i = 0; i < list.size(); i++) {
                    Knot knot = list.get(i);
                    tools.cancelReminder(context, knot);
                }
                db.delete(KnotitOpenHelper.KNOTS_TABLE_NAME, null, null);
                File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);
                deleteDir(storageDir);
                dialog.dismiss();
                NotificationManager nManager = ((NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE));
                nManager.cancelAll();
                try {
                    tools.firstRun(context);
                } catch (IOException e) {
                    e.printStackTrace();
                }
                recreate();
                Toast t = Toast.makeText(context, getString(R.string.data_clear), Toast.LENGTH_SHORT);
                t.show();
            }
        }).setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() {

            public void onClick(DialogInterface dialog, int id) {
                dialog.dismiss();
            }
        });
        builder.show();
        return true;
    } else if (id == R.id.menuSortTitle) {
        SharedPreferences prefs = getSharedPreferences("sort", Context.MODE_PRIVATE);
        SharedPreferences.Editor editor = prefs.edit();
        editor.putString("sort_by", KnotitOpenHelper.COLUMN_TITLE);
        editor.apply();
        recreate();
    } else if (id == R.id.menuSortReminder) {
        SharedPreferences prefs = getSharedPreferences("sort", Context.MODE_PRIVATE);
        SharedPreferences.Editor editor = prefs.edit();
        editor.putString("sort_by", KnotitOpenHelper.COLUMN_REMINDER_TIMESTAMP);
        editor.apply();
        recreate();
    } else if (id == R.id.menuSortEdited) {
        SharedPreferences prefs = getSharedPreferences("sort", Context.MODE_PRIVATE);
        SharedPreferences.Editor editor = prefs.edit();
        editor.putString("sort_by", KnotitOpenHelper.COLUMN_TIMESTAMP + " DESC");
        editor.apply();
        recreate();
    } else if (id == R.id.vib0) {
        SharedPreferences prefs = getSharedPreferences("vibrate", Context.MODE_PRIVATE);
        SharedPreferences.Editor editor = prefs.edit();
        editor.putInt("vibrate_key", 0);
        editor.apply();
        Vibrator v = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
        v.vibrate(defaultL, -1);
    } else if (id == R.id.vib1) {
        SharedPreferences prefs = getSharedPreferences("vibrate", Context.MODE_PRIVATE);
        SharedPreferences.Editor editor = prefs.edit();
        editor.putInt("vibrate_key", 1);
        editor.apply();
        Vibrator v = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
        v.vibrate(mario, -1);
    } else if (id == R.id.vib2) {
        SharedPreferences prefs = getSharedPreferences("vibrate", Context.MODE_PRIVATE);
        SharedPreferences.Editor editor = prefs.edit();
        editor.putInt("vibrate_key", 2);
        editor.apply();
        Vibrator v = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
        v.vibrate(teenageTurtle, -1);
    } else if (id == R.id.vib3) {
        SharedPreferences prefs = getSharedPreferences("vibrate", Context.MODE_PRIVATE);
        SharedPreferences.Editor editor = prefs.edit();
        editor.putInt("vibrate_key", 3);
        editor.apply();
        Vibrator v = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
        v.vibrate(voltron, -1);
    } else if (id == R.id.vib4) {
        SharedPreferences prefs = getSharedPreferences("vibrate", Context.MODE_PRIVATE);
        SharedPreferences.Editor editor = prefs.edit();
        editor.putInt("vibrate_key", 4);
        editor.apply();
        Vibrator v = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
        v.vibrate(finalFantasy, -1);
    } else if (id == R.id.vib5) {
        SharedPreferences prefs = getSharedPreferences("vibrate", Context.MODE_PRIVATE);
        SharedPreferences.Editor editor = prefs.edit();
        editor.putInt("vibrate_key", 5);
        editor.apply();
        Vibrator v = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
        v.vibrate(starWars, -1);
    } else if (id == R.id.vib6) {
        SharedPreferences prefs = getSharedPreferences("vibrate", Context.MODE_PRIVATE);
        SharedPreferences.Editor editor = prefs.edit();
        editor.putInt("vibrate_key", 6);
        editor.apply();
        Vibrator v = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
        v.vibrate(jamesBond, -1);
    } else if (id == R.id.vib7) {
        SharedPreferences prefs = getSharedPreferences("vibrate", Context.MODE_PRIVATE);
        SharedPreferences.Editor editor = prefs.edit();
        editor.putInt("vibrate_key", 7);
        editor.apply();
        Vibrator v = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
        v.vibrate(powerRangers, -1);
    } else if (id == R.id.vib8) {
        SharedPreferences prefs = getSharedPreferences("vibrate", Context.MODE_PRIVATE);
        SharedPreferences.Editor editor = prefs.edit();
        editor.putInt("vibrate_key", 8);
        editor.apply();
        Vibrator v = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
        v.vibrate(mortalKombat, -1);
    } else if (id == R.id.vib9) {
        SharedPreferences prefs = getSharedPreferences("vibrate", Context.MODE_PRIVATE);
        SharedPreferences.Editor editor = prefs.edit();
        editor.putInt("vibrate_key", 9);
        editor.apply();
        Vibrator v = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
        v.vibrate(michaelJ, -1);
    } else if (id == R.id.vib10) {
        SharedPreferences prefs = getSharedPreferences("vibrate", Context.MODE_PRIVATE);
        SharedPreferences.Editor editor = prefs.edit();
        editor.putInt("vibrate_key", 10);
        editor.apply();
    } else if (id == R.id.setSound) {
        Intent intent = new Intent(RingtoneManager.ACTION_RINGTONE_PICKER);
        intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TYPE, RingtoneManager.TYPE_NOTIFICATION);
        intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TITLE, "Select Tone");
        intent.putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI, (Uri) null);
        this.startActivityForResult(intent, 5);
    } else if (id == R.id.about) {
        Intent about = new Intent();
        about.setClass(this, About.class);
        startActivity(about);
    }
    return super.onOptionsItemSelected(item);
}

[Buggy Hunk]
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TYPE, RingtoneManager.TYPE_NOTIFICATION);

[Patch]
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TYPE, RingtoneManager.TYPE_ALARM);

[Demonstration 2]

[Buggy Method]
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    switch(item.getItemId()) {
        case R.id.hotWater:
            Intent Hot = new Intent(this, Map.class);
            Hot.putExtra("map", "H");
            startActivity(Hot);
            return true;
        case R.id.coldWater:
            Intent Cold = new Intent(this, Map.class);
            Cold.putExtra("map", "C");
            startActivity(Cold);
            return true;
        case R.id.sewage:
            Intent Sewage = new Intent(this, Map.class);
            Sewage.putExtra("map", "S");
            startActivity(Sewage);
            return true;
        case R.id.findValve:
            Intent Valve = new Intent(this, Data.class);
            Valve.putExtra("data", "V");
            startActivity(Valve);
            return true;
        case R.id.findAddress:
            Intent Address = new Intent(this, Data.class);
            Address.putExtra("data", "A");
            startActivity(Address);
            return true;
        case R.id.showData:
            Intent showData = new Intent(this, DatabaseActivity.class);
            startActivity(showData);
            return true;
    }
    return super.onOptionsItemSelected(item);
}

[Buggy Hunk]
Intent showData = new Intent(this, DatabaseActivity.class);

[Patch]
Intent showData = new Intent(this, InfoChoice.class);

[Demonstration 3]

[Buggy Method]
private void getPlacesHere() {
    if (mCurrentLocation != null && !Objects.equals(currentCategory, "") && !Objects.equals(currentIcon, "")) {
        mMap.clear();
        moveCameraToMyPosition(mMap.getCameraPosition().target);
        PerformGetPlaces(currentCategory, currentIcon, String.valueOf(mMap.getCameraPosition().target.latitude), String.valueOf(mMap.getCameraPosition().target.longitude), false);
        MarkerOptions markerOne = new MarkerOptions().position(new LatLng(mMap.getCameraPosition().target.latitude, mMap.getCameraPosition().target.longitude)).title("Drag to any location");
        target = new PicassoMarker(mMap.addMarker(markerOne), getApplication());
    }
}

[Buggy Hunk]
moveCameraToMyPosition(mMap.getCameraPosition().target);

[Patch]
moveCameraToGooglePlaces(mMap.getCameraPosition().target);