• 2021.2.16


    今天把方法整合了一下,之前定义的对象是分开定义的,显示起来不好调用

    public class zong extends AppCompatActivity {
        TextView textView;
        double zong;
        List<thing> thingList;
        Button button;
        Intent intent = new Intent();
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_zong);
            button = findViewById(R.id.button);
            webs web = new webs();
            thing2 thing2 = new thing2();
            Thread mythread = new Thread(thing2);
            mythread.start();
            try {
                mythread.join();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }

            thingList = thing2.getThingList();
    //        thing2 thing2 = new thing2();
            textView = findViewById(R.id.zong);
    //        thingList = thing2.getThingList();
            zong=0;
            for (thing thing : thingList){
                zong = zong+Double.parseDouble(thing.getMoney());
                System.out.println(zong);
            }
            String str = String.valueOf(zong);
            textView.setText(str);
            button.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    intent.setClass(zong.this,MainActivity.class);
                    startActivity(intent);
                }
            });
        }
    }
  • 相关阅读:
    hdu 1443 Joseph 约瑟夫环
    hdu 1568 Fibonacci 对数。。
    UILineBreakMode
    Android RelativeLayout 动态添加组件
    iOS 让view触发点击事件
    读取plist文件数据
    [转]Android获取SD卡视频音频文件
    ubuntu下vim修复
    DMO(DirectX Media Object)的工程创建过程及其调用方式
    《Windows程序设计》笔记 —— Chapter One
  • 原文地址:https://www.cnblogs.com/buxiang-Christina/p/14914374.html
Copyright © 2020-2023  润新知