2011-07-16 46 views
0

我需要为从Web上检索的图表实现缩放功能。这些图来自php web-server,所以如何实现这些图的缩放功能。任何人都可以帮助我从这个问题中走出来。这是我从web上获取图表的java类代码。Android Zooming For Graphs

localPalladium1YButton.setOnClickListener(new View.OnClickListener() {  
      public void onClick(View view) 
      { 

       localPalladium1DButton.setBackgroundResource(R.drawable.onedicon); 
       localPalladium5DButton.setBackgroundResource(R.drawable.fived); 
       localPalladium1MButton.setBackgroundResource(R.drawable.whitem); 
       localPalladium1YButton.setBackgroundResource(R.drawable.yover); 

       android.view.View.OnClickListener getImgListener = null; 
       localPalladium1YButton.setOnClickListener(getImgListener); 
       Bitmap palladiumBitmap3=fetchImage(PalladiumImageUrl4.trim());   
       localPalladiumImageView.setImageBitmap(palladiumBitmap3); 
       mSoundManager.playSound(1); 
      } 

     }); 

.................................. 
.................................. 
.................................. 


Bitmap bmImg; 
          void downloadFile(String fileUrl){ 
          URL myFileUrl =null; 

          try { 

           myFileUrl= new URL(fileUrl); 

            } 
          catch (MalformedURLException e) 
           {        
            // TODO Auto-generated catch block      
            e.printStackTrace(); 
           } 

          try { 

           String url1 = "my url"; 
           URL url = new URL(url1); 
           URLConnection conn = url.openConnection(); 
           conn.connect(); 
           InputStream is = conn.getInputStream(); 
           BufferedInputStream bis = new BufferedInputStream(is); 
           BitmapFactory.Options bf = new BitmapFactory.Options(); 
           Bitmap bm = BitmapFactory.decodeStream(bis); 
           ImageView localGoldImageView = null; 
           localGoldImageView.setImageBitmap(bm); 

           } catch (IOException e) { 
             // TODO Auto-generated catch block 
            e.printStackTrace(); 
             } 
          } 





    Bitmap fetchImage(String urlstr) 
    { 
     try 
     { 
      URL url; 
      url = new URL(urlstr); 

      HttpURLConnection c = (HttpURLConnection) url.openConnection(); 
      c.setDoInput(true); 
      c.connect(); 
      InputStream is = c.getInputStream(); 
      Bitmap img; 
      img = BitmapFactory.decodeStream(is); 
      return img; 
     } 
     catch (MalformedURLException e) 
     { 
      Log.d("RemoteImageHandler", "fetchImage passed invalid URL: " + urlstr); 
      e.printStackTrace(); 
     } 
     catch (IOException e) 
     { 
      Log.d("RemoteImageHandler", "fetchImage IO exception: " + e); 
      e.printStackTrace(); 
     } 
     return null; 
    } 

感谢,

穆拉利。

回答