zoukankan      html  css  js  c++  java
  • 个人作业阶段一 3

    今天完成填报数据的展示

    1、在activity_show_xml中添加textview控件

    <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        tools:context=".ShowActivity2"
        android:orientation="horizontal"
        android:background="@drawable/bk4">
    
    <TextView
        android:id="@+id/SHOW"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>
        
    </RelativeLayout>
    

      

    2、ShowActivity.java

    package com.example.myapplication;
    
    import android.os.Bundle;
    import android.text.method.ScrollingMovementMethod;
    import android.widget.TextView;
    
    import androidx.appcompat.app.AppCompatActivity;
    
    import org.litepal.LitePal;
    
    import java.util.List;
    
    import static com.example.myapplication.RegisterActivity.username;
    
    public class ShowActivity2 extends AppCompatActivity {
    
        private TextView SHOW;
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_show2);
    
            SHOW = findViewById(R.id.SHOW);
            SHOW.setMovementMethod(ScrollingMovementMethod.getInstance());
            String showname2=username;
    
            String s;
            StringBuffer sb = new StringBuffer(256);
            List<Infomation> infomations = (List<Infomation>) LitePal.where("zhu_name=?",showname2).find(Infomation.class);
            List<User> users = (List<User>) LitePal.where("user_name=?",showname2).find(User.class);
                for(Infomation infomation:infomations) {
                        sb.append("姓名:" +infomation.getZhu_name()+"	"+"学号:"/*+user.getUser_xuehao()+"	"+"班级:"+user.getUser_class()+"	"*/
                                + "日期:"+infomation.getZhu_date()+"	"+"时间:"+infomation.getZhu_time()+"	"
                                + "体温:"+infomation.getZhu_tiwen()+"	"+"地址:"+infomation.getZhu_add()+"	"+"说明:"+infomation.getZhu_shuoming()+"
    ");
                    }
    
                s=sb.toString().trim();
                SHOW.setText(s);
        }
    }
    

      

    这里只是简单的把数据进行了打印,并没有采用比较美观的方法。

    今后将继续完善补充

  • 相关阅读:
    Git一些简单但非常重要并常用的操作命令
    利用fastjson解析json并通过js&ajax实现页面的无跳转刷新
    利用Graphviz绘制逻辑关系依赖图
    oracle导入.dmp文件
    Linux查找当前目录5天的文件并打包
    Web安全相关(三):开放重定向(Open Redirection)
    Web安全相关(二):跨站请求伪造(CSRF/XSRF)
    Web安全相关(一):跨站脚本攻击(XSS)
    密码学应用(DES,AES, MD5, SHA1, RSA, Salt, Pkcs8)
    行为驱动开发(BDD)实践示例
  • 原文地址:https://www.cnblogs.com/ltw222/p/14912724.html
Copyright © 2011-2022 走看看