Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
Simmitive_Chris_Crook
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
chris.crook
Simmitive_Chris_Crook
Commits
fc988d22
Commit
fc988d22
authored
Apr 06, 2021
by
chris.crook
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
> adding load / save
parent
89633afc
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
130 additions
and
9 deletions
+130
-9
AndroidManifest.xml
app/src/main/AndroidManifest.xml
+1
-0
MainActivity.java
.../java/com/example/summative_chris_crook/MainActivity.java
+52
-1
register_page.java
...java/com/example/summative_chris_crook/register_page.java
+14
-0
txt_interaction.java
...va/com/example/summative_chris_crook/txt_interaction.java
+12
-0
activity_main.xml
app/src/main/res/layout/activity_main.xml
+42
-8
activity_register_page.xml
app/src/main/res/layout/activity_register_page.xml
+9
-0
No files found.
app/src/main/AndroidManifest.xml
View file @
fc988d22
...
...
@@ -9,6 +9,7 @@
android:roundIcon=
"@mipmap/ic_launcher_round"
android:supportsRtl=
"true"
android:theme=
"@style/Theme.Summative_Chris_Crook"
>
<activity
android:name=
".register_page"
></activity>
<activity
android:name=
".MainActivity"
>
<intent-filter>
<action
android:name=
"android.intent.action.MAIN"
/>
...
...
app/src/main/java/com/example/summative_chris_crook/MainActivity.java
View file @
fc988d22
...
...
@@ -3,12 +3,63 @@ package com.example.summative_chris_crook;
import
androidx.appcompat.app.AppCompatActivity
;
import
android.os.Bundle
;
import
android.view.View
;
import
android.widget.TextView
;
import
android.widget.Toast
;
public
class
MainActivity
extends
AppCompatActivity
{
import
java.io.File
;
import
java.io.FileWriter
;
import
java.util.Scanner
;
public
class
MainActivity
extends
AppCompatActivity
{
String
filename1
=
"magicwords"
;
String
filename2
=
"appdatatxt"
;
File
file1
;
File
file2
;
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_main
);
file1
=
new
File
(
getApplicationContext
().
getFilesDir
(),
filename1
+
".txt"
);
file2
=
new
File
(
getApplicationContext
().
getFilesDir
(),
filename2
+
".txt"
);
try
{
Scanner
reader
=
new
Scanner
(
file1
);
String
temp
=
""
;
while
(
reader
.
hasNextLine
()){
temp
=
temp
+
reader
.
nextLine
();
}
Toast
.
makeText
(
getApplicationContext
(),
temp
+
" "
,
Toast
.
LENGTH_LONG
).
show
();
}
catch
(
Exception
e
){
Toast
.
makeText
(
getApplicationContext
(),
"read error"
,
Toast
.
LENGTH_LONG
).
show
();
}
}
public
void
openandload
(
View
view
){
try
{
Scanner
reader
=
new
Scanner
(
file1
);
String
temp
=
""
;
while
(
reader
.
hasNextLine
()){
temp
=
temp
+
reader
.
nextLine
();
}
Toast
.
makeText
(
getApplicationContext
(),
temp
+
" "
,
Toast
.
LENGTH_LONG
).
show
();
}
catch
(
Exception
e
){
Toast
.
makeText
(
getApplicationContext
(),
"read error"
,
Toast
.
LENGTH_LONG
).
show
();
}
}
public
void
saveandclose
(
View
view
){
try
{
FileWriter
stream
=
new
FileWriter
(
file1
,
false
);
stream
.
write
(
" "
);
stream
.
close
();
}
catch
(
Exception
e
){
Toast
.
makeText
(
getApplicationContext
(),
"write error"
,
Toast
.
LENGTH_LONG
).
show
();
}
}
//
}
\ No newline at end of file
app/src/main/java/com/example/summative_chris_crook/register_page.java
0 → 100644
View file @
fc988d22
package
com
.
example
.
summative_chris_crook
;
import
androidx.appcompat.app.AppCompatActivity
;
import
android.os.Bundle
;
public
class
register_page
extends
AppCompatActivity
{
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_register_page
);
}
}
\ No newline at end of file
app/src/main/java/com/example/summative_chris_crook/txt_interaction.java
0 → 100644
View file @
fc988d22
package
com
.
example
.
summative_chris_crook
;
import
java.io.File
;
public
class
txt_interaction
{
String
filename1
=
"magicwords"
;
String
filename2
=
"appdatatxt"
;
File
file1
;
File
file2
;
public
void
loadfrom
(){
}
}
app/src/main/res/layout/activity_main.xml
View file @
fc988d22
...
...
@@ -6,13 +6,47 @@
android:layout_height=
"match_parent"
tools:context=
".MainActivity"
>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"vertical"
>
<TextView
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"Username:"
/>
<EditText
android:id=
"@+id/username_input"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:ems=
"10"
android:inputType=
"textPersonName"
/>
<TextView
android:layout_width=
"wrap_content"
android:id=
"@+id/textView"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"Password:"
/>
<EditText
android:id=
"@+id/password_input"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:ems=
"10"
android:inputType=
"textPassword"
/>
<Button
android:id=
"@+id/button"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"Log In"
/>
<Button
android:id=
"@+id/button2"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"Hello World!"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintRight_toRightOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
android:text=
"register"
/>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
app/src/main/res/layout/activity_register_page.xml
0 → 100644
View file @
fc988d22
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
tools:context=
".register_page"
>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment