Skip to content

Instantly share code, notes, and snippets.

bastami82

Block or report user

Report or block bastami82

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@bastami82
bastami82 / gist:ef5987b79353978223b74257f42c09c9
Last active Apr 4, 2018
set drwabale icon backward compatible
View gist:ef5987b79353978223b74257f42c09c9
import android.support.v7.content.res.AppCompatResources;
THE_VIEW.setBackgroundDrawable(AppCompatResources.getDrawable(ctx, R.drawable.ic_report_review);
//with drwable left
THE_VIEW.setCompoundDrawablesWithIntrinsicBounds(AppCompatResources.getDrawable(ctx, R.drawable.ic_report_review), null, null, null);
@bastami82
bastami82 / androidHandlerRecursiveChecker.java
Created Jan 3, 2018
using Android handler as a timer to check a condition
View androidHandlerRecursiveChecker.java
private Runnable runnable;
private Handler handler;
private boolean condition;
runnable = () -> {
if (condition) {
handler.removeCallbacks(runnable); //stop handler
} else {
handler.postDelayed(runnable, 500); //check a condition every half a second (until condition is met)
You can’t perform that action at this time.