Main4Activity.java
1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package com.example.ksi.refrigerator;
import android.content.Context;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.Layout;
import android.view.LayoutInflater;
import android.widget.LinearLayout;
import android.widget.TextView;
import java.text.Format;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
public class Main4Activity extends AppCompatActivity {
Intent intent;
ArrayList<Item> itemList = new ArrayList();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main4);
intent = getIntent();
itemList = (ArrayList<Item>)intent.getSerializableExtra("item");
LinearLayout layout = findViewById(R.id.layout);
TextView item[][] = new TextView[itemList.size()][2];
for(int i=0; i< itemList.size();i++)
{
item[i][0] = new TextView(this);
item[i][1] = new TextView(this);
item[i][0].setText(itemList.get(i).name);
item[i][0].setTextSize(20);
Format formatter = new SimpleDateFormat("yyyy-MM-dd");
String s = formatter.format(itemList.get(i).date);
item[i][1].setText(s);
item[i][1].setTextSize(20);
LinearLayout layout2 = new LinearLayout(this);
layout2.addView(item[i][0]);
layout2.addView(item[i][1]);
layout.addView(layout2);
}
}
}