Android - GPS Location App
Android - GPS Location App
Operating System
ANDROID
In this tutorial we will try to create a Simple GPS Location using Android. This simple
application can be used to any system that needed the information about the
location of the user. The android is an open source operating system it's free and
user friendly to mobile developers. Android is available to any devices such as TV,
phones, watches etc. So now let's do the coding.....
Getting Started:
First you will have to download & install the Android Development IDE (Android
Studio or Eclipse). Android Studio is an open source development feel free to
develop your things. Here's the link for the Android
Studio https://developer.android.com/studio/index.html.
Layout Design
We will now create the design for the application, first locate the layout file
called activity_main.xml, this is the default name when create a new activity. Then
write these codes inside your layout file.
1. <?xml version="1.0" encoding="utf-8"?>
2. <RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
3. xmlns:app="http://schemas.android.com/apk/res-auto"
4. xmlns:tools="http://schemas.android.com/tools"
5. android:layout_width="match_parent"
6. android:layout_height="match_parent"
7.
tools:context="com.razormist.simplegpslocation.MainActivity">
8.
9.
10.
11. <Button
12. android:id="@+id/btn_locate"
13. android:layout_height="wrap_content"
14. android:layout_width="wrap_content"
15. android:layout_centerInParent="true"
16. android:text="Locate"/>
17.
18. <TextView
19. android:id="@+id/textView"
20. android:layout_width="wrap_content"
21. android:layout_height="wrap_content"
22. android:text="Latitude:"
23. android:textSize="20sp"
24. android:layout_marginRight="100dp"
25. android:layout_marginEnd="100dp"
26. android:layout_marginBottom="63dp"
27. android:layout_above="@+id/btn_locate"
28. android:layout_alignRight="@+id/btn_locate"
29. android:layout_alignEnd="@+id/btn_locate" />
30.
31. <TextView
32. android:id="@+id/tv_latitude"
33. android:textSize="20sp"
34. android:layout_width="wrap_content"
35. android:layout_height="wrap_content"
36. android:layout_alignLeft="@+id/btn_locate"
37. android:layout_alignStart="@+id/btn_locate"
38. android:layout_alignTop="@+id/textView" />
39.
40.
41. <TextView
42. android:id="@+id/textView1"
43. android:layout_width="wrap_content"
44. android:layout_height="wrap_content"
45. android:text="Longhitud:"
46. android:textSize="20sp"
47. android:layout_below="@+id/tv_latitude"
48. android:layout_alignRight="@+id/textView"
49. android:layout_alignEnd="@+id/textView"
50. android:layout_marginTop="16dp" />
51.
52. <TextView
53. android:id="@+id/tv_longhitud"
54. android:layout_width="wrap_content"
55. android:layout_height="wrap_content"
56. android:textSize="20sp"
57. android:layout_alignBaseline="@+id/textView1"
58. android:layout_alignBottom="@+id/textView1"
59. android:layout_alignLeft="@+id/tv_latitude"
60. android:layout_alignStart="@+id/tv_latitude" />
61.
62.
63. </RelativeLayout>
Try to run the app and see if it worked. There you have it we have created a Simple
GPS Location using Android. I hope that this tutorial help you to what you are looking
for. For more updates and tutorials just kindly visit this site. Enjoy Coding!!!
Ad
1/2
00:09
Ngỡ Ngàng Trước Khung Cảnh Của Bình Liêu Quảng Ninh - Thiên Đường Vùng Biên
Giới Việt Trung
Download Code
Note: Due to the size or complexity of this submission, the author has submitted it as
a .zip file to shorten your download time. After downloading it, you will need a
program like Winzip to decompress it.
Virus note: All files are scanned once-a-day by SourceCodester.com for viruses, but
new viruses come out every day, so no prevention program can catch 100% of them.
FOR YOUR OWN SAFETY, PLEASE:
1. Re-scan downloaded files using your personal virus checker before using it.
2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.