首页 > 其他分享 >每日总结2023-05-09

每日总结2023-05-09

时间:2023-05-09 19:11:47浏览次数:53  
标签:name 05 09 advert 2023 import android public String

今天完成了广告界面的设计,

通过上网查询,了解到互联网广告投放一般按照天数计费,费用高低不一,通常有几种模式:季度收费,按年收费,天数计费等。

通过钟表计算广告运行的天数,来进行广告收益的计算,再将广告信息传输到数据库进行存储。

 

advertBean.java

package com.example.math.bean;

public class advertBean {
    private String advert_name;
    private float price;
    private String time;

    public advertBean(String advert_name, float price, String time) {
        this.advert_name = advert_name;
        this.price = price;
        this.time = time;
    }

    public String getAdvert_name() {
        return advert_name;
    }

    public void setAdvert_name(String advert_name) {
        this.advert_name = advert_name;
    }

    public float getPrice() {
        return price;
    }

    public void setPrice(float price) {
        this.price = price;
    }

    public String getTime() {
        return time;
    }

    public void setTime(String time) {
        this.time = time;
    }
}

 

AdvertListAdapter.java//适配器

package com.example.math.adapter;

import android.annotation.SuppressLint;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.example.math.R;
import com.example.math.bean.advertBean;

import java.util.List;

public class AdvertListAdapter extends BaseAdapter {
    Context context;
    List<advertBean> mDataAdvert;
    LayoutInflater inflater;

    public AdvertListAdapter(Context context, List<advertBean> mDataAdvert) {
        this.context = context;
        this.mDataAdvert = mDataAdvert;
        inflater = LayoutInflater.from(context);
    }

    @Override
    public int getCount() {
        return mDataAdvert.size();
    }

    @Override
    public Object getItem(int position) {
        return mDataAdvert.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @SuppressLint("SetTextI18n")
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder3 holder3 = null;
        if (convertView == null) {
            convertView = inflater.inflate(R.layout.advert_lv, parent, false);
            holder3 = new ViewHolder3(convertView);
            convertView.setTag(holder3);
        } else {
            holder3 = (ViewHolder3) convertView.getTag();
        }
        advertBean bean = mDataAdvert.get(position);
        holder3.nameType.setText(bean.getAdvert_name() + "");
        holder3.priceType.setText(bean.getPrice() + "");
        holder3.timeType.setText(bean.getTime() + "");
        return convertView;
    }

    static class ViewHolder3 {
        TextView nameType, priceType, timeType;

        public ViewHolder3(View view) {
            nameType = view.findViewById(R.id.advert_lv_name);
            priceType = view.findViewById(R.id.advert_lv_price);
            timeType = view.findViewById(R.id.advert_lv_time);
        }
    }
}

 

AdvertActivity.java

package com.example.math;
/*
*广告界面
 * */

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

import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.view.WindowManager;
import android.widget.ListView;
import android.widget.TextView;

import com.example.math.adapter.AdvertListAdapter;
import com.example.math.bean.advertBean;
import com.example.math.repositiory.Advert_res;

import java.util.List;

public class AdvertActivity extends AppCompatActivity {
    private ListView listView;
    private List<advertBean> mDataAdvert;

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

        getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);

        initData();
        initListAdvert();
    }

    private void initData() {
        TextView userName = findViewById(R.id.advert_name);
        CustomApplication app = (CustomApplication) getApplication();
        String name = app.getValue();
        userName.setText(name);
        listView = findViewById(R.id.advert_lv);
    }

    private void initListAdvert() {
        MyThread myThread = new MyThread();
        Thread thread = new Thread(myThread);
        thread.start();
    }
    private class MyThread implements Runnable{

        @Override
        public void run() {
            TextView textView = findViewById(R.id.advert_name);
            String Names = textView.getText().toString();
            try {
                mDataAdvert = Advert_res.advertBeans(Names);
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
            Message msg = new Message();
            msg.what = 1;
            myHandler.sendMessage(msg);
        }
    }
    private final Handler myHandler = new Handler(Looper.myLooper()){
        @Override
        public void handleMessage(@NonNull Message msg) {
            if (msg.what ==1){
                AdvertListAdapter adapter = new AdvertListAdapter(AdvertActivity.this,mDataAdvert);
                listView = findViewById(R.id.advert_lv);
                listView.setAdapter(adapter);
            }
        }
    };

    @Override
    protected void onResume() {
        super.onResume();
        initListAdvert();
    }
}

此页面为简单的listVIew视图页面。

 

标签:name,05,09,advert,2023,import,android,public,String
From: https://www.cnblogs.com/JJTyyds/p/17385987.html

相关文章

  • 2023.5.9
    完成“学生cpp成绩计算”之后,修改Person和Student类,各自增加两个无参构造函数。仍以Person类为基础,建立一个派生类Teacher,增加以下成员数据:intID;//教师工号Studentstu[100];//学生数组intcount;//学生数目,最多不超过100floatcpp_average;//班级cpp平均分......
  • 【2023-05-05】换种美好
    20:00别人贴的标签,我无所谓。我知道自己的路怎么走,不管起点高低,努力总会带来希望。                                                 ——邢小颖看到老家农村兄弟的一......
  • 【问题解决】Kafka报错 Bootstrap broker x.x.x.x:9092 (id: -1 rack: null) disconne
    问题复现近日针对某一客户需求开发了一个需要使用Kafka的功能,功能是什么暂且不论,在本地虚机的Kafka连接一切正常遂放到测试服务器上验证功能,以下是监听topic成功和警告报错:2023-05-0910:22:23[localhost-startStop-1]INFOorg.apache.kafka.clients.consumer.ConsumerConfig......
  • 【GDOI2020模拟02.05】生成树 (矩阵树扩展)
    Description:给定一张N个点,M条边的无向图,边有红、绿、蓝三种颜色,分别用1,2,3表示。求这张图有多少生成树,满足绿色边数量不超过x,蓝色边数量不超过y,答案对10^9+7取模。n<=40题解:考虑正常的用矩阵树求生成树个数的方法。基尔霍夫矩阵里的每个位置只是一个数,事实上可以把它扩......
  • Springboot-hbase增删改20230509
    1、启动 2、ZK客户端    3、springboot+hbase实例1)、pom<dependencies><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId&......
  • 20230509001 - DataTable 导出成Excel
               DataTabledt_e=DataSet0.Tables[0];           SaveFileDialogsaveFileDialog=newSaveFileDialog();           saveFileDialog.Filter="Execlfiles(*.xls)|*.xls";           saveFileDialog.FilterIndex......
  • 【2023-05-04】变得内向
    20:00年轻人,你永远不要忘记,才华就是长期的坚持不懈。你努力干吧!                                                 ——福楼拜节日在家,何太跟小姨女聊天,说起了她们各自......
  • 2023继续教育考试答案
    importre,sys,time,sys,os,json#abc=''ax=0abc=abc.replace('\n','').replace('\r\n','')abd=abd.replace('\n','').replace('\r\n','')abe=abe.replace('\n&#......
  • 2023年4月国产数据库大事记-墨天轮
    本文为墨天轮社区整理的2023年4月国产数据库大事件和重要产品发布消息。目录4月国产数据库大事记(时间线)产品/版本发布兼容认证代表厂商大事记相关资料4月国产数据库大事记(时间线)4月1日,深圳市高校教育信息化学会举办战略合作签约和实验室揭牌仪式。人大金仓与学会联合深......
  • 23-05-08日记
    时隔接近一年,我回来了往事不可追,来者犹可待在博客园记录下我的生活,不过不要回忆它这一天,早上弹了琴,白天专心工作,晚上练了背,深夜和友人聊了天,很充实满足的一天 5.9希望你能练胸,弹琴,聊天,专注当下,思考未来  ......