Skip to content

Instantly share code, notes, and snippets.

View lopspower's full-sized avatar
💚
Android Lover

Lopez Mikhael lopspower

💚
Android Lover
View GitHub Profile
@lopspower
lopspower / README.md
Last active August 20, 2023 09:32
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

@lopspower
lopspower / KeyboardUtils.java
Last active July 6, 2023 13:35
Force Hide Keyboard Android
import android.app.Activity;
import android.content.Context;
import android.graphics.Rect;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
public class KeyboardUtils {
public static void hideKeyboard(Activity activity) {
View view = activity.findViewById(android.R.id.content);
@lopspower
lopspower / README.md
Last active February 19, 2023 19:38
Android Supported Language

Android Supported Language

Twitter

Folder extension name
Language / Country
@lopspower
lopspower / 1-README.md
Last active January 19, 2023 09:25
EventBus Introduction

EventBus Introduction

API

General usage and API

Here we pick up on the 3 steps of the README and expand a bit on the code.

1: Define events

Events are POJO (plain old Java object) without any specific requirements.

@lopspower
lopspower / README.md
Last active May 11, 2022 02:47
Android Tools Attributes

Android Tools Attributes

Twitter

Android has a dedicated XML namespace intended for tools to be able to record information in XML files, and have that information stripped when the application is packaged such that there is no runtime or download size penalty. The namespace URI is http://schemas.android.com/tools and is usually bound to the tools: prefix:

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
 android:layout_width="match_parent"
@lopspower
lopspower / REAMDE.md
Last active August 16, 2021 04:19
Increase Android Studio memory

Increase Android Studio memory

Twitter

Locate the configuration file

Run command:

touch ~/Library/Preferences/AndroidStudioX.X/studio.vmoptions
@lopspower
lopspower / README.md
Last active February 24, 2021 23:51
Configuration of proguard-rules.pro

Proguard Configuration

Twitter

1) Enable Proguard in your build.gradle module :

android {
    //...
 buildTypes {
@lopspower
lopspower / 1-README.md
Last active December 25, 2019 08:33
Android M Permissions

Android M Permissions

Twitter

1) Android Permissions

Beginning in Android 6.0 (API level 23), users grant permissions to apps while the app is running, not when they install the app. This approach streamlines the app install process, since the user does not need to grant permissions when they install or update the app. It also gives the user more control over the app's functionality; for example, a user could choose to give a camera app access to the camera but not to the device location. The user can revoke the permissions at any time, by going to the app's Settings screen.

Normal and Dangerous Permissions

@lopspower
lopspower / README.md
Last active December 19, 2019 13:10
Testing activity in Android Studio

Testing activity in Android Studio

How we build the app

Before we start writing our first UI test I want to describe our development process.

  1. First, we write a test for a UI or logic that does not yet exist.
  2. We expect to see build errors or failed tests.
  3. Then we create a UI element or write program logic.
  4. Finally, we run the test and make sure it passes.
@lopspower
lopspower / 1-README.md
Last active April 30, 2019 10:26
Retrofit Introduction

Retrofit Introduction

Twitter API

Type-safe HTTP client for Android and Java by Square, Inc.

Download