zoukankan      html  css  js  c++  java
  • 第一阶段冲刺——3

    通过在网上找到相关程序的学生端的代码进行学习

    实现了一小部分功能

    明天还需要继续

    package com.example.shazidouhuiapp.activity;
    
    import android.content.Context;
    import android.content.Intent;
    import android.os.Bundle;
     
    import android.util.AttributeSet;
    import android.util.Log;
    import android.view.LayoutInflater;
    import android.view.View;
    import android.view.ViewGroup;
    import android.widget.LinearLayout;
    import android.widget.TextView;
    import android.widget.Toast;
     
    import androidx.annotation.NonNull;
    import androidx.annotation.Nullable;
    import androidx.appcompat.app.AppCompatActivity;
    import androidx.fragment.app.Fragment;
    import androidx.recyclerview.widget.LinearLayoutManager;
    import androidx.recyclerview.widget.RecyclerView;
    import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
     
    import com.example.shazidouhuiapp.Adapter.HomeAdatpter;
    import com.example.shazidouhuiapp.Adapter.readReceiveAdapter;
    import com.example.shazidouhuiapp.Adapter.receiveAdapter;
    import com.example.shazidouhuiapp.Bean.User;
    import com.example.shazidouhuiapp.Bean.homework;
    import com.example.shazidouhuiapp.Bean.homeworkContent;
    import com.example.shazidouhuiapp.R;
     
     
    import java.util.ArrayList;
    import java.util.List;
     
    import cn.bmob.v3.BmobQuery;
    import cn.bmob.v3.BmobUser;
    import cn.bmob.v3.datatype.BmobPointer;
    import cn.bmob.v3.exception.BmobException;
    import cn.bmob.v3.listener.FindListener;
     
    public class student_readover_receive extends AppCompatActivity {
        private String id;
        private RecyclerView rv;
        private SwipeRefreshLayout srlayout;
        private TextView helloquestion;
        //    private TextView HelloHome;
    //    private TextView username,ok;
        private LinearLayout homesearch;
     
        List<homeworkContent> data;
     
     
     
        private readReceiveAdapter readreceiveAdapter;
     
     
     
        @Override
        protected void onCreate(@Nullable Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.student_unfinished_question);
            initView();
     
            //初始刷新
            Refresh();
     
            srlayout.setColorSchemeResources(android.R.color.holo_green_light,android.R.color.holo_red_light,android.R.color.holo_blue_light);
            srlayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
                @Override
                public void onRefresh() {
                    //刷新;
                    Refresh();
                }
            });
        }
     
        private void Refresh() {
     
            Intent a=getIntent();
            id=a.getStringExtra("id");
            String title=a.getStringExtra("title");
            helloquestion.setText(title);
            homework homework=new homework();
            homework.setObjectId(id+"");
     
            BmobQuery<homeworkContent> query=new BmobQuery();
            query.addWhereRelatedTo("homeworkContent",new BmobPointer(homework));
     
            query.findObjects(new FindListener<homeworkContent>() {
                @Override
                public void done(List<homeworkContent> list, BmobException e) {
                    if(e==null){
                        data=list;
                        readreceiveAdapter =new readReceiveAdapter(student_readover_receive.this,data,id);
                        rv.setLayoutManager(new LinearLayoutManager(student_readover_receive.this));
                        rv.setAdapter(readreceiveAdapter);
                    }
                    else {
                        Toast.makeText(student_readover_receive.this, "题目数据获取失败", Toast.LENGTH_SHORT).show();
                    }
                }
            });
     
     
     
     
        }
     
        private void initView() {
            rv = findViewById(R.id.question_recyclerview);
            srlayout =findViewById(R.id.question_swipe);
            helloquestion=findViewById(R.id.helloquestion);
        }
    }
  • 相关阅读:
    NDK开发一
    【转】Android NDK学习(2)Windows下NDK开发环境配置
    【转】Android NDK学习(3)使用Javah命令生成JNI头文件 .
    IDA 动态调试so
    Scrapy下载中间件的优先级(神踏马值越小优先级越高)
    二、深入asyncio协程(任务对象,协程调用原理,协程并发)
    python 可迭代对象,迭代器,生成器的区别及使用
    一、初识asyncio协程
    python多进程,进程池,数据共享,进程通信,分布式进程
    Scrapy的Request和Response对象
  • 原文地址:https://www.cnblogs.com/fwk123/p/12753473.html
Copyright © 2011-2022 走看看