Skip to content

Instantly share code, notes, and snippets.

View vpodlesnyak's full-sized avatar

Vasyl Pidlisniak vpodlesnyak

  • Splendo
  • Rotterdam, Netherlands
View GitHub Profile
Intent filter for URL capturing
Task: catch urls of type http://ХХХXviewster.com/movie/XXXXXX
Solution: activity with intent filter
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http" />
<data android:host="*.viewster.com" />
@vpodlesnyak
vpodlesnyak / gist:9910308
Created April 1, 2014 08:41
View overlay displayed on top of all activities
public class OverlayService extends Service {
LinearLayout oView;
@Override
public IBinder onBind(Intent i) {
return null;
}
@Override
@vpodlesnyak
vpodlesnyak / gist:9930423
Created April 2, 2014 08:54
Multipart POST file upload
public static void uploadFile(String urlString, Map<String, String> params, String fileName, InputStream fileInputStream) {
String lineEnd = "\r\n";
String twoHyphens = "--";
String boundary = "*****";
HttpURLConnection conn;
try {
// ------------------ CLIENT REQUEST
Log.e(Tag, "Inside second Method");
// open a URL connection to the Servlet
URL url = new URL(urlString);