Android 使用Google 3D饼图工具时出现空指针异常?

Android 使用Google 3D饼图工具时出现空指针异常?,android,image,http,bitmap,Android,Image,Http,Bitmap,我在这里使用完全相同的代码 要在我的项目中显示三维饼图。。代码没问题。我得到了正确的URL日志,当我使用浏览器中的链接时,它会正确显示图表。。但是,当我试图通过将图像转换为位图来向应用程序内的图像视图显示图像时,会出现空指针异常 private Bitmap loadChart(String urlRqs){ Bitmap bm = null; InputStream inputStream = null; try { **inputStream = OpenHttpCon

我在这里使用完全相同的代码

要在我的项目中显示三维饼图。。代码没问题。我得到了正确的URL日志,当我使用浏览器中的链接时,它会正确显示图表。。但是,当我试图通过将图像转换为位图来向应用程序内的图像视图显示图像时,会出现空指针异常

private Bitmap loadChart(String urlRqs){
  Bitmap bm = null;
  InputStream inputStream = null;

  try {
   **inputStream = OpenHttpConnection(urlRqs);
   bm = BitmapFactory.decodeStream(inputStream);
   inputStream.close();**
  } catch (IOException e) {
   // TODO Auto-generated catch block
   e.printStackTrace();
  }

  return bm;
 }

 private InputStream OpenHttpConnection(String strURL) throws IOException{
  InputStream is = null;
  URL url = new URL(strURL);
  URLConnection urlConnection = url.openConnection();

  try{
   HttpURLConnection httpConn = (HttpURLConnection)urlConnection;
   httpConn.setRequestMethod("GET";
   httpConn.connect();

   if (httpConn.getResponseCode() == HttpURLConnection.HTTP_OK) {
    is = httpConn.getInputStream(); 
   }
  }catch (Exception ex){
  }

  return is; 
 }

试着在一个异步任务中打这些电话,你能帮我吗?Thanx先生,问题解决了。你能告诉我如何改变图表的颜色吗???