I have done the following. But still i cant get the result... Can
anyone help me determine what the error is...Plzzzz help me out...

public class AlertsAdd {
        public ArrayList<JSONObject> retrieveJSONArray(String urlString) {
            String result = queryRESTurl(urlString);
            ArrayList<JSONObject> ALERTS = new ArrayList<JSONObject>();
            if (result != null) {

                try {
                    JSONObject json = new JSONObject(result);
                    Log.i("Info",json.toString());

                    JSONObject alertsObject = json.getJSONObject("alertid");
                    ALERTS.add(alertsObject);

                    return ALERTS;
                } catch (JSONException e) {
                    Log.e("JSON", "There was an error parsing the JSON",
e);
                }
            }
            JSONObject myObject = new JSONObject();
            try {
                myObject.put("Alert Id",myObject.getJSONArray("alertid"));
                ALERTS.add(myObject);
            } catch (JSONException e1) {
                Log.e("JSON", "There was an error creating the JSONObject",
e1);
            }
            return ALERTS;
        }


public class AlertsAdapter extends ArrayAdapter<JSONObject> {
        public AlertsAdapter(Activity activity, List<JSONObject> alerts) {
        super(activity, 0, alerts);
    }
         @Override
            public View getView(int position, View convertView, ViewGroup
parent) {
                Activity activity = (Activity) getContext();
                LayoutInflater inflater = activity.getLayoutInflater();
                View rowView = inflater.inflate(R.layout.list_text, null);
                JSONObject imageAndText = getItem(position);
                TextView textView = (TextView)
rowView.findViewById(R.id.last_build_stat);
                try {
                                
textView.setText((String)imageAndText.get("alertid"));
                        } catch (JSONException e) {
                                textView.setText("JSON Exception");
                        }

                return rowView;
            }

-- 
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