下面贴上工程代码,麻烦各位帮忙修改package com.example.gsbtest;import java.io.FileNotFoundException;
import java.io.InputStream;import android.net.Uri;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.util.Log;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;public class MainActivity extends Activity { Button btn0,btn1;
TextView Text1;
Bitmap bmp, bitmap ;//选择了图片后调用
ImageView imageView;    @Override
    protected void onCreate(Bundle savedInstanceState) 
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        
        btn0 = (Button)findViewById(R.id.b01);
        btn0.setText("select image");
        btn1 = (Button)findViewById(R.id.sufflebtn);
        
        btn0.setOnClickListener(new OnClickListener(){
        
         public void onClick(View v){
         Intent intent = new Intent();
         intent.setType("image/*");
         intent.setAction(Intent.ACTION_GET_CONTENT);
         startActivityForResult(intent,1);
         }
        });
        
        btn1.setOnClickListener(new OnClickListener(){
       
         @Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
         Text1 = (TextView)findViewById(R.id.Txt1);
         if(bitmap==null || bitmap.isRecycled() ) 
         return;
//         try{
         suffleImageRGB(bitmap);
//         }catch(Exception ex){
//         Log.e("Exception", ex.getMessage(),ex);  
//         }
}
        });
        
    }    protected void onActivityResult(int requestCode, int resultCode, Intent data) 
    {  
        if (resultCode == RESULT_OK) {  
            Uri uri = data.getData();  
            Log.e("uri", uri.toString());  
            android.content.ContentResolver cr = this.getContentResolver();  
            try {  
            
                bitmap = BitmapFactory.decodeStream((InputStream) cr.openInputStream(uri));  
                imageView = (ImageView) findViewById(R.id.iv01);  
                /* 将Bitmap设定到ImageView */  
                imageView.setImageBitmap(bitmap);  
            } catch (FileNotFoundException e) {  
                Log.e("Exception", e.getMessage(),e);  
            }  
        }  
        super.onActivityResult(requestCode, resultCode, data);  
    }  
    
    void suffleImageRGB(Bitmap bmp) 
    {    
    
    
     int w = bmp.getWidth();     
     int h = bmp.getHeight();     
     int color=0,r=0,g=0,b=0;     
 
     for(int x=0; x<w; x++)
     {          
     for(int y=0 ;y<h; y++)
     {             
     color = bmp.getPixel(x, y);       
     r = Color.red(color);             
     g = Color.green(color);             
     b = Color.blue(color);  
     bmp.setPixel(x,y,Color.argb(Color.alpha(color), b,g ,r ) );//R->G->B->R        }    }   } 
     imageView.setImageBitmap(bmp);
     }
     }
    }
        @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }
    
}