开发者

Android Zooming For Graphs

I need to implement zoom functionality for graphs which are retrieving from web. These graphs are from php web-server so how to implement zooming functionality to these graphs. Any one can help me to come out from this issue. This is my java class code for retriving graphs from web.

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

                localPalladium1DButton.setBackgroundResource(R.drawable开发者_C百科.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;
    }

Thanks,

Murali.


Take a look at http://code.google.com/p/android-pinch/: it has code to implement zooming using pinch.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜