Skip to content

Commit db2ac81

Browse files
Url updated
1 parent 4c7cf26 commit db2ac81

File tree

3 files changed

+217
-6
lines changed

3 files changed

+217
-6
lines changed
Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
{
2+
"message": "Success",
3+
"route_data": [
4+
{
5+
"id": "30",
6+
"sequence_id": "1",
7+
"bde_id": "40",
8+
"route_id": "25",
9+
"name": "Mumbai",
10+
"latitude": "19.0760",
11+
"longitude": "72.8777",
12+
"branchAssigned": "xjdj",
13+
"contactPerson": "xxjd",
14+
"mobile": "8966866565",
15+
"phone": "8656565656",
16+
"email": "djdj",
17+
"address": "xjdjx",
18+
"city": "Thane",
19+
"state": "Maharashtra",
20+
"category": "bxbxnx",
21+
"createdDate": "2021-08-23 11:41:40",
22+
"updatedDate": "2021-09-08 12:01:43",
23+
"isDeleted": "0",
24+
"photo": null,
25+
"photolong": null,
26+
"photolat": null,
27+
"photoCreatedDate": null
28+
},
29+
{
30+
"id": "27",
31+
"sequence_id": "2",
32+
"bde_id": "40",
33+
"route_id": "25",
34+
"name": " Navi Mumbai",
35+
"latitude": "19.0330",
36+
"longitude": "73.0297",
37+
"branchAssigned": "bsbsvsb",
38+
"contactPerson": "vsbs",
39+
"mobile": "7994499464",
40+
"phone": "4949466586",
41+
"email": "sh@gmail.com",
42+
"address": "shsh",
43+
"city": "Thane",
44+
"state": "Maharashtra",
45+
"category": "dhdhd",
46+
"createdDate": "2021-08-23 11:39:50",
47+
"updatedDate": "2021-09-08 12:01:51",
48+
"isDeleted": "0",
49+
"photo": null,
50+
"photolong": null,
51+
"photolat": null,
52+
"photoCreatedDate": null
53+
},
54+
{
55+
"id": "31",
56+
"sequence_id": "3",
57+
"bde_id": "40",
58+
"route_id": "25",
59+
"name": "Dadar",
60+
"latitude": "19.0178",
61+
"longitude": "72.8478",
62+
"branchAssigned": "shshhs",
63+
"contactPerson": "hshshs",
64+
"mobile": "7967676464",
65+
"phone": "7997",
66+
"email": "shzh",
67+
"address": "hhzhz",
68+
"city": "Thane",
69+
"state": "Maharashtra",
70+
"category": "bxbxhx",
71+
"createdDate": "2021-08-23 11:42:17",
72+
"updatedDate": "2021-09-08 12:01:55",
73+
"isDeleted": "0",
74+
"photo": null,
75+
"photolong": null,
76+
"photolat": null,
77+
"photoCreatedDate": null
78+
},
79+
{
80+
"id": "26",
81+
"sequence_id": "4",
82+
"bde_id": "40",
83+
"route_id": "25",
84+
"name": "Karjat",
85+
"latitude": "18.9102",
86+
"longitude": "73.3283",
87+
"branchAssigned": "vashi",
88+
"contactPerson": "rahul",
89+
"mobile": "9658854555",
90+
"phone": "8888585555",
91+
"email": "s@gmail.com",
92+
"address": "testgs",
93+
"city": "Thane",
94+
"state": "Maharashtra",
95+
"category": "tegsgsgs",
96+
"createdDate": "2021-08-23 11:39:02",
97+
"updatedDate": "2021-09-08 12:04:36",
98+
"isDeleted": "0",
99+
"photo": null,
100+
"photolong": null,
101+
"photolat": null,
102+
"photoCreatedDate": null
103+
},
104+
{
105+
"id": "28",
106+
"sequence_id": "5",
107+
"bde_id": "40",
108+
"route_id": "25",
109+
"name": "Kasara",
110+
"latitude": "19.6436",
111+
"longitude": "73.4712",
112+
"branchAssigned": "sbz",
113+
"contactPerson": "zbzb",
114+
"mobile": "6464656535",
115+
"phone": "7946645665",
116+
"email": "xhdj",
117+
"address": "djdj",
118+
"city": "Thane",
119+
"state": "Maharashtra",
120+
"category": "znjsns",
121+
"createdDate": "2021-08-23 11:40:19",
122+
"updatedDate": "2021-09-08 12:04:49",
123+
"isDeleted": "0",
124+
"photo": null,
125+
"photolong": null,
126+
"photolat": null,
127+
"photoCreatedDate": null
128+
},
129+
{
130+
"id": "29",
131+
"sequence_id": "6",
132+
"bde_id": "40",
133+
"route_id": "25",
134+
"name": "Panvel",
135+
"latitude": "18.9894",
136+
"longitude": "73.1175",
137+
"branchAssigned": "bshsbs",
138+
"contactPerson": "bsbsh",
139+
"mobile": "9449946565",
140+
"phone": "4656566566",
141+
"email": "dhhd",
142+
"address": "shhd",
143+
"city": "Thane",
144+
"state": "Maharashtra",
145+
"category": "zbzbhs",
146+
"createdDate": "2021-08-23 11:40:56",
147+
"updatedDate": "2021-09-08 12:04:54",
148+
"isDeleted": "0",
149+
"photo": null,
150+
"photolong": null,
151+
"photolat": null,
152+
"photoCreatedDate": null
153+
}
154+
],
155+
"code": 200
156+
}

app/src/main/java/com/example/map/GoogleMapWork/DirectionApi/Direction_A.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,8 @@ public void createroot() {
113113
} else {
114114
placePath = new MarkerOptions().position(latLng).title("Path");
115115
place1 = new MarkerOptions().position(new LatLng(drop_lat, drop_long)).title("Mumbai").icon(BitmapDescriptorFactory.fromResource(R.drawable.ic_pin));
116-
place2 = new MarkerOptions().position(latLng).title("Me").icon(BitmapDescriptorFactory.fromResource(R.drawable.ic_current_loc));
116+
// its ur current location place2 = new MarkerOptions().position(latLng).title("Me").icon(BitmapDescriptorFactory.fromResource(R.drawable.ic_current_loc));
117+
place2 = new MarkerOptions().position(new LatLng(19.0330, 73.0297)).title("Navi Mumbai").icon(BitmapDescriptorFactory.fromResource(R.drawable.ic_current_loc));
117118

118119
new FetchURL(Direction_A.this).execute(getUrl(place1.getPosition(), place2.getPosition(), "driving"), "driving");
119120

app/src/main/java/com/example/map/GoogleMapWork/PolyLine_Map/PolyLineMapsActivity.java

Lines changed: 59 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@
7777
import org.json.JSONObject;
7878

7979
import java.io.IOException;
80+
import java.io.InputStream;
8081
import java.security.SecureRandom;
8182
import java.security.cert.X509Certificate;
8283
import java.util.ArrayList;
@@ -238,7 +239,9 @@ public boolean verify(String arg0, SSLSession arg1) {
238239
public void onResume() {
239240
super.onResume();
240241
// put your code here...
241-
GetDataForMap();
242+
GetDataForMap(); //Load from server
243+
/*loadJSONFromAsset();
244+
ParseJSONFromAsset();*/
242245
setupMapIfNeeded();
243246

244247
}
@@ -290,7 +293,7 @@ public void onMapReady(GoogleMap googleMap) {
290293
mGoogleMap.setOnMarkerClickListener(new GoogleMap.OnMarkerClickListener() {
291294
@Override
292295
public boolean onMarkerClick(Marker marker) {
293-
showDialogProject(marker.getSnippet(),marker.getTitle());
296+
showDialogProject(marker.getSnippet(), marker.getTitle());
294297
return false;
295298
}
296299
});
@@ -522,14 +525,65 @@ public void onPointerCaptureChanged(boolean hasCapture) {
522525

523526
}
524527

528+
public void ParseJSONFromAsset() {
529+
try {
530+
JSONObject obj = new JSONObject(loadJSONFromAsset());
531+
JSONArray m_jArry = obj.getJSONArray("route_data");
532+
Log.e("Details-->", String.valueOf(m_jArry));
533+
proPlaceListRoute = new ArrayList<>();
534+
535+
for (int i = 0; i < m_jArry.length(); i++) {
536+
JSONObject jo_inside = m_jArry.getJSONObject(i);
537+
PlaceModel placeModel = new PlaceModel();
538+
placeModel.id = jo_inside.getString("id");
539+
placeModel.bde_id = jo_inside.getString("bde_id");
540+
placeModel.route_id = jo_inside.getString("route_id");
541+
placeModel.sequence_id = jo_inside.getString("sequence_id");
542+
placeModel.name = jo_inside.getString("name");
543+
placeModel.latitude = jo_inside.getString("latitude");
544+
placeModel.longitude = jo_inside.getString("longitude");
545+
placeModel.isDeleted = jo_inside.getString("isDeleted");
546+
placeModel.branchAssigned = jo_inside.getString("branchAssigned");
547+
placeModel.city = jo_inside.getString("city");
548+
placeModel.state = jo_inside.getString("state");
549+
placeModel.contactPerson = jo_inside.getString("contactPerson");
550+
placeModel.mobile = jo_inside.getString("mobile");
551+
placeModel.phone = jo_inside.getString("phone");
552+
placeModel.email = jo_inside.getString("email");
553+
placeModel.category = jo_inside.getString("category");
554+
placeModel.photo = jo_inside.getString("photo");
555+
556+
557+
proPlaceListRoute.add(placeModel);
558+
}
559+
On_Data_Map();
560+
} catch (JSONException e) {
561+
Log.e(TAG, "ParseJSONFromAsset: "+e.toString() );
562+
}
563+
}
564+
565+
public String loadJSONFromAsset() {
566+
String json = null;
567+
try {
568+
InputStream is = getAssets().open("polyline_data.json");
569+
int size = is.available();
570+
byte[] buffer = new byte[size];
571+
is.read(buffer);
572+
is.close();
573+
json = new String(buffer, "UTF-8");
574+
} catch (IOException ex) {
575+
ex.printStackTrace();
576+
return null;
577+
}
578+
return json;
579+
}
525580

526581
public void GetDataForMap() {
527582
final ProgressDialog progressDialog = new ProgressDialog(PolyLineMapsActivity.this);
528583
progressDialog.setCancelable(false);
529584
progressDialog.setMessage("Loading..");
530585
progressDialog.show();
531-
String FatchPlaceByRoute = "https://myjson.dit.upm.es/api/bins/4ld3";
532-
//String FatchPlaceByRoute = "http://myjson.dit.upm.es/api/bins/2nx3";
586+
String FatchPlaceByRoute = "https://pixeldev.in/webservices/json_file/polyline_data.json";
533587
StringRequest stringRequest = new StringRequest(Request.Method.GET, FatchPlaceByRoute, new Response.Listener<String>() {
534588
@Override
535589
public void onResponse(String response) {
@@ -718,7 +772,7 @@ private Bitmap getMarkerBitmapFromView(@DrawableRes int resId, String tittle) {
718772

719773
Dialog dialog_details;
720774

721-
private void showDialogProject(String someid,String subtitle) {
775+
private void showDialogProject(String someid, String subtitle) {
722776
dialog_details = new Dialog(this);
723777
dialog_details.requestWindowFeature(Window.FEATURE_NO_TITLE); // before
724778
dialog_details.setContentView(R.layout.dialog_info);

0 commit comments

Comments
 (0)