This file contains hidden or 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
https://github.com/Gericop/Android-Support-Preference-V7-Fix/issues/52 |
This file contains hidden or 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(new ContextThemeWrapper(getActivity(), R.style.AlertDialogCustom)); | |
AlertDialog alertDialog = builder.create(); | |
alertDialog.setTitle(getResources().getString(R.string.reset_to_default)); | |
alertDialog.setMessage(getResources().getString(R.string.you_sure_to_reset)); | |
alertDialog.setButton(AlertDialog.BUTTON_POSITIVE, getResources().getString(R.string.yes), | |
new DialogInterface.OnClickListener() { | |
public void onClick(DialogInterface dialog, int which) { | |
dialog.dismiss(); | |
} | |
}); |
This file contains hidden or 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
Set<String> defaultGenres = new HashSet<>(Arrays.asList(defaultGenresAsArray)); //convert array to set |
This file contains hidden or 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
Snackbar.make(parentLayout, "Some Message", Snackbar.LENGTH_LONG) //you can just to pass built-in layout android.R.id.content | |
.setAction("Action", new View.OnClickListener() { | |
@Override | |
public void onClick(View view) { | |
//handle click here | |
} | |
}) | |
.show(); | |
//P.S. Usage built-in layout android.R.id.content: |
This file contains hidden or 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
//first method (static icon) | |
onCreate() { | |
... | |
getSupportActionBar().setHomeAsUpIndicator(R.drawable.ic_menu); | |
getSupportActionBar().setDisplayHomeAsUpEnabled(true); | |
... | |
} | |
@Override | |
public boolean onOptionsItemSelected(MenuItem item) { |
This file contains hidden or 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 SettingsActivity extends AppCompatActivity { | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
// Display the fragment as the main content. | |
getFragmentManager().beginTransaction() | |
.replace(android.R.id.content, new SomeFragment()) | |
.commit(); |
This file contains hidden or 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
https://stackoverflow.com/questions/4038479/android-go-back-to-previous-activity |
This file contains hidden or 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
Intent emailIntent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts( | |
"mailto","[email protected]", null)); | |
emailIntent.putExtra(Intent.EXTRA_SUBJECT, "[From My App]"); | |
// emailIntent.putExtra(Intent.EXTRA_TEXT, "Body"); | |
startActivity(Intent.createChooser(emailIntent, "Send email...")); |
This file contains hidden or 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
git reset HEAD~1 | |
//On Unix based systems you can use HEAD^ which is equal to HEAD~1. On Windows HEAD^ will not work because ^ signals a line continuation. So your command prompt will just ask you More? |
This file contains hidden or 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 CheckInternetConnectAsyncTask extends AsyncTask<Void, Void, Boolean> { | |
private final WeakReference<Activity> mActivityWeakReference; | |
public CheckInternetConnectAsyncTask(Activity activity) { | |
mActivityWeakReference = new WeakReference<>(activity); | |
} | |
@Override | |
protected void onPreExecute() { |