简体   繁体   中英

How to pass a value from a main activity to a sub activity using intent?

我使用了一个listview clist并使用了clist.setOnItemClickListener(new AdapterView.OnItemClickListener(){现在,我想获取我点击了一个使用意图调用的子活动的项目。我该怎么做?那些人帮助我前进。

clist.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> arg0, View arg1, int position,
                long arg3)
        {
            String xy=clist.getItemAtPosition(position).toString();
            temp=xy.split("-");
                            String xz=temp[0]; 
                Intent intente=new Intent(Cardetails.this,EditPage.class);
                intente.putExtra("key",xz);
            startActivityForResult(intente, var2);  

        }

    });

var2 is the request code.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM