package fileoperations;
import java.io.File;
import java.io.IOException;
public class SimpleFile {
public static void main(String[] args) throws IOException {
File file =new File("text.txt");
file.createNewFile();
System.out.println("File is created");
FileWriter writer = new FileWriter(file);
// Writes the content to the file
writer.write("Enter the text that you want to write");
writer.flush();
writer.close();
System.out.println("Data is entered into file");
}
}
Убедитесь, что вы объявили свой файл activities
в Manifest
следующим образом
<activity android:name=".YOUR_ACTIVITY" />
А в вашем Button
действии выполните навигационное действие следующим образом
Intent intent = new Intent(YOUR_ACTIVITY_1.this, YOUR_ACTIVITY_2.class);
startActivity(intent);