J'ai ce code:En mono pour android sur C# Resource.id dose n'existent pas pourquoi?
using System;
using Android.App;
using Android.Content;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;
using Android.Speech.Tts;
using System.Collections.Generic;
namespace SayItAndroid{ [Activity (Label = "SayItAndroid", MainLauncher = true)]
public class Activity1 : Activity, TextToSpeech.IOnInitListener
{
int count = 1;
TextToSpeech mTts;
public void OnInit (int status)
{
Console.WriteLine ("Listening to text to speech");
}
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);// Set our view from the "main" layout resource
SetContentView (Resource.Layout.Main);
Intent checkIntent = new Intent();
checkIntent.SetAction(TextToSpeech.Engine.ActionCheckTtsData);
StartActivityForResult(checkIntent, 100); // Get our button from the layout resource, // and attach an event to it
Button button = FindViewById<Button> (Resource.Id.myButton);
button.Click += delegate
{
string myText1 = "Did you sleep well?";
string myText2 = "I hope so, because it's time to wake up.";
mTts.Speak(myText1, QueueMode.Add, new Dictionary<string, string>());
mTts.Speak(myText2, QueueMode.Flush, new Dictionary<string, string>());
};
}
protected override void OnActivityResult (int requestCode, Result resultCode, Intent data)
{
base.OnActivityResult (requestCode, resultCode, data);
if(requestCode == 100)
{
mTts = new TextToSpeech(this, this);
}
}
}}
Mais les deux endroits que j'ai des ressources im obtenir erreur de ligne rouge sous la ressource:
Erreur 1 Le nom « ressource » n'existe pas dans le contexte actuel
Comment puis-je le résoudre?
Merci.