Я хотел загрузить изображения из Url в простой просмотр изображений с помощью Picasso. Но, к сожалению, я столкнулся с некоторыми проблемами. Я включил журналы ниже и соответствующий код. Я дал Inte rnet разрешение и использую последнюю сборку Picasso.
введите описание изображения здесь
MainActivity. java
package com.example.picassotest;
import androidx.appcompat.app.AppCompatActivity;
import android.net.Uri;
import android.os.Bundle;
import android.widget.ImageView;
import android.widget.TextView;
import com.squareup.picasso.Picasso;
import org.w3c.dom.Text;
public class MainActivity extends AppCompatActivity {
ImageView imgView;
TextView txtView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
imgView = findViewById(R.id.img_view);
txtView = findViewById(R.id.txtview);
Picasso.get().setLoggingEnabled(true);
Picasso.get().load("https://images.unsplash.com/photo-1500100586562-f75ff6540087?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=3589&q=80").into(imgView);
}
}
Activity_main. xml
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<ImageView
android:id="@+id/img_view"
app:layout_constraintStart_toStartOf="@id/img_view"
app:layout_constraintTop_toTopOf="parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="@mipmap/ic_launcher_round"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/txtview"
app:layout_constraintTop_toBottomOf="@id/img_view"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:text="Hey"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
Журналы
Ссылка: https://pastebin.com/820tP9Jd