Skip to content

Instantly share code, notes, and snippets.

View OrenBochman's full-sized avatar
🏠
Working from home

Oren Bochman OrenBochman

🏠
Working from home
  • WMF
  • 07:31 (UTC +03:00)
View GitHub Profile
@OrenBochman
OrenBochman / 00-IntetentService-readme.md
Last active September 9, 2018 08:23
Android IntentService stub

IntentService Stub

IntentService is a base class for Services that handle asynchronous requests (expressed as Intents) on demand.

  • work is run in a worker thread. (as opposed to extending Service which defalts to the main thread).
  • multiple calls are queued and run serially.
  • no need to set priority
  • to return a result override onBind which return a PendingIntent
  • for api level > 26 JobIntentService which uses jobs would be prefered.
@OrenBochman
OrenBochman / imageHelper.java
Last active August 21, 2018 13:15
Load image and save to sqlite database as blob
/**
* This code will take a image from url and convert is to a byte array
*/
private void getImage(){
byte[] logoImage = getLogoImage(IMAGEURL);
}
/**
* get an image from the web anc conver to byteArray
*/
@OrenBochman
OrenBochman / !!images.md
Last active September 9, 2018 15:31
android images

Images - loading in Android

  1. using Asynctask
  2. using Glide
  3. using Picaso
@OrenBochman
OrenBochman / !!readme.md
Last active September 9, 2018 15:30
FAB + sanckbar woking in perfect harmony using a coordinator layout

Floating Action Button

basic code including

  1. FAB
  2. Toolbar
  3. Snack
  4. Cordinator
@OrenBochman
OrenBochman / 00_read_me.md
Last active September 9, 2018 10:32
Determine the Current Layout in Android

Activity that adapts

To develop great UI the designer impliments different layouts for different breakpoints.

Two Layout

  • orientation:vertical (1st break point) - master_frag and detail_frag are each in a FragmentActiity
  • orientation:horizontal (2nd break point) - master_detail_act.xml incorprating master_frag and detail_frag fragments
  1. Detection is done in onCreate is testing for the articleView View in the detail fragment. if it is available we are in master/detail layout.
@OrenBochman
OrenBochman / !!Using Intents.md
Last active September 9, 2018 15:11
some intents

Using Intents

  1. shareing
  2. sms
  3. select image
@OrenBochman
OrenBochman / !!android libraries.md
Last active September 13, 2018 03:19
android libraries and tools

Libraries Android - A quick reference guide

I generally try to avoid libraries and code I did not write/test but here is a quick refrence for:

Library Library Library
Android Annotations Buterknife Dagger2
EventBus FirbaseJobDispatcher Glide
Icepick JodaTime LeakCanary
ObjectBox OkHttpClient Moshi
@OrenBochman
OrenBochman / !!readme.md
Last active September 9, 2018 15:28
easy camera

Camera - Capture an image with an app on Android

code to access an external app's camera capabilities

@OrenBochman
OrenBochman / !!Accelerating_Gradle.md
Last active September 9, 2018 09:36 — forked from kevalpatel2106/gradle.properties
Accelerating Gradle

Accelerating Gradle Builds

@OrenBochman
OrenBochman / !!intents.md
Last active March 1, 2023 09:12
All about Intents in Android

Intents

Explicit v.s. Implicit

A quick demo of implicit and explicit intents.

Requesting data from another activity

  1. Use startActivityForResult() to start the second Activity
  2. To return data from the second Activity: