Skip to content

Instantly share code, notes, and snippets.

View vvkirillov's full-sized avatar

Vladimir Kirillov vvkirillov

View GitHub Profile
@vvkirillov
vvkirillov / list_item_layout.xml
Created November 7, 2015 18:37
Simple Android list view item layout with left aligned image, bold header, message and selectable checkbox
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="88dp"
android:minHeight="88dp">
<ImageView
android:id="@+id/img_thumb"
android:layout_marginLeft="16dp"
@vvkirillov
vvkirillov / BitmapUtils.java
Created October 21, 2015 12:53
Android bitmap conversion to and from byte array
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.BitmapDrawable;
import android.util.Log;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.nio.ByteBuffer;
@vvkirillov
vvkirillov / CustomTabLayoutActivity.java
Created October 21, 2015 12:43
Sample android material tabs with custom headers
import android.support.design.widget.TabLayout;
import android.support.v4.view.ViewPager;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import roboguice.RoboGuice;
import roboguice.activity.RoboFragmentActivity;
import roboguice.inject.ContentView;
import roboguice.inject.InjectView;
@vvkirillov
vvkirillov / getprocess_id_fragment.java
Created October 21, 2015 09:06
Get process id in UNIX from Java
public int getPid(Process process) throws Exception{
if(process.getClass().getName().equals("java.lang.UNIXProcess")) {
Field f = process.getClass().getDeclaredField("pid");
f.setAccessible(true);
return f.getInt(process);
}
}
@vvkirillov
vvkirillov / CustomViewLayout.java
Last active October 21, 2015 08:52
Android custom layout
package com.example.vkirillov.customlayout;
import android.annotation.TargetApi;
import android.content.Context;
import android.os.Build;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;