我怎麼能發送從適配器參數,當我點擊的TextView「tvlist」到活動「SelectAddressActivity」,在SelectAddressActivity我有兩個EditText上,我想從適配器我怎麼能發送到參數從適配器到活動
充滿參數@Override
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
Typeface quicksandRegular = Typeface.createFromAsset(context.getAssets(), "fonts/Roboto-Light.ttf");
final View row = inflater.inflate(R.layout.list_item, parent, false);
AddressList al= objects.get(position);
final TextView tvlist = (TextView)row.findViewById(R.id.id_TextView);
tvlist.setTypeface(quicksandRegular);
tvlist.setText(al.get_addresse());
tvlist.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
String content = tvlist.getText().toString();
}
});
活動
public class SelectAddressActivity extends Activity {
ArrayList<AddressList> addressList ;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_select_address);
final ListView addressListView = (ListView) findViewById(R.id.addressListView);
final SelectAddressAdapter adapter = new SelectAddressAdapter(this, android.R.layout.simple_list_item_1, addressList);
addressListView.setAdapter(adapter);
}
嗨 這是適配器 第一個參數活動 \t - 活動無法解析爲變量 Intent intent = new Intent(activity,SelectAddressActivity.class); –
你必須從適配器發送參數到另一個activity..right? – Mayuri
是從適配器到活動 –