Skip to content

Instantly share code, notes, and snippets.

protected void showFragment( Fragment frag, boolean addToBackStack ) {
FragmentTransaction t = getSupportFragmentManager().beginTransaction();
t.replace( R.id.fragment_frame, frag, null );
if ( addToBackStack ) {
t.addToBackStack( null );
}
t.commit();
}
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:id="@+id/fragment_frame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:android:layout_alignParentTop="true"
# Python script to slice an image with a grid into equal sized pieces
# pip install Pillow
#
# Usage:
# python image_slicy.py IMAGE_PATH OUTPUT_FOLDER COLUMNS ROWS
import sys
from PIL import Image