Skip to content

Instantly share code, notes, and snippets.

Mohamed Fathy MuhamedFathy

  • Rytalo
  • Egypt
Block or report user

Report or block MuhamedFathy

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
MuhamedFathy /
Created Mar 21, 2018 — forked from lopspower/
How to Analyze & Manage Memory on Android Like a Boss

Analyze & Manage Memory on Android Like a Boss

This Blog is all about memory management in Android. It provides information about how you can analyze & reduce memory usage while developing an Android app.

Memory management is a complex field of computer science and there are many techniques being developed to make it more efficient. This guide is designed to introduce you to some of the basic memory management issues that programmers face.

Memory Management in Android

Android is a Linux based operating system. It uses native open source C libraries which power Linux machines. All the basic operating system operations like I/O, memory management and so on are handled by the Linux kernel. Like Java and .NET, Android uses its own run time and virtual machine to manage application memory. Unlike either of these frameworks, the Android run time also manages the lifetime processes. Each Android application runs in a separate process within its own Dalvik instance, relinquishing all responsibility for memo

MuhamedFathy /
Created Nov 9, 2017 — forked from brendanw/
RxBus with Sticky Events
* An RxJava-backed EventBus class that can support sending and receiving multiple event types.
* Based on
public class EventBus<T> {
private static EventBus<Object> INSTANCE;
private List<T> events;
public abstract class EndlessRecyclerOnScrollListener extends RecyclerView.OnScrollListener {
public static String TAG = EndlessRecyclerOnScrollListener.class.getSimpleName();
private int previousTotal = 0; // The total number of items in the dataset after the last load
private boolean loading = true; // True if we are still waiting for the last set of data to load.
private int visibleThreshold = 5; // The minimum amount of items to have below your current scroll position before loading more.
int firstVisibleItem, visibleItemCount, totalItemCount;
MuhamedFathy / build.gradle
Created Apr 3, 2017 — forked from jackgris/build.gradle
Example of use from Proguard, from Android Studio
View build.gradle
buildscript {
repositories {
maven {
url ''
dependencies {
classpath ''
classpath 'com.squareup.gradle:gradle-android-test-plugin:0.9.1-SNAPSHOT'
import android.location.Location;
import android.os.Handler;
import android.os.SystemClock;
import android.view.animation.Interpolator;
import android.view.animation.LinearInterpolator;
public class Animator implements Runnable {
private static final int ANIMATE_SPEEED = 800;
private static final int ANIMATE_SPEEED_TURN = 1000;
private static final int BEARING_OFFSET = 20;
private final Interpolator interpolator = new LinearInterpolator();
int currentIndex = 0;
/* Copyright 2013 Google Inc.
Licensed under Apache 2.0: */
package com.example.latlnginterpolation;
import android.animation.ObjectAnimator;
import android.animation.TypeEvaluator;
import android.animation.ValueAnimator;
import android.annotation.TargetApi;
import android.os.Build;
MuhamedFathy /
Created Mar 14, 2017
Stackoverflow answer, "Singleton in Android"
package com.example.testSingleton;
import android.content.Intent;
import android.os.Bundle;
import android.widget.Toast;
public class ActivityA extends Activity {
public void onCreate(Bundle savedInstanceState) {
MuhamedFathy /
Created Feb 11, 2017 — forked from rafali/
Resize animation on Android
public class ResizeAnimation extends Animation {
final int startWidth;
final int targetWidth;
View view;
public ResizeAnimation(View view, int targetWidth) {
this.view = view;
this.targetWidth = targetWidth;
startWidth = view.getWidth();
MuhamedFathy /
Created Jan 29, 2017 — forked from grennis/
This class allows easy use of SwipeRefreshLayout with RecyclerView (or ListView) and an "empty" view that can still be pulled to refresh
package com.innodroid.sample;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
You can’t perform that action at this time.