Hello friends, I am receiving this error,
Android.Util.AndroidRuntimeException: Only the original thread that created a view of the hierarchy can touch its views.
After implementing the following in my code
public Comenatrios(int ID) {
InitializeComponent();
IdCom.Text = ID.ToString();
IdCita = ID;
GetComentarios(IdCita);
//esta es la parte que implenté
var periodTimeSpan2_ = TimeSpan.FromSeconds(4);
var startTimeSpan = TimeSpan.Zero;
var timer2_ = new System.Threading.Timer((e) => {
GetComentarios(IdCita);
}, null, startTimeSpan, periodTimeSpan2_);
}
// tambien intenté con esto, pero necesito que se corra ese metodo cada 4 o 5 segundos
Device.BeginInvokeOnMainThread(() => {
GetComentarios(IdCita); // este metodo es un simple get a un api
});