I'm trying to pass the data to another activity, the data is from database. And I'm having an error, and IDK why, can someone explain it to me?
This is how i Put the Extra:
private void Log_Click(object sender, System.EventArgs e)
{
try
{
string dpPath = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "Person.db");
var db = new SQLiteConnection(dpPath);
var data = db.Table();
var data1 = data.Where(x => x.username == txtUser.Text && x.password == txtPass.Text).FirstOrDefault();
if (data1 != null)
{
Intent openAct = new Intent(this, typeof(personAccount));
this.StartActivity(openAct);
openAct.PutExtra("info", JsonConvert.SerializeObject(information));
}
else
{
Toast.MakeText(this, "Username or Password invalid", ToastLength.Short).Show();
}
}
catch (Exception ex)
{
Toast.MakeText(this, ex.ToString(), ToastLength.Long).Show();
}
}
This is how i get the extra:
IdQR = FindViewById(Resource.Id.QRCode);
LogedPerson = JsonConvert.DeserializeObject(Intent.GetStringExtra("info"));
IdQR.Text = LogedPerson.id.ToString();
This is my class:
public class info
{
[PrimaryKey, AutoIncrement, Column("_Id")]
public int id { get; set; }
[MaxLength(25)]
public string username { get; set; }
[MaxLength(15)]
public string password { get; set; }
public byte [] image { get; set; }
}
But his data is Json and he serialize it, I guess that part is the reason why I'm having an error.
Thanks in advance