将数据从对话框中的活动传递到另一个活动

时间:2018-07-23 13:56:12

标签: android listview android-activity android-dialog

我有一个显示为Dialog的活动,这是我的代码

/* Open Customer List  */
        final EditText show_customer_list = (EditText) findViewById(R.id.cusname);
        show_customer_list.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent i = new Intent(add_plan.this, customer_list.class);
                startActivity(i);

在该活动中,我有一个代码从listview获取值

listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                TextView position1    = (TextView) view.findViewById(R.id.list_name);
                TextView position2    = (TextView) view.findViewById(R.id.list_address);
                String customer_name    = position1.getText().toString();
                String customer_address = position2.getText().toString();
                finish();
            }
        });

                    EditText editText = (EditText)findViewById(R.id.cusname);
                    editText.setText(i.getStringExtra("customer_name"));
                }
            });

我的问题是如何将其传递给对话框活动中的活动

0 个答案:

没有答案