In the Order and Export tab, make sure all the check boxes for the jar files that have been added are selected.
CPU | Folder Name |
Arm | armeabi |
Arm-v7a | armeabi-v7a |
Mips | mips |
X86 | x86 |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="1.0"
android:background="@android:color/black">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Select Image From Gallery"
android:onClick="onSelectImage"/>
<leadtools.controls.RasterImageViewer
android:id="@+id/imageviewer"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight=".96"
android:background="@android:color/white"/>
</LinearLayout>
import android.view.View;
import android.widget.Toast;
import leadtools.ILeadStream;
import leadtools.LeadStreamFactory;
import leadtools.RasterImage;
import leadtools.RasterSupport;
import leadtools.codecs.RasterCodecs;
import leadtools.controls.ImageViewerPanZoomInteractiveMode;
import leadtools.controls.RasterImageViewer;
private static final int IMAGE_GALLERY = 0x0001;
private RasterImageViewer mViewer;
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// RasterSupport
RasterSupport.initialize(this);
// Init viewer
mViewer = (RasterImageViewer) findViewById(R.id.imageviewer);
mViewer.setTouchInteractiveMode(new ImageViewerPanZoomInteractiveMode());
public void onSelectImage(View v)
{
Intent gallery = new Intent(Intent.ACTION_PICK, Media.EXTERNAL_CONTENT_URI);
startActivityForResult(gallery, IMAGE_GALLERY);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data)
{
if (resultCode == RESULT_OK)
{
if(requestCode == IMAGE_GALLERY)
{
Uri imageUri = data.getData();
try
{
// Create Lead Stream
ILeadStream stream = LeadStreamFactory.create(getContentResolver().openInputStream(imageUri), true);
// Create RasterCodecs
RasterCodecs codecs = new RasterCodecs(String.format("%s/lib/", getApplicationInfo().dataDir));
// Load image
RasterImage image = codecs.load(stream);
// Set the loaded image in the viewer
mViewer.setImage(image);
}
catch(Exception ex)
{
Toast.makeText(this, ex.getMessage(), Toast.LENGTH_LONG).show();
}
}
}
}