java.lang.NullPointerException: println needs a message
Maybe when you call
Log.d("sql_id", cursor.getString(0));
cursor.getString(0)
returns null, and then it crashes.
Try :
if(cursor.getString(0) != null) {
Log.d("sql_id", cursor.getString(0));
}
Otherwise, show us: de.bodprod.dkr.BosLstDetailMap.onCreate(BosLstDetailMap.java:43)
NullPointerException : println needs a message in android
In the catch, use:
String err = (ex.getMessage()==null)?"SD Card failed":ex.getMessage();
Log.e("sdcard-err2:", err);
Passing null
to the second argument of a Log
logging function throws that error, regardless of the source.
Android: NullPointerException: println needs a message;
Log.d("ReadRdaJSONFeedTask", e.getLocalizedMessage());,
The e.getlocalizedMessage()
is returning null. Check before calling.
Log.d("ReadRdaJSONFeedTask", e.getLocalizedMessage() == null ? "" : e.getLocalizedMessage());
NullPointerException: println needs a message
Your error is pretty obvious
E/AndroidRuntime(909): java.lang.NullPointerException: println needs a message 02-27 11:03:42.058:
You must provide a message for a log message. It cannot be null.
Log.i(course.getcoursename(), null);
Should be
Log.i(course.getcoursename(), "Some not null string");
How to fix 'println needs a message' error on android
SlideshowFragment can take string as argument is not bundle.
SlideshowFragment slideshowFragment = SlideshowFragment.newInstance(sb.toString());
println needs a message error in android
When you execute a query against the Firebase Database, there will potentially be multiple results. So the snapshot contains a list of those results. Even if there is only a single result, the snapshot will contain a list of one result.
The code in your onDataChange
will need to handle this list by looping over dataSnapshot.getChildren()
. Something like this:
DatabaseReference plist = dref.child("Playlist");
plist.orderByChild("Playlist_ID").equalTo(2).addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
for (DataSnapshot snapshot: dataSnapshot.getChildren()) { // Loop over results
String music_id = snapshot.child("Music_ID").getValue(String.class); // Get value for this result
Log.i("Value_id", music_id);
str_musictitle.setText(music_id);
}
}
@Override
public void onCancelled(@NonNull DatabaseError error) {
throw error.toException(); // Never ignore possible errors
}
});
Related Topics
How to Play Videos in Android from Assets Folder or Raw Folder
Asynctask Won't Stop Even When the Activity Has Destroyed
Webview: How to Avoid Security Alert from Google Play Upon Implementation of Onreceivedsslerror
How to Hide a Menu Item in the Actionbar
Get Contact Info from Android Contact Picker
How to Style an Android Switch
Getting the Physical Screen Dimensions/Dpi/Pixel Density in Chrome on Android
How to Determine If a Firebase User Is Signed in Using Facebook Authentication
Android: Access Child Views from a Listview
Placing/Overlapping(Z-Index) a View Above Another View in Android
Error Opening Supportmapfragment for Second Time
Android Sdk Manager Won't Open
Android Inject_Events Permission
Formula Px to Dp, Dp to Px Android
How to Set Image Button Backgroundimage for Different State
Foreground Service Being Killed by Android
How to Find the Data Usage on a Per-Application Basis on Android
Android: Customize Application's Menu (E.G Background Color)