Help to filter json file from firebase in the application

0

I am building an application that is just an information filter that is in the json of the firebase database. My headache is where I'm going to apply the search code! for now it looks like this:

public class MainActivity extends AppCompatActivity {

private static final String[] setor = {"Modelagem", "Corte", "Silk", "Bordado", "Produção", "Acabamento", "Embalagem", "Lavanderia", "Facção"};
ArrayAdapter<String> Asetor;
Spinner spinner;
Button buscar;
Firebase objetoRef;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    //SPINNER
    Asetor = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, setor);
    //PEGANDO ITENS DO SPINNER
    spinner = (Spinner) findViewById(R.id.setor);
    spinner.setAdapter(Asetor);
    //BUTTON BUSCAR
    buscar = (Button) findViewById(R.id.buscar);

    //FIREBASE
    Firebase.setAndroidContext(this);
    objetoRef = new Firebase("https://rastro-4ed10.firebaseio.com/");
    objetoRef.addValueEventListener(new ValueEventListener() {

        @Override //CLASS UTILIZADA PARA ALTERAR UM TEXTVIEW CONFORME O BANCO
        public void onDataChange(DataSnapshot dataSnapshot) {
            String value = dataSnapshot.getValue(String.class);
            Log.d(TAG, "value is: "+ value);
        }

        @Override
        public void onCancelled(FirebaseError firebaseError) {

        }
    });
}

I do not know if I do it within the onDataChange, or if I do in the Main_Activity where the result will appear ... There are 3 search fields for a Spinner and two EditText.

    
asked by anonymous 31.01.2017 / 13:57

0 answers