title: Java Android method taking a long time to execute?
body: <p>I'm creating a very simple app that changes a pictures color to a sepia filter when pressed. When I run the app everything works but it takes close to a minute for the image to change. Can you take a quick look at my code and see if you can tell me why?</p>
  
  <pre><code>public class Pictue extends ActionBarActivity {
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_pictue);
          ImageButton button = (ImageButton) findViewById(R.id.imageButton1);
          button.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  Bitmap b1 =  BitmapFactory.decodeResource(getResources(), R.drawable.chin);
                  b1 = createSepiaToningEffect(b1,10,7.00,6.00,3.00);
                  ImageView chin = (ImageView) findViewById(R.id.imageView1)  ;
                  chin.setImageBitmap(b1);
              }   
          });
      }
  
      public static Bitmap createSepiaToningEffect(Bitmap src, int depth, double red, double green, double blue) {
          int width = src.getWidth();
          int height = src.getHeight();
          Bitmap bmOut = Bitmap.createBitmap(width, height, src.getConfig());
          final double GS_RED = 0.3;
          final double GS_GREEN = 0.59;
          final double GS_BLUE = 0.11;
          int A, R, G, B;
          int pixel;
  
          for(int x = 0; x &lt; width; ++x) {
              for(int y = 0; y &lt; height; ++y) {
                  pixel = src.getPixel(x, y);
                  A = Color.alpha(pixel);
                  R = Color.red(pixel);
                  G = Color.green(pixel);
                  B = Color.blue(pixel);
                  B = G = R = (int)(GS_RED * R + GS_GREEN * G + GS_BLUE * B);
  
                  // apply intensity level for sepid-toning on each channel
                  R += (depth * red);
                  if(R &gt; 255) { R = 255; }
  
                  G += (depth * green);
                  if(G &gt; 255) { G = 255; }
  
                  B += (depth * blue);
                  if(B &gt; 255) { B = 255; }
  
                  bmOut.setPixel(x, y, Color.argb(A, R, G, B));
              }
          }
  
          return bmOut;
  }
  }   
  </code></pre>