Back to project page ImageScanner.
The source code is released under:
Apache License
If you think the Android project ImageScanner listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.example.imagescanner; /* www.j a va 2 s .c o m*/ import android.app.Activity; import android.content.Intent; import android.content.pm.ActivityInfo; import android.graphics.Bitmap; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.view.Window; import android.widget.ImageView; import android.widget.TextView; import com.scanner.utils.ConstantsUtils; import com.scanner.utils.FormatBitmapUtils; public class MainActivity extends Activity { private ImageView image; private TextView hint; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); setContentView(R.layout.activity_main); image = (ImageView) findViewById(R.id.image); hint = (TextView) findViewById(R.id.hint); image.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub if(v.getId() == R.id.image){ Intent intent = new Intent(MainActivity.this, GalleryFolderActivity.class); MainActivity.this.startActivityForResult(intent, ConstantsUtils.REQUEST_FROM_GALLERY); }} }); } @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode != Activity.RESULT_OK) return; switch (requestCode) { case ConstantsUtils.REQUEST_FROM_GALLERY: Bundle bundle = data.getExtras(); String imgUrl = bundle.getString(ConstantsUtils.BUNDLE_IMAGE_PATH_FINAL); Bitmap bm = FormatBitmapUtils.file2Bitmap(imgUrl); image.setImageBitmap(bm); image.setClickable(false); hint.setVisibility(View.INVISIBLE); default: break; } } }