Android Open Source - android-mia Search Fragment






From Project

Back to project page android-mia.

License

The source code is released under:

Apache License

If you think the Android project android-mia listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.idunnolol.mia;
//  w  w w . j a  v  a2 s  .c o m
import android.app.Activity;
import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;

public class SearchFragment extends Fragment {

    private SearchFragmentListener mListener;

    private EditText mEditText;
    private Button mButton;

    @Override
    public void onAttach(Activity activity) {
        super.onAttach(activity);

        mListener = (SearchFragmentListener) activity;
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View rootView = inflater.inflate(R.layout.fragment_main, container, false);
        mEditText = (EditText) rootView.findViewById(R.id.search_edit_text);
        mButton = (Button) rootView.findViewById(R.id.button);

        mButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                search(mEditText.getText().toString());
            }
        });

        return rootView;
    }

    private void search(String text) {
        mListener.onQuery(text);
    }

    //////////////////////////////////////////////////////////////////////////
    // Listener interfaces

    public interface SearchFragmentListener {
        public void onQuery(String query);
    }
}




Java Source Code List

com.idunnolol.mia.AudioStop.java
com.idunnolol.mia.DataFragment.java
com.idunnolol.mia.MainActivity.java
com.idunnolol.mia.SearchFragment.java