15,796,456 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Python questions
View PHP questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by sfdgasdfqqqq (Top 10 by date)
sfdgasdfqqqq
20-Mar-19 12:36pm
View
Intent toMap = new Intent(context,MapActivity.class);
Bundle coords = new Bundle();
coords.putDouble("lat",lcoords);
coords.putDouble("lon",lcoords2);
context.startActivity(toMap);
This is my Bundle, coords.
sfdgasdfqqqq
20-Mar-19 12:11pm
View
if I am going to use getExtras(), the getDOuble on this code produces a null pointer exception.
double lat1 = coords.getDouble("lat");
sfdgasdfqqqq
20-Mar-19 11:40am
View
I am passing a Double data type. I inserted this code:
Intent toMap = new Intent(context,MapActivity.class);
Bundle coords = new Bundle();
coords.putDouble("lat",lcoords);
coords.putDouble("lon",lcoords2);
toMap.putExtras(coords);
context.startActivity(toMap);
System.out.print(coords);
lcoords contains the latitude. lcoords2 contains the longitude. Whenever I access the Bundle to my MapActivity.class, it says "getDouble on a null object reference"
Bundle coords = getIntent().getBundleExtra("coords");
double lat1 = coords.getDouble("lat");
double lon2 = coords.getDouble("lon");
LatLng location = new LatLng(lat1,lon2);
marker = mMap.addMarker(new MarkerOptions()
.position(location)
.title("Here")
.flat(true));
mMap.moveCamera(CameraUpdateFactory.newLatLng(location));
If I comment out those codes, lcoords and lcoords2 have values and is not null.
sfdgasdfqqqq
20-Mar-19 10:41am
View
Also, I tried using Intent but it says, cannot resolve constructor. Maybe because, SmsReceiver is only a class, not an activity itself.
sfdgasdfqqqq
20-Mar-19 10:31am
View
Hello. This is what I have tried but I am getting a NullObjectReference error on my LatLng.
HashMap <string, double=""> hashMap = smsReceiver.getLocMap(coordinates);
if(hashMap != null) {
// Double lat = hashMap.get("latitude");
// Double lon = hashMap.get("longitude");
LatLng location = new LatLng(coordinates.get("latitude"),coordinates.get("longitude"));
marker = mMap.addMarker(new MarkerOptions()
.position(location)
.title("Here")
.flat(true));
mMap.moveCamera(CameraUpdateFactory.newLatLng(location));
This is my a class with my hashmap.
//variable
private HashMap<string, double=""> coordinates = new HashMap<string, double="">();
public void sendDataToFirebase(SmsMessage sms, Context context) {
coordinates.put("latitude", latitudedb);
coordinates.put("longitude", longitudedb);
mRef.setValue(coordinates);
Double lcoords = coordinates.get("latitude");
Double lcoords2 = coordinates.get("longitude");
mRef.getKey();
System.out.println(lcoords);
System.out.println(lcoords2);
// }
}
public HashMap<string, double=""> getLocMap(HashMap<string, double=""> coordinates) {
return this.coordinates;
}
When I print out my coordinates, it has the values.
sfdgasdfqqqq
18-Mar-19 12:24pm
View
I followed a tutorial. I am new to Android programming.
This is how I am accessing the LocationArray.class
for(DataSnapshot s: dataSnapshot.getChildren()) {
LocationArray locationArray = s.getValue(LocationArray.class);
LatLng location = new LatLng(locationArray.latitude,locationArray.longitude);
mMap.addMarker(new MarkerOptions().position(location).icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_VIOLET)));
And this is where I get a "May produce NullPointerException". What seems to be the problem?
LatLng(locationArray.latitude,locationArray.longitude);
This is my LocationArray.class
public class LocationArray {
public LocationArray() {
//Default Constructor
}
public String date;
public String recipient;
public double latitudedb;
public double longitudedb;
public LocationArray(String date, String recipient, double latituddbe, double longitudedb) {
this.date = date;
this.recipient = recipient;
this.latitudedb = latitudedb;
this.longitudedb = longitudedb;
}
}
sfdgasdfqqqq
18-Mar-19 12:12pm
View
Deleted
This is my code on displaying a marker on google maps but the datasnapshot is not getting the value from my LocationArray.class
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
googleMap.setOnMarkerClickListener(this);
googleMap.setMapType(GoogleMap.MAP_TYPE_HYBRID);
mChild.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
for(DataSnapshot s: dataSnapshot.getChildren()) {
LocationArray locationArray = s.getValue(LocationArray.class);
LatLng location = new LatLng(locationArray.latitude,locationArray.longitude);
mMap.addMarker(new MarkerOptions().position(location).icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_VIOLET)));
Log.e("MAP OPERATIONS:","Marker has been added to updated location");
}
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
}
});
}
sfdgasdfqqqq
18-Mar-19 12:10pm
View
I can now display a marker on the map but it does not read the last inserted row from Firebase database. https://stackoverflow.com/questions/55224838/android-may-produce-nullpointerexception-on-array-class You may check this link because I have provided pictures and details so you can understand me.
sfdgasdfqqqq
18-Mar-19 12:01pm
View
I have displayed the marker. But it seems like my array class is returning a null value. https://stackoverflow.com/questions/55224838/android-may-produce-nullpointerexception-on-array-class You may check this link for further details. I hope you can help me.
sfdgasdfqqqq
18-Mar-19 12:01pm
View
I have displayed the marker. But it seems like my array class is returning a null value. https://stackoverflow.com/questions/55224838/android-may-produce-nullpointerexception-on-array-class You may check this link for further details. I hope you can help me.
Show More