title: How to arrange dynamical images?
body: <p>Can any body tell me to how to arrange on the image, if I change to one activity to another activity. My code is</p>
  
  <pre><code>public class Small extends Activity { 
  
  // Instance variables
  private Paint       mPaint,mBitmapPaint;
  private MyView      mView;
  private Bitmap  mBitmap;
  private Canvas  mCanvas;
  private Path    mPath;
  public View onDraw;  
  
  public void onCreate(Bundle savedInstanceState) {       
      super.onCreate(savedInstanceState);
      setContentView(R.layout.small);  
  
      setVolumeControlStream(AudioManager.STREAM_MUSIC);          
      imageview = (ImageView)findViewById(R.id.image);
      imageview1 = (ImageView)findViewById(R.id.ic_launcer);      
      forword = (ImageButton)findViewById(R.id.forword);
      back = (ImageButton)findViewById(R.id.back);
      relativelayout = (RelativeLayout)findViewById(R.id.item);
      //select_color = (ImageButton) findViewById(R.id.color);
  
  
  
      DisplayMetrics metrics = getBaseContext().getResources().getDisplayMetrics();         
      int w = metrics.widthPixels;
      int h = metrics.heightPixels;
  
      System.out.println(" width "+w);
      System.out.println(" height "+h);
  
      mView = new MyView(this, w, h);
      mView.setDrawingCacheEnabled(true);    
      mView.invalidate();
  
      mPaint = new Paint();
      mPaint.setAntiAlias(true);
      mPaint.setDither(true);
      mPaint.setColor(Color.GREEN);
      mPaint.setStyle(Paint.Style.STROKE);
      mPaint.setStrokeJoin(Paint.Join.ROUND);
      mPaint.setStrokeCap(Paint.Cap.ROUND);
      mPaint.setStrokeWidth(5);       
  
  
      ImageButton coler = (ImageButton)findViewById(R.id.color);
      coler.setOnClickListener(new View.OnClickListener() {
  
          public void onClick(View v) {
              int _color = R.color.red;
              new ColorPickerDialog(v.getContext(),new OnColorChangedListener() {
  
                    public void colorChanged(int color) {                     
                        mPaint.setColor(color);
                     }
  
                 }, mPaint.getColor(), _color).show();
  
              //new ColorPickerDialog(v.getContext(),new OnColorChangedListener(), mPaint.getColor(), _color).show();
          }
      });
  
      ImageButton round = (ImageButton)findViewById(R.id.round);
      round.setOnClickListener(new View.OnClickListener() {
  
          public void onClick(View v) {
              Intent i = new Intent(Small.this,Flipper.class);
              startActivity(i);
          }
      });      
  
  
      relativelayout.addView(mView);  
  }
  
      ///////  colour changed function, getting value from ColorPickerDialog   ///////
      public void colorChanged(int color) {
          mPaint.setColor(color);
  }
  
  private void setimage(int i) {
  
      present = i;
  
      switch(i) {
  
      case 1:
          imageview.setBackgroundResource(R.drawable.a); 
          imageview1.setBackgroundResource(R.drawable.arrow27);   
          break;
      case 2:
          imageview.setBackgroundResource(R.drawable.b);
          imageview1.setBackgroundResource(R.drawable.arrow28);
          break;               
  </code></pre>
  
  <p>flipper.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"  &gt;          
   &lt;ViewFlipper
      android:id="@+id/viewFlipper" android:layout_width="match_parent"
      android:layout_height="fill_parent"  &gt;    
   &lt;/ViewFlipper&gt;      
    &lt;LinearLayout
      android:id="@+id/relativelayout"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:layout_alignParentRight="true"
      android:orientation="horizontal" &gt;   
   &lt;ImageButton
      android:id="@+id/round"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_alignParentRight="true"
      android:layout_alignParentTop="true"
      android:background="@drawable/round" /&gt;     
    &lt;/LinearLayout&gt;      
  
   &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>flipper.java</p>
  
  <pre><code>   public  class Flipper extends Activity implements OnClickListener {
     /** Called when the activity is first created. */    
  
      ViewFlipper Flipp;   
  
      public int[][] img_array=new int[][]{
               {R.drawable.flipimage_1_1,R.drawable.flipimage_1_2,R.drawable.flipimage_1_3, R.drawable.flipimage_1_4,R.drawable.flipimage_1_5,R.drawable.flipimage_1_6},
          {R.drawable.flipimage_2_1,R.drawable.flipimage_2_2,R.drawable.flipimage_2_3, R.drawable.flipimage_2_4},
          {R.drawable.flipimage_3_1,R.drawable.flipimage_3_2,R.drawable.flipimage_3_3, R.drawable.flipimage_3_4},
          {R.drawable.flipimage_4_1,R.drawable.flipimage_4_2,R.drawable.flipimage_4_3, R.drawable.flipimage_4_4},
          {R.drawable.flipimage_5_1,R.drawable.flipimage_5_2,R.drawable.flipimage_5_3, R.drawable.flipimage_5_4},
          {R.drawable.flipimage_6_1,R.drawable.flipimage_6_2,R.drawable.flipimage_6_3, R.drawable.flipimage_6_4},
  
      };
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.flipper);
  
          Intent intent=getIntent();
          int selected=intent.getIntExtra("SELECTED", 0);
          int[] imgIds=img_array[selected];
          Flipp = (ViewFlipper)findViewById(R.id.viewFlipper);
          for(int i=0; i&lt;imgIds.length;i++)
          {
              ImageView imgView=new ImageView(this);
              imgView.setImageResource(imgIds[i]);
              Flipp.addView(imgView);
          }
  
          Flipp.setOnClickListener(this);  
      }
  
      public void onClick(View v) {
          // TODO Auto-generated method stub
          Flipp.showNext();   
  
          ImageButton round = (ImageButton)findViewById(R.id.round);
          round.setOnClickListener(new View.OnClickListener() {       
              public void onClick(View v) {
                  finish();
  
                  //Intent i = new Intent(Flipper.this,Small.class);
                  //startActivity(i);
  
              }
          });
      }   
  }
  </code></pre>