3
是否可以打开一个图片,该图片存储在resview/drawable文件夹中与Android构建在图像查看器?我不明白它的工作。我试过follwoing方式打开图片存储在res/drawable与buildin Android图像查看器
Button ButtonPhase2 = (Button) findViewById(R.id.button1);
ButtonPhase2.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
Intent myIntent = new Intent(android.content.Intent.ACTION_VIEW);
myIntent.setData(Uri.parse("android.resource://de.test.app/" + R.drawable.testbild));
myIntent.setType("image/png");
startActivityForResult(myIntent, 1);
}
});
但我得到的错误:
Unable to start Activity ComponentInfo{com.android.gallery/com.android.camera.ViewImage}: java.lang.nullPointerException
我认为这是错误的道路?
你可能请更准确地定义这一点,因为当我这样做时,当我点击图标时,不会在构建Android图像查看器中打开某些内容。 – Samson
我已更新我的代码 –