Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/184.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 如何使用取自Firebase数据库的url设置imageView_Android_Firebase Realtime Database_Imageview - Fatal编程技术网

Android 如何使用取自Firebase数据库的url设置imageView

Android 如何使用取自Firebase数据库的url设置imageView,android,firebase-realtime-database,imageview,Android,Firebase Realtime Database,Imageview,customitem.xml 如何在itempic中显示它们?最好的方法是使用以下库之一:毕加索、UIL、Glide 您还可以从新线程下载图像,然后传递到ImageView <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:orientation="vertical" andro

customitem.xml


如何在itempic中显示它们?最好的方法是使用以下库之一:毕加索、UIL、Glide

您还可以从新线程下载图像,然后传递到ImageView

<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">

<TableRow
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:padding="10dp">

    <de.hdodenhof.circleimageview.CircleImageView
        android:id="@+id/itempic"
        android:layout_width="50dp"
        android:layout_height="50dp"
        android:visibility="visible"
        app:civ_border_color="#cccccc"
        app:civ_border_width="2dp" />

    <TextView
        android:id="@+id/itemtext"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_vertical|center_horizontal"
        android:layout_marginLeft="8dp"
        android:text="TextView"
        android:textSize="18sp" />

 </TableRow>
 </TableLayout>
 arrayAdapter = new ArrayAdapter<String>(Test.this, R.layout.customitem, R.id.itemtext, arr);
        dbRef.addListenerForSingleValueEvent(new ValueEventListener() {
            @Override
            public void onDataChange(final DataSnapshot dataSnapshot) {

                int length = (int) dataSnapshot.getChildrenCount();
                final ArrayList<String > idString = new ArrayList<String>(length);

                for (final DataSnapshot ds : dataSnapshot.getChildren())
                {
                    Log.d("ifkey", ds.getKey());

                    if (!ds.getKey().equals(user_id)) {
                        if (ds.hasChild("lastname"))
                        {
                            arr.add(ds.child("name").getValue().toString() + " " + ds.child("lastname").getValue().toString());
                            idString.add(i, ds.child("id").getValue().toString());
                            i++;
                        }
                        else {
        arr.add(ds.child("name").getValue().toString());
         String photoUrl = ds.child("photo").getValue().toString();

        idString.add(i, ds.child("id").getValue().toString());
                            i++;

                            Log.d("username", user_id);

                            Log.d("idString", "");
                            Log.d("getkey", ds.getKey());

                        }
                    }

                    lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
                        @Override
                        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

                            Toast.makeText(getApplication(), "id :" + idString.get(position), Toast.LENGTH_SHORT).show();
                            Intent i = new Intent(Test.this, usertest.class);
                            i.putExtra("userid", idString.get(position));
                            startActivity(i);
                        }
                    });
                    lv.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
                        @Override
                        public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
                            final AlertDialog.Builder dialog = new AlertDialog.Builder(Test.this)
                                    .setTitle("ok").setMessage(
                                            "Send Game Request ...");
                            final AlertDialog alert = dialog.create();

                            alert.show();

                            return false;
                        }
                    });

                }
                Log.d("arr.size",""+arr.size());
                lv.setAdapter(arrayAdapter);


            }

            @Override
            public void onCancelled(DatabaseError databaseError) {

            }
        });
String photoUrl = ds.child("photo").getValue().toString();