【问题标题】:How to get text from MySQL and set it on TextView如何从 MySQL 获取文本并将其设置在 TextView 上
【发布时间】:2017-11-12 10:54:42
【问题描述】:

我正在制作一个类似书的应用程序。它将有 600 页。我不想做 600 个活动。

如何从 MySQL 数据库中获取文本并使用 Volley 将其设置在文本视图中?

我正在使用列表视图。

这是我目前所拥有的。

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.ListView;

public class CantosHimnario extends AppCompatActivity {

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

    populateListView();
}

private void populateListView() {

    String[] cantosHimnario = {"1. Abre Tu Oido",
            "2. A Cristo Quiero Servir"};

    ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, R.layout.cantos_name, cantosHimnario);

    ListView listView = (ListView)findViewById(R.id.listViewOne);
    listView.setAdapter(adapter);


}
}

一个例子将不胜感激!

【问题讨论】:

    标签: android mysql xml android-volley textview


    【解决方案1】:

    【讨论】:

    • 谢谢!我很感激。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-10-17
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多