Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/278.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/rest/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C#Xamarin android意图和阅读线()_C#_Android_Android Intent_Xamarin_Xamarin.forms - Fatal编程技术网

C#Xamarin android意图和阅读线()

C#Xamarin android意图和阅读线(),c#,android,android-intent,xamarin,xamarin.forms,C#,Android,Android Intent,Xamarin,Xamarin.forms,我正在构建琐事应用程序,并创建了表单活动问题 因此,当用户按下右键时,它会重新打开活动。 我希望它能读到下一行,没有相同的,怎么办 private void ShowQuestion() { string content; AssetManager assets = this.Assets; StreamReader txt = new StreamReader(assets.Open("Test12.txt"), Encoding.GetEncoding("Window

我正在构建琐事应用程序,并创建了表单活动问题

因此,当用户按下右键时,它会重新打开活动。 我希望它能读到下一行,没有相同的,怎么办

private void ShowQuestion()
{
    string content;
    AssetManager assets = this.Assets;
    StreamReader txt = new StreamReader(assets.Open("Test12.txt"), Encoding.GetEncoding("Windows-1255"));
    StreamReader csv = new StreamReader(assets.Open("Ans12.csv"), Encoding.GetEncoding("Windows-1255"));
    QuestionText.Text = txt.ReadLine();
    Button1.Text = txt.ReadLine();
    Button2.Text = txt.ReadLine();
    Button3.Text = txt.ReadLine();
    Button4.Text = txt.ReadLine();
    answer = csv.ReadLine();
}

private void Button1_Click(object sender, EventArgs e)
{
    if(answer == "א")
    {
        var intent = new Intent(this, typeof(Questions));
        StartActivity(intent);
    }
}

我想你可以做类似的事情

    StreamReader txt = new StreamReader(assets.Open("Test12.txt"), Encoding.GetEncoding("Windows-1255"));

    protected override void OnCreate(Bundle bundle)
    {

        // ...

        // First line
        Button1.Text = txt.ReadLine();

    }

    private void Button1_Click(object sender, EventArgs e)
    {

        // other lines
        Button1.Text = txt.ReadLine();

    }

让我知道…

你能解释得更清楚些吗?你有一个阅读第一行的活动A,用“右”键打开一个阅读第二行的“问题”活动?活动A和活动“问题”是同一个活动我想打开同一个活动。。(最后,我只想用另一个问题来进行同样的活动,这是我读到的行,但现在它只是读同样的行)我想你不必重新打开同样的活动。如果A打开,您必须更改“控件”中的值,请设置此值。如何设置?将函数拆分为只读行,并在每次按“右”键时调用它?太简单了。。这是一个琐碎的应用程序,我有文本视图和4个按钮。。我还需要从正确答案文件中读取这行代码,所以我需要所有这些
Button1.Text=txt.ReadLine();Button2.Text=txt.ReadLine();Button3.Text=txt.ReadLine();Button4.Text=txt.ReadLine();answer=csv.ReadLine()需要更新,而且我失去了后退按钮的功能,所以我不能返回到最后一个问题。也许我需要一个滑块。。。我搜索了很多,android在互联网上没有像基本c#和其他语言那样的信息:(