今天做了显示界面
public class xianshi extends AppCompatActivity {
ListView listView;
Button buttonx;
Button buttony;
List<thing> thingList;
Intent intent = new Intent();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_xianshi);
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();
ArrayAdapter<thing> adapter = new ArrayAdapter<thing>(xianshi.this, android.R.layout.simple_list_item_1,thingList);
listView=(ListView)findViewById(R.id.xianshi);
listView.setAdapter(adapter);
buttonx = findViewById(R.id.buttonx);
buttony = findViewById(R.id.buttony);
buttonx.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
intent.setClass(xianshi.this,MainActivity.class);
startActivity(intent);
}
});
buttony.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
intent.setClass(xianshi.this,zong.class);
startActivity(intent);
}
});
}
}