Tecnologia do Blogger.
RSS

[androidbrasil-dev] Re: Pequisa em ListActivity com Json

O que eu pude reparar nos exemplos que olhei... geralmente eles tem um adapter

que coloca no metodo 

@Override

    public void onTextChanged(CharSequence s, int start, int before, int count) {    

     }    

tipo assim

@Override      public void onTextChanged(CharSequence s, int start, int before,        int count) {        adapter.getFilter().filter(s.toString());      }

Mas eu não tenho um adapter e sim um JsonArray, alguém pode me explicar?

2012/8/3 Ricardo Cardoso <rick.duk@gmail.com>
Galera, estava querendo fazer um Search na minha List, mas ela recebe um Json do facebook.... o codigo está assim...
Eu sei que eu tenho que colocar o Json em um Array, mas não estou conseguindo, será que alguém pode me ajudar???

    public class FriendListAdapter extends BaseAdapter {

        private LayoutInflater mInflater;

        EscolhaAmigosFacebook friendsList;

        public FriendListAdapter(EscolhaAmigosFacebook friendsList) {

            this.friendsList = friendsList;

            if (Utility.model == null) {

                Utility.model = new FriendsGetProfilePics();

            }

            Utility.model.setListener(this);

            mInflater = LayoutInflater.from(friendsList.getBaseContext());

        }


        @Override

        public int getCount() {

            return jsonArray.length();

        }


        @Override

        public Object getItem(int position) {

            return null;

        }


        @Override

        public long getItemId(int position) {

            return 0;

        }


        @Override

        public View getView(int position, View convertView, ViewGroup parent) {

            JSONObject jsonObject = null;

    try {

             jsonObject = jsonArray.getJSONObject(position);

           } catch (JSONException e1) {

                // TODO Auto-generated catch block

                e1.printStackTrace();

            }

             etSearch.addTextChangedListener(new TextWatcher() {

    

    @Override

    public void onTextChanged(CharSequence s, int start, int before, int count) {    

     }    

    @Override

    public void beforeTextChanged(CharSequence s, int start, int count,

    int after) { 

    }


    @Override

    public void afterTextChanged(Editable s) {

    }

    });


  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • RSS

0 comentários:

Postar um comentário