Skip to content

Instantly share code, notes, and snippets.

@vxhviet
vxhviet / rotateScreen.md
Last active April 29, 2016 02:39
Rotate screen on button click

Source: StackOverflow, TechBlogon

Question: How to rotate screen orientation on button click?

Answer:

In VideoActivity:

mFullscreen.setOnClickListener(new View.OnClickListener() {
@vxhviet
vxhviet / fadeAnimation.md
Last active April 29, 2016 07:56
add Fade animation to ImageView

Source: StackOverflow

Question: How to fade in and out an ImageView on touch event?

Answer:

yourImgView.setOnTouchListener(new MyOnTouchListener());
@vxhviet
vxhviet / transparentCircle.md
Created May 5, 2016 03:23
Draw transparent circle in xml

Source: StackOverflow, StackOverflow

Question: How to draw a transparent cirlcle in xml?

Answer:

Create a cirlce.xml in drawable folder with this:

@vxhviet
vxhviet / importModule.md
Last active June 22, 2016 06:12
How to import cwac-cam2 as external library into Android Studio?

Question: How to import cwac-cam2 as external library into Android Studio?

Answer: example using cwac-cam2-0.5.11

  • Download cwac-cam2-0.5.11 from GitHub release.

  • In Android Studio New -> Import Module -> Source Directory.

  • Choose cam2 folder in cwac-cam2-0.5.11.

@vxhviet
vxhviet / ffmpegCommands.md
Last active November 13, 2024 21:17
FFmpeg commands
@vxhviet
vxhviet / commonConversion.md
Created May 12, 2016 07:43
Common Bitmap, Uri, Path conversion

Source: StackOverflow, StackOverflow

Answer:

  • Convert Uri to Bitmap:

Bitmap bitmap = MediaStore.Images.Media.getBitmap(this.getContentResolver(), imageUri);

  • Get image path from Uri:
@vxhviet
vxhviet / ffmpegNightmare.md
Last active June 7, 2021 19:19
How to fucking build and use FFmpeg with Android Studio!!!

Source: Android Native Development Kit Cookbook, Blog, Roman10, Ph0b

Question: How to FUCKING build and use FFmpeg with Android Studio!!!

Answer: For FFMPEG v3.0.2 and NDK r11

  1. Install Linux Mint in VirtualBox (building on Windows is a NIGHTMARE, don't even try)

  2. Download and Install Android NDK (v11) <- Add link to setup NDK gist

@vxhviet
vxhviet / setupNDK.md
Created May 19, 2016 10:49
How to set up Android NDK

Source: ph0b, froger, gitHub, sitePoint, []

Question: How to add NDK support to current project without upgrading current very complexed build.gradle?

Answer: Mixing both stable and experimental gradle plugin

  1. Download NDK from here (version 11 atm).
  2. Extract the folder to anywhere you want. In Android studio, put the path to app -> F4 -> SDK Location -> Android NDK location
  3. We don’t want to mess in our app code so we need to create external module with C++/JNI code. Add new Android Library Module:
@vxhviet
vxhviet / sharedFolder.md
Last active December 5, 2017 03:09
How to use Shared Folder in VirtualBox

Source: howtoGeek, ubuntuForum

Question: How to use Shared Folder in VirtualBox (Window 10 host, Linux Mint 17.3 guest)?

Answer:

  1. Read howToGeek for general setup. In my case VBOXSRV doesn't show in Windows' Network. The second part is for VMWare. don't do that.
  2. After that if it doesn't work then in Linux Mint open terminal and do:
@vxhviet
vxhviet / ffmpegVPlayerPart1.md
Last active June 9, 2016 02:46
How to fucking build FFmpeg using VPlayer?

Soure: GitHub

Question: How to fucking build FFmpeg using VPlayer?

Answer: For FFMPEG v3.0.2 and NDK r11c

  1. Install Ubuntu (16.04) in VirtualBox (building on Windows is a NIGHTMARE, don't even try)

  2. Download and uncompress Android NDK (v11c) to a folder in your home directory (/home/viet/Android in my case or ~/)

  3. Since the ffmpeg (v2.6) coming with VPlayer has an annoying text relocation issue, we will build ffmpeg from scratch (FFMPEG v3.0.2 and NDK r11c).