I want to parse the JSON response by url, but I always had an error. I tried so much, but could not solve the problem. Please suggest me fix the errors.
My JSON answer:
{ "classification": { "relevancyScore": 999, "searchUrl": { "value": "http://www.bizrate.com/iphone-cases/index__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html" } }, [.. hundreds of lines removed ..]
My code is:
public class test extends Activity { @SuppressWarnings({ "rawtypes", "unchecked" }) @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); ListView lv = (ListView)findViewById(R.id.listView1); lv.setAdapter(new ArrayAdapter(this, android.R.layout.simple_list_item_1, this.fetchTwitterPublicTimeline())); } public ArrayList<String> fetchTwitterPublicTimeline() { ArrayList<String> listItems = new ArrayList<String>(); try { URL twitter = new URL( "http://catalog.bizrate.com/services/catalog/v1/us/product?publisherId=50085&placementId=1&categoryId=1&keyword=iphone+cases&start=0&results=10&sort=relevancy_desc&brandId=&attFilter=&zipCode=90291&biddedOnly=&minRelevancyScore=100&apiKey=58f536aa2fab110bbe0da501150bac1e&format=json"); URLConnection tc = twitter.openConnection(); BufferedReader in = new BufferedReader(new InputStreamReader( tc.getInputStream())); String line; String str; while ((line = in.readLine()) != null) {
I need to parse information on all products.
source share