Skip to content

Instantly share code, notes, and snippets.

View David-Hackro's full-sized avatar
🏠
Working from home

David Hackro David-Hackro

🏠
Working from home
View GitHub Profile
@chandu-io
chandu-io / SaveImageFromUrl.java
Last active July 6, 2018 09:35
java :: save image from url
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URL;
public class SaveImageFromUrl {
public static void main(String[] args) throws Exception {
String imageUrl = "https://www.google.com/images/srpr/logo3w.png";
@ftvs
ftvs / PhonecallReceiver.java
Last active October 11, 2023 10:05
Detecting an incoming call coming to an Android device. Remember to set the appropriate permissions in AndroidManifest.xml as suggested in the Stackoverflow link. Usage example in comments. Source: Gabe Sechan http://stackoverflow.com/a/15564021/264619 Explanation: http://gabesechansoftware.com/is-the-phone-ringing/#more-8
package com.gabesechan.android.reusable.receivers;
import java.util.Date;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.telephony.TelephonyManager;
public abstract class PhonecallReceiver extends BroadcastReceiver {
@danylovolokh
danylovolokh / repeatWhen_takeUntil_filter_example.java
Last active February 21, 2021 23:56
Server polling and retry operations when failed. With Retrofit and RxJava.
/**
* This is a class that should be
* mapped on your json response from the server
*/
class ServerPollingResponse {
boolean isJobDone;
@Override
public String toString() {
return "isJobDone=" + isJobDone;