package com.megabit.musicall;

import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.view.Menu;
import android.view.MenuItem;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);

        FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
        fab.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
                        .setAction("Action", null).show();
            }
        });
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.menu_main, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();

        //noinspection SimplifiableIfStatement
        if (id == R.id.action_settings) {
            return true;
        }

        return super.onOptionsItemSelected(item);
    }
}

@@ -24,16 +24,47 @@
 icall;%0A%0A
+import android.content.Intent;%0A
 import a
@@ -81,16 +81,16 @@
 Bundle;%0A
-
 import a
@@ -144,55 +144,8 @@
 on;%0A
-import android.support.design.widget.Snackbar;%0A
 impo
@@ -235,34 +235,8 @@
 ar;%0A
-import android.view.View;%0A
 impo
@@ -286,16 +286,71 @@
 enuItem;
+%0Aimport android.view.View;%0Aimport android.widget.Toast;
 %0A%0Apublic
@@ -397,17 +397,69 @@
 ivity %7B%0A
+    private static final int READ_REQUEST_CODE = 42;
 %0A
-
     @Ove
@@ -945,137 +945,121 @@
     
-Snackbar.make(view, %22Replace with your own action%22, Snackbar.LENGTH_LONG)%0A                        .setAction(%22Action%22, null).show
+Toast.makeText(getApplicationContext(), %22hi there%22, Toast.LENGTH_SHORT).show();%0A                performFileSearch
 ();%0A
@@ -1759,24 +1759,24 @@
 %0A        %7D%0A%0A
-
         retu
@@ -1818,11 +1818,540 @@
 );%0A    %7D
+%0A%0A    /**%0A     * Fires an intent to spin up the %22file chooser%22 UI and select an image.%0A     */%0A    public void performFileSearch() %7B%0A        Intent intent = new Intent(Intent.ACTION_GET_CONTENT);%0A%0A        // Filter to only show results that can be %22opened%22, such as a%0A        // file (as opposed to a list of contacts or timezones)%0A        intent.addCategory(Intent.CATEGORY_OPENABLE);%0A%0A        // Filter to show only audio MIME%0A        intent.setType(%22audio/*%22);%0A%0A        startActivityForResult(intent, READ_REQUEST_CODE);%0A    %7D
 %0A%7D%0A

make + button pick files