zoukankan      html  css  js  c++  java
  • JAVA日报

    从零开始的体温app开发(ThirdActivity)

    package com.example.myapplication;

    import android.app.Activity;
    import android.content.Intent;
    import android.os.Bundle;
    import android.util.Log;
    import android.view.View;
    import android.widget.AbsListView;
    import android.widget.AdapterView;
    import android.widget.Button;
    import android.widget.EditText;
    import android.widget.ListView;
    import android.widget.Toast;

    import androidx.annotation.Nullable;
    import androidx.appcompat.app.AppCompatActivity;

    import java.util.List;

    import adapter.UserListAdapter;
    import adapter.UserListAdapter2;
    import bean.User;
    import bean.User2;
    import dao.UserDao;
    import dao.UserDao2;

    public class ThirdActivity extends AppCompatActivity implements AdapterView.OnItemClickListener, AbsListView.OnScrollListener {
    private ListView mUserList;
    private UserDao2 userDao=null;
    private List<User2> userList=null;
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_third);
    mUserList=findViewById(R.id.user_list2);
    InitData();
    mUserList.setOnItemClickListener(this);
    mUserList.setOnScrollListener(this);
    }
    private void InitData(){
    userDao=UserDao2.getInstance(getApplicationContext());
    userList=userDao.findAll();
    UserListAdapter2 adapter=new UserListAdapter2(getApplicationContext(),userList);
    mUserList.setAdapter(adapter);
    }

    @Override
    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    Intent intent = new Intent();
    Log.e("position",""+position);
    Toast.makeText(getApplicationContext(), "切换成功", Toast.LENGTH_SHORT).show();
    intent.putExtra("message",position);
    intent.setClass(getApplicationContext(), MainActivity.class);
    startActivity(intent);
    finish();
    }

    @Override
    public void onScrollStateChanged(AbsListView view, int scrollState) {

    }

    @Override
    public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {

    }
    }
  • 相关阅读:
    js制作倒计时
    SpringBoot tomcat 上传文件大小受限制1M,解决办法
    SQL关于not,exists说法,以及差异
    SQL语句关于树查询
    树(Tree)形插件
    python之函数用法fromkeys()
    模块
    补充零散知识
    pickle模块
    python中元组与列表的区别
  • 原文地址:https://www.cnblogs.com/mumulailai/p/14909346.html
Copyright © 2011-2022 走看看