title: Getting Product information like name, price etc using barcode number
body: <p>I am developing an app which uses <code>barcode</code> to get the product information of items after scanning the <code>barcode</code>. </p>
  
  <p>I don't want the user to install <code>ZXing barcode</code> app separately so I embedded the <code>ZXing</code> code into my project. So I was able to obtain the <code>barcode ID number</code>.</p>
  
  <p>I want to get the <strong>product information</strong> like <strong>name, manufacturer, price etc</strong> using the bar code number using <strong>google search api</strong> for shopping.</p>
  
  <p>Here is the code I have used</p>
  
  <pre><code>public class JSONExampleActivity extends Activity {
  
      TextView httpStuff; 
      DefaultHttpClient client; 
      JSONObject json;  
  
      final static String URL = "https://www.googleapis.com/shopping/search"; 
      String upc = "/v1/public/products?country=US&amp;q=691464717759&amp;restrictBy=gtin=691464717759";
  
      /** Called when the activity is first created. */
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main);          
  
          httpStuff = (TextView) findViewById(R.id.tvHttp); 
          client = new DefaultHttpClient(); 
          new Read().execute("items");                
      }
  
      public JSONObject products(String upc)  throws ClientProtocolException, IOException, JSONException {     
          StringBuilder url = new StringBuilder(URL); 
          url.append(upc);
          HttpGet get = new HttpGet(url.toString());     
          HttpResponse r = client.execute(get);   
          int status = r.getStatusLine().getStatusCode(); 
  
          if (status == 200) {
              HttpEntity e = r.getEntity();         
              String data = EntityUtils.toString(e);         
              JSONObject timeline = new JSONObject(data); 
  
              return timeline;    
          } 
          else {         
              Toast.makeText(JSONExampleActivity.this, "error", Toast.LENGTH_SHORT);         
              return null;  
          } 
      }  
  
      public class Read extends AsyncTask&lt;String, Integer, String&gt; {      
          @Override     
          protected String doInBackground(String... params) {         
              // TODO Auto-generated method stub         
              try {                
                  json = products(upc);
                  return json.getString(params[0]);         
              } catch (ClientProtocolException e) {             
                      // TODO Auto-generated catch block             
                      e.printStackTrace();        
              } catch (IOException e) {             
                      // TODO Auto-generated catch block             
                      e.printStackTrace();         
              } catch (JSONException e) {             
                      // TODO Auto-generated catch block            
                      e.printStackTrace();         
              }         
              return null;     
          }  
  
      @Override 
      protected void onPostExecute(String result){     
      httpStuff.setText(result);
      } 
  }
  </code></pre>
  
  <p>But I am not getting any text in httpStuff.</p>
  
  <p>This is the logcat:</p>
  
  <pre><code>D/SntpClient(61): request time failed: java.net.SocketException: Address family not    supported by protocol
  W/System.err(793): org.apache.http.conn.ConnectTimeoutException: Connect to /209.85.175.95:443 timed out
  W/System.err(793):  at org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:121)
  W/System.err(793):  at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:143)
  W/System.err(793):  at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:164)
  W/System.err(793):  at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:119)
  W/System.err(793):  at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:359)
  W/System.err(793):  at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555)
  W/System.err(793):  at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
  W/System.err(793):  at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465)
  W/System.err(793):  at com.android.example.jsonexample.JSONExampleActivity.products(JSONExampleActivity.java:53)
  W/System.err(793):  at com.android.example.jsonexample.JSONExampleActivity$Read.doInBackground(JSONExampleActivity.java:77)
  W/System.err(793):  at com.android.example.jsonexample.JSONExampleActivity$Read.doInBackground(JSONExampleActivity.java:1)
  W/System.err(793):  at android.os.AsyncTask$2.call(AsyncTask.java:185)
  W/System.err(793):  at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:306)
  W/System.err(793):  at java.util.concurrent.FutureTask.run(FutureTask.java:138)
  W/System.err(793):  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088)
  W/System.err(793):  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581)
  W/System.err(793):  at java.lang.Thread.run(Thread.java:1019)
  D/SntpClient(61): request time failed: java.net.SocketException: Address family not supported by protocol
  </code></pre>
  
  <p>Please help me find the reason why I am getting error.</p>