Included the Picasso library from @Droidman. The library is really good. But if I am announcing something wrong, or I am not displaying the picture correctly on the screen. I understand correctly, I can use the object with the received ID in the .into () method? Maybe I haven't connected the library to the end.
package com.example.my_ugf;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.ImageView;
import com.squareup.picasso.Picasso;
public class MainActivity extends AppCompatActivity {
//final public String URL_poster = "https://udmfil.ru/";
public ImageView imageview_poster;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
imageview_poster.findViewById(R.id.imageview_poster);
Picasso.get().load("/upload/iblock/95a/95aa56e9694ebd46e2855e7167966cfd.jpg")
.resize(50, 50)
.centerCrop()
.into(imageview_poster);
}
}
This is what the log produces.
2021-11-17 09:46:20.345 29475-29475/com.example.my_ugf E/libc: Access denied finding property "ro.vendor.df.effect.conflict"
2021-11-17 09:46:20.363 29475-29552/com.example.my_ugf E/Perf: Fail to get file list com.example.my_ugf
2021-11-17 09:46:20.367 29475-29552/com.example.my_ugf E/Perf: getFolderSize() : Exception_1 = java.lang.NullPointerException: Attempt to get length of null array
2021-11-17 09:46:20.451 29475-29475/com.example.my_ugf D/View: com.example.my_ugf initForcedUseForceDark: 1
2021-11-17 09:46:20.614 29475-29475/com.example.my_ugf D/AndroidRuntime: Shutting down VM
2021-11-17 09:46:20.616 29475-29475/com.example.my_ugf E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.my_ugf, PID: 29475
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.my_ugf/com.example.my_ugf.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.View android.widget.ImageView.findViewById(int)' on a null object reference
at android.app.ActivityThread.performLaunchActivity(Unknown Source:621)
at android.app.ActivityThread.handleLaunchActivity(Unknown Source:47)
at android.app.servertransaction.LaunchActivityItem.execute(Unknown Source:63)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(Unknown Source:77)
at android.app.servertransaction.TransactionExecutor.execute(Unknown Source:73)
at android.app.ActivityThread$H.handleMessage(Unknown Source:43)
at android.os.Handler.dispatchMessage(Unknown Source:19)
at android.os.Looper.loop(Unknown Source:242)
at android.app.ActivityThread.main(Unknown Source:98)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(Unknown Source:11)
at com.android.internal.os.ZygoteInit.main(Unknown Source:275)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.View android.widget.ImageView.findViewById(int)' on a null object reference
at com.example.my_ugf.MainActivity.onCreate(MainActivity.java:18)
at android.app.Activity.performCreate(Unknown Source:19)
at android.app.Activity.performCreate(Unknown Source:1)
at android.app.Instrumentation.callActivityOnCreate(Unknown Source:3)
at android.app.ActivityThread.performLaunchActivity(Unknown Source:376)
at android.app.ActivityThread.handleLaunchActivity(Unknown Source:47)
at android.app.servertransaction.LaunchActivityItem.execute(Unknown Source:63)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(Unknown Source:77)
at android.app.servertransaction.TransactionExecutor.execute(Unknown Source:73)
at android.app.ActivityThread$H.handleMessage(Unknown Source:43)
at android.os.Handler.dispatchMessage(Unknown Source:19)
at android.os.Looper.loop(Unknown Source:242)
at android.app.ActivityThread.main(Unknown Source:98)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(Unknown Source:11)
at com.android.internal.os.ZygoteInit.main(Unknown Source:275)
2021-11-17 09:46:20.624 29475-29475/com.example.my_ugf E/MQSEventManagerDelegate: failed to get MQSService.
2021-11-17 09:46:20.625 29475-29475/? D/OOMEventManagerFK: checkEventAndDumpForJE: 0
2021-11-17 09:46:20.625 29475-29475/? E/MQSEventManagerDelegate: failed to get MQSService.
2021-11-17 09:46:20.653 29475-29475/? I/Process: Sending signal. PID: 29475 SIG: 9
2021-11-17 09:46:19.865 29475-29475/? I/.example.my_ug: Late-enabling -Xcheck:jni
2021-11-17 09:46:19.894 29475-29475/? E/.example.my_ug: Unknown bits set in runtime_flags: 0x8000
2021-11-17 09:46:19.865 29475-29475/? I/.example.my_ug: Late-enabling -Xcheck:jni
2021-11-17 09:46:19.894 29475-29475/? E/.example.my_ug: Unknown bits set in runtime_flags: 0x8000
2021-11-17 09:46:19.865 29475-29475/? I/.example.my_ug: Late-enabling -Xcheck:jni
2021-11-17 09:46:19.894 29475-29475/? E/.example.my_ug: Unknown bits set in runtime_flags: 0x8000