请给我帮助。在这部分中我仍然是错误,并且我尝试运行,但是仍然有错误。 当我从URL加载图像时,会出现以下问题:
java.io.FileNotFoundException: open failed: ENOENT (No such file or directory)
at android.os.ParcelFileDescriptor.openInternal(ParcelFileDescriptor.java:313)
at android.os.ParcelFileDescriptor.open(ParcelFileDescriptor.java:211)
at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:1242)
at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:1170)
at com.bumptech.glide.load.data.FileDescriptorLocalUriFetcher.loadResource(FileDescriptorLocalUriFetcher.java:22)
at com.bumptech.glide.load.data.FileDescriptorLocalUriFetcher.loadResource(FileDescriptorLocalUriFetcher.java:14)
at com.bumptech.glide.load.data.LocalUriFetcher.loadData(LocalUriFetcher.java:43)
at com.bumptech.glide.load.model.MultiModelLoader$MultiFetcher.loadData(MultiModelLoader.java:96)
at com.bumptech.glide.load.engine.SourceGenerator.startNext(SourceGenerator.java:61)
at com.bumptech.glide.load.engine.DecodeJob.runGenerators(DecodeJob.java:303)
at com.bumptech.glide.load.engine.DecodeJob.onDataFetcherFailed(DecodeJob.java:398)
at com.bumptech.glide.load.engine.SourceGenerator.onLoadFailed(SourceGenerator.java:118)
at com.bumptech.glide.load.model.MultiModelLoader$MultiFetcher.startNextOrFail(MultiModelLoader.java:150)
at com.bumptech.glide.load.model.MultiModelLoader$MultiFetcher.onLoadFailed(MultiModelLoader.java:141)
at com.bumptech.glide.load.data.LocalUriFetcher.loadData(LocalUriFetcher.java:48)
at com.bumptech.glide.load.model.MultiModelLoader$MultiFetcher.loadData(MultiModelLoader.java:96)
at com.bumptech.glide.load.engine.SourceGenerator.startNext(SourceGenerator.java:61)
at com.bumptech.glide.load.engine.DecodeJob.runGenerators(DecodeJob.java:303)
at com.bumptech.glide.load.engine.DecodeJob.runWrapped(DecodeJob.java:273)
at com.bumptech.glide.load.engine.DecodeJob.run(DecodeJob.java:234)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:764)
at com.bumptech.glide.load.engine.executor.GlideExecutor$DefaultThreadFactory$1.run(GlideExecutor.java:445)
我需要帮助。这是我的Java类。我不知道错误在哪里。我还添加了它:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
公共类But1_room扩展了AppCompatActivity {
private static final String TAG = "But1_room";
//Vars
private ArrayList<String> mNames = new ArrayList<>();
private ArrayList<String> mImageUrls = new ArrayList<>();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_but1_room);
Log.d(TAG, "onCreate: started.");
initImageBitmaps();
}
private void initImageBitmaps()
{
Log.d(TAG, "initImageBitmaps: preparing bitmaps");
mImageUrls.add("https://www.google.com/search?q=habitaciones&source=lnms&tbm=isch&sa=X&ved=0ahUKEwimgMjLjL3eAhXEVN8KHYntAwEQ_AUIDigB&biw=1364&bih=666#");
mNames.add("Habitación 1");
mImageUrls.add("https://www.google.com/imgres?imgurl=https%3A%2F%2Fwww.hotel-atriumpalacebarcelona.com%2Fwp-content%2Fblogs.dir%2F576%2Ffiles%2Fdobleslider%2Fhotel_atriumpalace_doble_5.jpg&imgrefurl=https%3A%2F%2Fwww.hotel-atriumpalacebarcelona.com%2Fhabitaciones%2F&docid=h_vcbHpKWnJ6rM&tbnid=QNEGeBRhg3XQvM%3A&vet=10ahUKEwi_wdXMjL3eAhViS98KHf_0BJQQMwhBKAMwAw..i&w=3000&h=2000&bih=666&biw=1364&q=habitaciones&ved=0ahUKEwi_wdXMjL3eAhViS98KHf_0BJQQMwhBKAMwAw&iact=mrc&uact=8");
mNames.add("Habitación 2");
mImageUrls.add("https://www.google.com/search?q=habitaciones&source=lnms&tbm=isch&sa=X&ved=0ahUKEwimgMjLjL3eAhXEVN8KHYntAwEQ_AUIDigB&biw=1364&bih=666#");
mNames.add("Habitación 3");
mImageUrls.add("https://www.google.com/search?q=habitaciones&source=lnms&tbm=isch&sa=X&ved=0ahUKEwimgMjLjL3eAhXEVN8KHYntAwEQ_AUIDigB&biw=1364&bih=666#");
mNames.add("Habitación 4");
mImageUrls.add("https://www.google.com/search?q=habitaciones&source=lnms&tbm=isch&sa=X&ved=0ahUKEwimgMjLjL3eAhXEVN8KHYntAwEQ_AUIDigB&biw=1364&bih=666#");
mNames.add("Habitación 5");
mImageUrls.add("https://www.google.com/search?q=habitaciones&source=lnms&tbm=isch&sa=X&ved=0ahUKEwimgMjLjL3eAhXEVN8KHYntAwEQ_AUIDigB&biw=1364&bih=666#");
mNames.add("Habitación 6");
initRecyclerView();
}
private void initRecyclerView()
{
Log.d(TAG, "initRecyclerView: init recyclerview.");
RecyclerView recyclerView = findViewById(R.id.recycler_view);
RecyclerViewAdapter adapter = new RecyclerViewAdapter(this, mNames, mImageUrls);
recyclerView.setAdapter(adapter);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
}
}
在这一部分,你能帮我吗??