Skip to content

Instantly share code, notes, and snippets.

@kamirbarron
Forked from geekygecko/android.md
Created June 4, 2019 01:54

Revisions

  1. @geekygecko geekygecko revised this gist May 18, 2015. 1 changed file with 59 additions and 1 deletion.
    60 changes: 59 additions & 1 deletion android.md
    Original file line number Diff line number Diff line change
    @@ -9,12 +9,20 @@ adb shell screenrecord /sdcard/video.mp4
    adb pull /sdcard/video.mp4
    ```

    Logcat two devices
    Logcat while two devices connected
    ```bash
    adb devices
    adb -s SA5A330471 logcat | grep --line-buffered Playback
    ```

    Easily input text
    ```bash
    adb shell input text yourusername;
    adb shell input keyevent 66;
    adb shell input text yourpassword;
    adb shell input text "Can%swe%sstill%sbe%sfriends"
    ```

    ## Styles ##

    #### Font family ####
    @@ -37,4 +45,54 @@ xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:fab="http://schemas.android.com/apk/res-auto"
    // designer tools
    xmlns:tools="http://schemas.android.com/tools"
    ```

    ## Fragments ##

    ```java
    public class LocationFragment extends Fragment {
    public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    }

    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.location_fragment, container, false);
    return view;
    }

    public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    }

    public void onResume() {
    super.onResume();
    }

    public void onPause() {
    super.onPause();
    }

    public void onDestroy() {
    super.onDestroy();
    }
    }
    ```

    Create with parameters
    ```java
    public static final String EXTRA_LOCATION = "your.package.LOCATION";

    public static final LocationFragment newInstance(Location location) {
    LocationFragment fragment = new LocationFragment();
    Bundle bundle = new Bundle(1);
    bundle.putSerializable(EXTRA_LOCATION, location);
    fragment.setArguments(bundle);
    return fragment;
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Location location = (Location)getArguments().getSerializable(EXTRA_LOCATION);
    }
    ```
  2. @geekygecko geekygecko revised this gist May 18, 2015. 1 changed file with 23 additions and 8 deletions.
    31 changes: 23 additions & 8 deletions android.md
    Original file line number Diff line number Diff line change
    @@ -1,19 +1,34 @@
    # Android Cheat Sheet #

    ## styles ##
    ## Developer tips ##

    Record a video of your app
    ```bash
    Developer options -> Check show touches
    adb shell screenrecord /sdcard/video.mp4
    adb pull /sdcard/video.mp4
    ```

    Logcat two devices
    ```bash
    adb devices
    adb -s SA5A330471 logcat | grep --line-buffered Playback
    ```

    ## Styles ##

    ### Font family ###
    #### Font family ####

    ```java
    android:fontFamily="sans-serif" // roboto regular
    android:fontFamily="sans-serif-light" // roboto light
    android:fontFamily="sans-serif-condensed" // roboto condensed
    android:fontFamily="sans-serif" // roboto regular
    android:fontFamily="sans-serif-light" // roboto light
    android:fontFamily="sans-serif-condensed" // roboto condensed
    android:fontFamily="sans-serif-condensed-light" // roboto condensed light
    android:fontFamily="sans-serif-thin" // roboto thin (android 4.2)
    android:fontFamily="sans-serif-medium" // roboto medium (android 5.0)
    android:fontFamily="sans-serif-thin" // roboto thin (android 4.2)
    android:fontFamily="sans-serif-medium" // roboto medium (android 5.0)
    ```

    ## xml layouts ##
    ## XML layouts ##

    ```java
    // android
  3. @geekygecko geekygecko renamed this gist May 18, 2015. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  4. @geekygecko geekygecko created this gist May 18, 2015.
    25 changes: 25 additions & 0 deletions android
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,25 @@
    # Android Cheat Sheet #

    ## styles ##

    ### Font family ###

    ```java
    android:fontFamily="sans-serif" // roboto regular
    android:fontFamily="sans-serif-light" // roboto light
    android:fontFamily="sans-serif-condensed" // roboto condensed
    android:fontFamily="sans-serif-condensed-light" // roboto condensed light
    android:fontFamily="sans-serif-thin" // roboto thin (android 4.2)
    android:fontFamily="sans-serif-medium" // roboto medium (android 5.0)
    ```

    ## xml layouts ##

    ```java
    // android
    xmlns:android="http://schemas.android.com/apk/res/android"
    // library extension
    xmlns:fab="http://schemas.android.com/apk/res-auto"
    // designer tools
    xmlns:tools="http://schemas.android.com/tools"
    ```