Reputation: 381
Afragment.cs
var data=new Intent(this,typeof(Bactivity));
data.PutStringArrayListExtra("ByGenres",TrackModel.Track);
data.PutExtra("position",e.Position);
StartActivity(data);
- Error CS0119: Expression denotes a
type', where a
variable',value' or
method group' was expected- Error CS1502: The best overloaded method match for `Android.Content.Intent.Intent(Android.Content.Context, System.Type)' has some invalid arguments (CS1502)
Can't pass data to Bacitivity.
Upvotes: 1
Views: 139
Reputation: 729
In fragment you have to use Activity
instead of this
var data=new Intent(this.Activity, typeof(Bactivity));
var str = Newtonsoft.Json.JsonConvert.SerializeObject(obj);
...
T obj = Newtonsoft.Json.JsonConvert.DeserializeObject<T>(str);
If it is a large object the latter is better as it is much faster.
Use the serialize function to convert the object to string and on the activity use deserialize to convert back into object.
var track=Newtonsoft.Json.JsonConvert.SerializeObject(items.tracks);
var data=new Intent(this.Activity,typeof(AudioPlayer));
data.PutExtra("listdata",track);
data.PutExtra("position",e.Position);
StartActivity(data);
Upvotes: 1