Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
Carrentals_james_clarke
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
james.clarke2
Carrentals_james_clarke
Commits
1c8d63ae
Commit
1c8d63ae
authored
May 19, 2020
by
james.clarke2
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add new file
parent
55d08c4c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
69 additions
and
0 deletions
+69
-0
UpdateStatus.java
UpdateStatus.java
+69
-0
No files found.
UpdateStatus.java
0 → 100644
View file @
1c8d63ae
package
com
.
example
.
carrentals
;
import
androidx.appcompat.app.AppCompatActivity
;
import
android.app.Dialog
;
import
android.content.Intent
;
import
android.graphics.Color
;
import
android.os.Bundle
;
import
android.view.View
;
import
android.widget.AdapterView
;
import
android.widget.ArrayAdapter
;
import
android.widget.Button
;
import
android.widget.EditText
;
import
android.widget.ListView
;
import
android.widget.TextView
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
public
class
UpdateStatus
extends
AppCompatActivity
{
ArrayList
<
String
>
arrayList
;
ArrayAdapter
<
String
>
arrayAdapter
;
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_update_status
);
ListView
listView
=
(
ListView
)
findViewById
(
R
.
id
.
listv
);
String
[]
items
=
{
"Benz"
,
"Toyota"
,
"Honda"
,
"Audi"
,
"Jaguar"
};
arrayList
=
new
ArrayList
<>(
Arrays
.
asList
(
items
));
arrayAdapter
=
new
ArrayAdapter
<
String
>(
this
,
R
.
layout
.
list_item
,
R
.
id
.
txtitem
,
arrayList
);
listView
.
setAdapter
(
arrayAdapter
);
listView
.
setOnItemClickListener
(
new
AdapterView
.
OnItemClickListener
()
{
@Override
public
void
onItemClick
(
AdapterView
<?>
parent
,
View
view
,
int
position
,
long
id
)
{
showInputBox
(
arrayList
.
get
(
position
),
position
);
}
});
}
public
void
showInputBox
(
String
oldItem
,
final
int
index
)
{
final
Dialog
dialog
=
new
Dialog
(
UpdateStatus
.
this
);
dialog
.
setTitle
(
"Input Box"
);
dialog
.
setContentView
(
R
.
layout
.
input_box
);
TextView
txtMessage
=
(
TextView
)
dialog
.
findViewById
(
R
.
id
.
txtmessage
);
txtMessage
.
setText
(
"Update item"
);
txtMessage
.
setTextColor
(
Color
.
parseColor
(
"#ff2222"
));
final
EditText
editText
=
(
EditText
)
dialog
.
findViewById
(
R
.
id
.
txtinput
);
editText
.
setText
(
oldItem
);
Button
bt
=
(
Button
)
dialog
.
findViewById
(
R
.
id
.
btdone
);
bt
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
arrayList
.
set
(
index
,
editText
.
getText
().
toString
());
arrayAdapter
.
notifyDataSetChanged
();
dialog
.
dismiss
();
}
});
dialog
.
show
();
}
public
void
UpdateRefreshments
(
View
v
)
{
Intent
intent
=
new
Intent
(
this
,
UpdateRefreshments
.
class
);
startActivity
(
intent
);
}
}
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