Hello,
Welcome to our Microsoft Q&A platform!
1.Try using a custom object class as the tranfer parameter. Here the sample code, please check:
//Activity1
Intent intent = new Intent(this, typeof(Activity1));
TestModel model = new TestModel { Name = "test_name" };
intent.PutExtra("model", JsonConvert.SerializeObject(model));
StartActivity(intent);
//Activity2
var model = JsonConvert.DeserializeObject<TestModel>(Intent.GetStringExtra("model"));
string text = model.Name;
//the model class
public class TestModel
{
public TestModel()
{
}
public string Name { get; set; }
}
If the above code works well, the issue should be due to the 'WebDavClient'.
2.To share the client between activities, you could also create a global variable of the application. Create a custom Application class for the project and add a parameter in the custom class.
[Application]
public class CustomApplication : Application
{
protected CustomApplication(IntPtr javaReference, JniHandleOwnership transfer) : base(javaReference, transfer)
{
}
public static TestModel TheModel = new TestModel();
}
//set the `android:name` to the custom application class
<manifest ...>
<application android:name=".CustomApplication" ...>
</application>
</manifest>
//Activity1
var model = CustomApplication.TheModel;
model.Name = "testing...";
StartActivity(new Intent(this, typeof(Activity1)));
//Activity2
string text = CustomApplication.TheModel.Name;
Best Regards,
Jarvan Zhang
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.