Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/208.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
Java 存储搜索条数据_Java_Android_Xml_Store - Fatal编程技术网

Java 存储搜索条数据

Java 存储搜索条数据,java,android,xml,store,Java,Android,Xml,Store,我有一个页面,其中有一个新事件的按钮。当按下该按钮时,它会打开一个新的活动,其中有一个时间选择器、日期和年份选择器以及一个搜索栏,用于测量事件1 2 3的优先级。我需要能够保存所有这些数据,以便以后它将被显示,并根据上面再次读取的优先级排序,1,2,3。数据必须显示在按钮下方的第一页上。稍后我可以自己做显示部分,但我需要知道如何设置数据库,或者如何存储这些变量并对它们进行排序 这是所有文件的源代码 activitymain.xml New_Event.java 请详细解释 <LinearL

我有一个页面,其中有一个新事件的按钮。当按下该按钮时,它会打开一个新的活动,其中有一个时间选择器、日期和年份选择器以及一个搜索栏,用于测量事件1 2 3的优先级。我需要能够保存所有这些数据,以便以后它将被显示,并根据上面再次读取的优先级排序,1,2,3。数据必须显示在按钮下方的第一页上。稍后我可以自己做显示部分,但我需要知道如何设置数据库,或者如何存储这些变量并对它们进行排序

这是所有文件的源代码

activitymain.xml

New_Event.java

请详细解释

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <Button
        android:id="@+id/new_event"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="@string/new_event"
        android:onClick="openeditor"/>
    <ListView
        android:id="@+id/event_list"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        />

</LinearLayout>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/scrollView1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_weight="2.80" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:baselineAligned="false"
        android:orientation="vertical" >

        <EditText
            android:id="@+id/event_name"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="@string/event_name" />

        <TimePicker
            android:id="@+id/time_picker"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />

        <DatePicker
            android:id="@+id/date_picker"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />

        <SeekBar
            android:id="@+id/seekBar1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" 
            android:max="2"/>

        <Button
            android:id="@+id/create_event"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="@string/add_event" />

    </LinearLayout>
</ScrollView>
    package com.osah.tao;

    import android.app.Activity;
    import android.content.Intent;
    import android.os.Bundle;
    import android.view.Menu;
    import android.view.View;
    import android.view.View.OnClickListener;

public class MainActivity extends Activity implements OnClickListener {

    @Override

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        View new_event = findViewById(R.id.new_event);
        new_event.setOnClickListener(this);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.activity_main, menu);
        return true;
    }
    public void onClick(View v){
        switch (v.getId()) {
        case R.id.new_event:
        Intent a = new Intent(this, New_event.class);
        startActivity(a);
        break;

        }

    }
}
package com.osah.tao;

import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;



public class New_event extends Activity {

        @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState); 
        setContentView(R.layout.activity_newevent);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.activity_newevent, menu);
        return true;
    }

}