I have a ListActivity and she is populated with the result of a Json ...
I put a EditText to do a search on ListActivity ... however I do not know
how to do when the result is a json ... can anyone help me?

/**

     * Definition of the list adapter

     */

    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,
intcount) {



     }



     @Override

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

      int after) {





     }



     @Override

     public void afterTextChanged(Editable s) {

      // TODO Auto-generated method stub



     }

     });



            View hView = convertView;

            if (convertView == null) {

                hView = mInflater.inflate(R.layout.friend_item, null);

                ViewHolder holder = new ViewHolder();

                holder.profile_pic = (ImageView) hView.findViewById(R.id.
profile_pic);

                holder.name = (TextView) hView.findViewById(R.id.name);

                holder.info = (TextView) hView.findViewById(R.id.info);

                hView.setTag(holder);

            }








            ViewHolder holder = (ViewHolder) hView.getTag();

            try {

                    holder.profile_pic.setImageBitmap(Utility.model
.getImage(

                            jsonObject.getString("id"),
jsonObject.getString("picture")));

            } catch (JSONException e) {

                holder.name.setText("");

            }

            try {

                holder.name.setText(jsonObject.getString("name"));

            } catch (JSONException e) {

                holder.name.setText("");

            }

            try {

                    holder.info.setText(jsonObject.getJSONObject("location"
).getString("name"));

            } catch (JSONException e) {

                holder.info.setText("");

            }

            return hView;

        }


    }

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to