获取数据以在 android 应用程序中开发动态界面

Fetching datas to develop dynamic interface in android app

我正在开发一个 android 应用程序,它现在是静态的。为了使其动态化,我正在考虑从网络服务器或 google 驱动器获取图像。我的照片很少。如何从网络服务器或 google 驱动器获取图像?这是我下面给出的代码 -

Bed.java

import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;

public class Bed extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_bed);

    ActionBar actionBar = getSupportActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.menu_bed, menu);
    return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();

    //noinspection SimplifiableIfStatement
    if (id == android.R.id.home) {
        this.finish();
        return true;
    } else {
        return super.onOptionsItemSelected(item);
    }

}
}

activity_bed.xml (目前,我已经给出了 5 个 ImageViews 和相应的 5 个图像,目前,它是静态的。我想从网络 server/google 驱动器中获取这 5 个图像)。

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingLeft="10dp"
android:background="#00ffaa"
tools:context="com.example.rahulshaw.medizy.Bed">

<ScrollView
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:scrollbars="vertical">

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="vertical"
        android:layout_marginTop="5dp"
        android:paddingRight="10dp"
        android:layout_gravity="center_horizontal">


<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Hospital 1,Marathahalli"
    android:id="@+id/hosp1"
    android:gravity="center|bottom"
    android:textStyle="bold"
    android:textAppearance="?android:textAppearanceMedium"
    android:textColor="#ffffff"
    android:background="@drawable/picture1"/>

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Hospital 2,Domlur"
    android:id="@+id/hosp2"
    android:layout_marginTop="4dp"
    android:gravity="center|bottom"
    android:textStyle="bold"
    android:textAppearance="?android:textAppearanceMedium"
    android:textColor="#ffffff"
    android:background="@drawable/picture2"/>

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Hospital 3,Kundanahalli"
    android:id="@+id/hosp3"
    android:layout_marginTop="4dp"
    android:gravity="center|bottom"
    android:textStyle="bold"
    android:textAppearance="?android:textAppearanceMedium"
    android:textColor="#ffffff"
    android:background="@drawable/picture3"/>

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Hospital 4,Indiranagar"
    android:id="@+id/hosp4"
    android:layout_marginTop="4dp"
    android:gravity="center|bottom"
    android:textStyle="bold"
    android:textAppearance="?android:textAppearanceMedium"
    android:textColor="#ffffff"
    android:background="@drawable/picture1"/>

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Hospital 5,Koramangala"
    android:id="@+id/hosp5"
    android:layout_marginTop="4dp"
    android:gravity="center|bottom"
    android:textStyle="bold"
    android:textAppearance="?android:textAppearanceMedium"
    android:textColor="#ffffff"
    android:background="@drawable/picture5"/>

    </LinearLayout>
</ScrollView>
</LinearLayout>

请帮帮我...

Picasso 是迄今为止获取图像最简单的方法。它将为您处理线程 http://square.github.io/picasso/