Skip to main content

Android - Zoom Image Using Intent





create Activity add this code :


 package com.zoomimage;  
 import java.io.File;  
 import android.app.Activity;  
 import android.content.Intent;  
 import android.net.Uri;  
 import android.os.Bundle;  
 import android.view.View;  
 import android.view.View.OnClickListener;  
 import android.widget.Button;  
 import android.widget.ImageView;  
 import android.widget.Toast;  
 public class ZoomimageActivity extends Activity {  
      private ImageView imagev;  
      private Uri uri_img;  
      private Button btnZ;  
      private String mimetype;  
      /** Called when the activity is first created. */  
      @Override  
      public void onCreate(Bundle savedInstanceState) {  
           super.onCreate(savedInstanceState);  
           setContentView(R.layout.main);  
           imagev = (ImageView) findViewById(R.id.imageView1);  
           // imagev.setImageUri(Uri.fromFile(new File("/sdcard/test.jpg")));  
           // imagev.setImageUri(Uri.parse(new File("/sdcard/cats.jpg").toString()));  
           uri_img = Uri.fromFile(new File("/sdcard/test.jpg"));  
           imagev.setImageURI(uri_img);  
           String extension = android.webkit.MimeTypeMap  
                     .getFileExtensionFromUrl(uri_img.toString());  
           mimetype = android.webkit.MimeTypeMap.getSingleton()  
                     .getMimeTypeFromExtension(extension);  
           btnZ = (Button) findViewById(R.id.button1);  
           btnZ.setOnClickListener(new OnClickListener() {  
                @Override  
                public void onClick(View v) {  
                     // TODO Auto-generated method stub  
                     Toast.makeText(ZoomimageActivity.this, "Please wait..",  
                               Toast.LENGTH_SHORT).show();  
                     Intent i = new Intent(android.content.Intent.ACTION_VIEW);  
                     i.setDataAndType(uri_img, mimetype);  
                     startActivity(i);  
                }  
           });  
      }  
 }  

Enjoy Coding....

Comments

Popular posts from this blog

Android - Google MAP V2 PART 3 (add Polyline)

Download Full Code  of  PART-1 , 2 , 3 , 4 Before go ahead Please look in to PART-1 & PART-2 I have just modify Main Activity class: package com.djandroid.mapsv2; import android.graphics.Color; import android.os.Bundle; import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentManager; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.GoogleMap.OnMapClickListener; import com.google.android.gms.maps.GoogleMap.OnMarkerClickListener; import com.google.android.gms.maps.SupportMapFragment; import com.google.android.gms.maps.model.LatLng; import com.google.android.gms.maps.model.Marker; import com.google.android.gms.maps.model.MarkerOptions; import com.google.android.gms.maps.model.Polyline; import com.google.android.gms.maps.model.PolylineOptions; public class MainActivity extends FragmentActivity { private GoogleMap MAP; private boolean markClic...

Android Material Design - 2 (Good bay ActionBar, Hello ToolBar with Navigation Drawer)

hello all, after long time i have update my blog with android material Design theme, i am tying to demonstrate new things which is available with android lollipop. using different example i 'll show you, one sample app with material design which include ToolBar, Floting Actions, Tabs, Cardview, Recycle view. Download full example on  Github . In this example we will take a look at the new Actionbar replacement called Toolbar. It is introduced in Android Lollipop, API level 21 release, and hence it is available to use, out of box for the application that are targeted to 21 and above. However, as always Google provides fully supported Toolbar features to lower android os devices via AppCompact support library. In AppCompat, Toolbar is implemented in the  android.support.v7.widget.Toolbar  class. Pre-requirements: 1. Android Studio 1.0.1 (Latest while writing the post) 2. Appcombat v7 Support librar...

Android - Google MAP V2 PART 1

Download Full Code  of PART-1 , 2 , 3 , 4 Download and configure Google Play Services Library in Eclipse Google Map for Android is now integrated with Google Play Services. So we need to set up Google Play Service Library for developing Google Map application in Android. Get the API key for Google Maps v2: Linux  :  For any other OS use this :  keytool -list -v -alias androiddebugkey \ -keystore <path_to_debug_keystore>debug.keystore \ -storepass android -keypass android Register with the Google APIs Console :    Google APIs Console  Select here the  Services  entry: Activate the  Google Maps Android API v2 . Register your application via its package in this console together with the SHA-1 fingerprint of your signature key. Click on Create new Android Key.. Add you SHA-1 and your package name in to box like example given in alert box. Support library...