我正在使用带有 Microsoft VS2010 C# 的 android SDK。我想在我的 C# 代码中使用我的 /resources/values/strings 文件中的字符串值。这是一段代码,说明了我想要做什么。我没有得到字符串值。我知道资源 id 是一个 int,但我需要的是该 id 后面的实际字符串值。
void vx2OkButton_Click(object sender, EventArgs e)
{
Log.Info(LOG_TAG, "Hello from OkButton|Enter()button"); // also used as Enter button
strVx20kButtonText = vx2OkButton.Text.ToString();
mDwnLdCodeEnteredByUser = vxxDwnldCodeEntered.Text.Trim();
string strDwnldCodeOut = mActCode.Bad.ToString();
if(strVx20kButtonText == Resource.String.Enter.ToString())
{
if (mDwnLdCodeEnteredByUser.Length < 1)
{
vxxSystemMsgBox.SetText(Resource.String.FieldRequried_);
m_txvEnterDwnLdCode.SetTextAppearance(this,Resource.Color.Red);
return;
}
// verify the dwnldcodeenter by the user matches the assigned to user when at the time the downloaded the app
mDwnLoadStatus = VerifyDwnLoadCode(mDwnLdCodeEnteredByUser);
if (mDwnLoadStatus == mDwnLdStatCode.BadDwnLdCode.ToString())
{
vxxSystemMsgBox.SetText(Resource.String.InvalidValueEntered);
m_txvEnterDwnLdCode.SetTextAppearance(this, Resource.Color.Red);
return;
}
mActionCD = mActCode.Ok.ToString();
vx2OkButton.SetText(Resource.String.OkButtonText);
vxxSystemMsgBox.SetText(Resource.String.ThanksPressOkButton);
m_txvEnterDwnLdCode.SetTextAppearance(this,Resource.Color.White);
return;
}