Skip to content

Instantly share code, notes, and snippets.

View catvinhquang's full-sized avatar
🍔
#codeforfood

Quang Cat catvinhquang

🍔
#codeforfood
  • Senior Android Engineer at Sea Group
  • Vietnam
View GitHub Profile
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
SpannableString styledString
= new SpannableString("Large\n\n" // index 0 - 5
+ "Bold\n\n" // index 7 - 11
+ "Underlined\n\n" // index 13 - 23
+ "Italic\n\n" // index 25 - 31
package com.quangcv.myapplication;
import android.app.Activity;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.BitmapShader;
import android.graphics.Canvas;
import android.graphics.Matrix;
import android.graphics.Paint;
package com.quangcv.myapplication;
import android.app.Activity;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.os.Bundle;
import android.util.TypedValue;
import android.view.View;
tools:
sudo apt-get install ffmpeg
https://gif.ski/
commands:
ffmpeg -i video.mp4 frame%04d.png
gifski -o file.gif frame*.png
# Fix 2 bugs below
# Bug 1: Could not connect to development server...
# Bug 2: Unable to load script from assets 'index.android.bundle'...
# Ref: https://stackoverflow.com/questions/22475849/node-js-error-enospc/32600959#32600959
# Open Terminal and run lines below
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
react-native start
adb shell input keyevent KEYCODE_MENU
1- Create new project: npm init
2- Install package: npm install package_name
3- Run app: node js_file_name
@catvinhquang
catvinhquang / MainActivity.java
Created August 15, 2018 08:23
Enable GPS in app
package catvinhquang.enablegps;
import android.Manifest;
import android.app.Activity;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.location.Location;
import android.os.Bundle;
import android.os.Looper;
import android.support.annotation.NonNull;
Index: .gitignore
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- .gitignore (revision 75d782181e1b48b73223892c9b8b4b1cf4c10dfd)
+++ .gitignore (date 1537440316000)
@@ -3,8 +3,6 @@
build/
obj/
@catvinhquang
catvinhquang / build_andengine.md
Created August 22, 2018 06:31
Build AndEngine
  1. Set compileSdkVersion 17
  2. Set minSdkVersion 8
  3. Add these lines in both build.gradle files of your imported modules:
android {
    defaultConfig { ... }
    sourceSets {
        main {
            jni.srcDirs = []
 }