Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Saving overlapped image on SD card
- mybitmap = BitmapFactory.decodeFile(imgfile.getAbsolutePath());
- d = new BitmapDrawable(mybitmap);
- windowwidth = getWindowManager().getDefaultDisplay().getWidth();
- windowheight = getWindowManager().getDefaultDisplay().getHeight();
- female = (ImageView) findViewById(R.id.image);
- female.setBackgroundDrawable(d);
- goggle = (ImageView) findViewById(R.id.image1);
- goggle.setOnTouchListener(this);
- public boolean onTouch(View v, MotionEvent event) {
- switch (v.getId()) {
- case R.id.image1:
- ImageView image1 = (ImageView) findViewById(R.id.image1);
- layoutParams1 = (LayoutParams) image1.getLayoutParams();
- switch (event.getAction()) {
- case MotionEvent.ACTION_DOWN:
- break;
- case MotionEvent.ACTION_MOVE:
- int x_cord = (int) event.getRawX();
- int y_cord = (int) event.getRawY();
- if (x_cord > windowwidth) {
- x_cord = windowwidth;
- }
- if (y_cord > windowheight) {
- y_cord = windowheight;
- }
- layoutParams1.leftMargin = x_cord - 70;
- layoutParams1.topMargin = y_cord - 280;
- image1.setLayoutParams(layoutParams1);
- break;
- default:
- break;
- }
- }
- return true;
- }
- public static Bitmap getBitmapFromURL(String src) {
- try {
- URL url = new URL(src);
- HttpURLConnection connection = (HttpURLConnection) url
- .openConnection();
- connection.setDoInput(true);
- connection.connect();
- InputStream input = connection.getInputStream();
- Bitmap mybitmap = BitmapFactory.decodeStream(input);
- return mybitmap;
- } catch (Exception ex)
- {
- return null;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment