ここの回答に従って、ImageView から TouchImageView に変換することで、画像ビューアーのアクティビティを改善しようとしています:画像のズーム機能を取得するにはどうすればよいですか?
ただし、アクティビティを読み込もうとするとエラーが発生します。
バイナリ XML ファイルの 15 行目: クラス TouchImageView の拡張中にエラーが発生しました
これが私のimage_viewer.xmlです:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:gravity="center"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<!--
<WebView
android:id="@+id/webView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
-->
<TouchImageView
android:id="@+id/imageView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</RelativeLayout>
そして、ImageViewer.javaの onCreate 内の私のコード(ただし、実行がここまで到達することはないと確信しています):
if(filepath != null && filepath.length() > 0 && new File(filepath).exists())
{
Bitmap myBitmap = BitmapFactory.decodeFile(filepath);
TouchImageView imgView = (TouchImageView) findViewById(R.id.imageView1);
imgView.setImageBitmap(myBitmap);
}
なぜ、または何がこのエラーを引き起こしているのかについてのアイデアはありますか? 私が見たのは、最も内側の例外/原因でした。エラーの詳細を取得する方法がわかりません。
前もって感謝します。
更新:
この行の実行時に例外がスローされます。
setContentView(R.layout.image_viewer);
エラーの詳細:
java.lang.ClassNotFoundException: ローダーの android.view.TouchImageView dalvik.system.PathClassLoader@44bfde70