Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 15th, 2012  |  syntax: None  |  size: 1.79 KB  |  hits: 16  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Saving overlapped image on SD card
  2. mybitmap = BitmapFactory.decodeFile(imgfile.getAbsolutePath());
  3.  
  4.     d = new BitmapDrawable(mybitmap);
  5.  
  6.     windowwidth = getWindowManager().getDefaultDisplay().getWidth();
  7.  
  8.     windowheight = getWindowManager().getDefaultDisplay().getHeight();
  9.  
  10.     female = (ImageView) findViewById(R.id.image);
  11.  
  12.     female.setBackgroundDrawable(d);
  13.  
  14.  
  15.     goggle = (ImageView) findViewById(R.id.image1);
  16.  
  17.     goggle.setOnTouchListener(this);
  18.  
  19.  
  20.  
  21.  
  22. public boolean onTouch(View v, MotionEvent event) {
  23.     switch (v.getId()) {
  24.  
  25.     case R.id.image1:
  26.         ImageView image1 = (ImageView) findViewById(R.id.image1);
  27.         layoutParams1 = (LayoutParams) image1.getLayoutParams();
  28.         switch (event.getAction()) {
  29.         case MotionEvent.ACTION_DOWN:
  30.             break;
  31.         case MotionEvent.ACTION_MOVE:
  32.             int x_cord = (int) event.getRawX();
  33.             int y_cord = (int) event.getRawY();
  34.  
  35.             if (x_cord > windowwidth) {
  36.                 x_cord = windowwidth;
  37.             }
  38.             if (y_cord > windowheight) {
  39.                 y_cord = windowheight;
  40.             }
  41.  
  42.             layoutParams1.leftMargin = x_cord - 70;
  43.             layoutParams1.topMargin = y_cord - 280;
  44.  
  45.             image1.setLayoutParams(layoutParams1);
  46.             break;
  47.         default:
  48.             break;
  49.         }
  50.     }
  51.     return true;
  52. }
  53. public static Bitmap getBitmapFromURL(String src) {
  54.     try {
  55.  
  56.         URL url = new URL(src);
  57.         HttpURLConnection connection = (HttpURLConnection) url
  58.                 .openConnection();
  59.         connection.setDoInput(true);
  60.         connection.connect();
  61.         InputStream input = connection.getInputStream();
  62.         Bitmap mybitmap = BitmapFactory.decodeStream(input);
  63.  
  64.         return mybitmap;
  65.  
  66.     } catch (Exception ex)
  67.     {
  68.  
  69.         return null;
  70.     }
  71.  
  72. }
  73. }