Package cn.com.ava.lesson4_fancy_view;
import android.content.Context;
import android.os.Bundle;
import android.app.Activity;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;
import android.widget.Toast;
import java.util.ArrayList;
import java.util.List;
import cn.com.ava.lesson4_fancy_view.Model.Address;
public class MainActivity extends Activity {
private EditText et_name;
private EditText et_address;
private Button bt_save;
private RadioGroup rg_types;
private RadioButton rb_take_out;
private RadioButton rb_sit_down;
private RadioButton rb_delivery;
private ListView lv_address;
private ArrayAdapter<Address> adapter;
private List<Address> listAddress = new ArrayList<Address>();
private static final String TAG = "MainActivity";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
this.bt_save = (Button) this.findViewById(R.id.bt_save);
this.bt_save.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
et_name = (EditText) MainActivity.this.findViewById(R.id.et_name);
et_address = (EditText) MainActivity.this.findViewById(R.id.et_address);
rg_types = (RadioGroup) MainActivity.this.findViewById(R.id.rg_types);
rb_take_out = (RadioButton) MainActivity.this.findViewById(R.id.rb_take_out);
rb_sit_down = (RadioButton) MainActivity.this.findViewById(R.id.rb_sit_down);
rb_delivery = (RadioButton) MainActivity.this.findViewById(R.id.rb_delivery);
Address address = new Address();
address.setName(et_name.getText().toString());
address.setAddress(et_address.getText().toString());
switch (rg_types.getCheckedRadioButtonId()) {
case R.id.rb_take_out:
address.setType(MainActivity.this.getString(R.string.take_out));
break;
case R.id.rb_sit_down:
address.setType(MainActivity.this.getString(R.string.sit_down));
break;
case R.id.rb_delivery:
&nb