2
我試圖使用picasso將圖像從存儲器中獲取到imageview,但它不會顯示該照片。從url中獲取圖像是可以的,這意味着畢加索正常工作。請告訴我我做錯了什麼?謝謝。使用picasso將圖像加載到imageview
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_cam);
imageView = (ImageView) findViewById(R.id.image_view1);
String filename = "full.jpg";
String path = "sdcard/camera_app" + filename;
Picasso.with(CamActivity.this)
.load(new File(path)) //File of the image to load.
.into(imageView);
//Picasso.with(CamActivity.this).load("http://square.github.io/picasso/static/sample.png").into(imageView);
在清單文件中,一切都被添加了寫入,讀取,互聯網。
也試過
String filename = "lapin-rose.jpg";
String baseDir = Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator+ filename;
Picasso.with(this).load(new File(baseDir)).into(imageView);
沒有什麼變化。請幫助。
XML
<Button
android:id="@+id/btnTakePicture"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginTop="10dp"
android:text="picture">
</Button>
<ImageView
android:layout_width="fill_parent"
android:layout_height="273dp"
app:srcCompat="@mipmap/ic_launcher"
android:id="@+id/image_view1"
android:layout_marginTop="60dp"
android:scaleType="fitStart"
android:adjustViewBounds="true"/>
</FrameLayout>
嗨!謝謝你的回答,問題解決了,應用程序中出現了愚蠢的錯誤,沒有開啓記憶功能。 – Rufat