0

我正在使用 monodroid,我想开始一个新的活动,它的参数我不想使用 intent.putextra 或任何捆绑包

例如这是我的活动

namespace BoostITAndroid
{
[Activity(Label = "My Activity")]
public partial class UploadDealership : ListActivity
{

    private List<Dealership> listDealers;
    private Vehiclestoupload ul;
    private int selectedDealershipID = 0;
    private String[] Options;

    public UploadDealership(Vehiclestoupload uploadList, List<Dealership> listOfDealers)
    {
        this.ul = uploadList;
        this.listDealers = listOfDealers;
    }

所以这个活动有两个参数。

下面我正在尝试开始活动

Intent uld = new Intent(this, typeof(UploadDealership(this, listOfDealers)));
                StartActivity(uld);

但是一切都带有红色下划线,所以这不起作用。

如何使用参数启动 Activity?

4

1 回答 1

0

也许这可能对你有用。这是在活动之间携带一个字符串。

活动一:

     //Intent i = new Intent()
    EditText editText = (EditText) findViewById(R.id.editText);
    String message = editText.getText().toString();
    intent.putExtra(EXTRA_MESSAGE, message);
     //StartActivity(i);

关于活动二:

    // Get the Intent that started this activity and extract the string
Intent intent = getIntent();
String message = intent.getStringExtra(MainActivity.EXTRA_MESSAGE);

// Capture the layout's TextView and set the string as its text
TextView textView = (TextView) findViewById(R.id.textView);
textView.setText(message);
于 2017-09-25T05:24:11.113 回答