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
3efb0b6e
Commit
3efb0b6e
authored
May 19, 2020
by
james.clarke2
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add new file
parent
54ae01c4
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
57 additions
and
0 deletions
+57
-0
listOfCars.java
listOfCars.java
+57
-0
No files found.
listOfCars.java
0 → 100644
View file @
3efb0b6e
package
com
.
example
.
carrentals
;
import
androidx.appcompat.app.AppCompatActivity
;
import
android.content.Intent
;
import
android.os.Bundle
;
import
android.view.View
;
import
android.widget.Adapter
;
import
android.widget.AdapterView
;
import
android.widget.AdapterView.OnItemClickListener
;
import
android.widget.ArrayAdapter
;
import
android.widget.Button
;
import
android.widget.ListView
;
import
android.widget.Toast
;
import
java.util.ArrayList
;
import
static
android
.
widget
.
AdapterView
.*;
public
class
listOfCars
extends
AppCompatActivity
{
String
items
[]
=
new
String
[]{
"Audi, Specifications are Power steering,power breaks, power locks,power windows, air bags, automatic air conditioning,ABS breaks, 2 people.Price = 8/hr "
,
"Honda, Specifications Power Locks/Windows, air bags, automatic,air conditioning, 5 people. Price = 10/hr"
,
" Jaguar Specifications, Cruise control, leather interior, automatic, air conditioning, tilt steering wheel, power mirrors, power door locks, 4 people. Price = 10/hr"
,
"Benz,Specifications are Power locks/windows, air bags manual hatchback, 4 people. Price = 11/hr"
,
"Toyota, Specifications ,Manual,air conditioning,diesel, 8 people. Price 7/hr"
};
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_list_of_cars
);
ListView
listView
=
(
ListView
)
findViewById
(
R
.
id
.
listView
);
ArrayAdapter
<
String
>
adapter
=
new
ArrayAdapter
<
String
>(
this
,
android
.
R
.
layout
.
simple_list_item_1
,
items
);
listView
.
setAdapter
(
adapter
);
listView
.
setOnItemClickListener
(
new
AdapterView
.
OnItemClickListener
()
{
@Override
public
void
onItemClick
(
AdapterView
<?>
parent
,
View
view
,
int
position
,
long
id
)
{
Toast
.
makeText
(
listOfCars
.
this
,
items
[
position
],
Toast
.
LENGTH_SHORT
).
show
();
}
});
Button
mButton
=
(
Button
)
findViewById
(
R
.
id
.
button8
);
mButton
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
startActivity
(
new
Intent
(
listOfCars
.
this
,
Review
.
class
));
}
});
}
}
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