1

This is the error I'm getting. I'm following this one tutorial and it throws no errors:

The tutorial screenshot

I want to store the data off my Firebase database in an easy was to read.

Error message:

"Unchecked assignment: 'java.util.Map' to 'java.util.Map<java.lang.String,java.lang.String>' less... (⌘F1) 

Signals places where an unchecked warning is issued by the compiler. For example:

 void f(HashMap map) {
    map.put("key", "value");
  }

Hint: Pass -Xlint:unchecked to javac to get more details."

 myRef.addValueEventListener(new ValueEventListener() {
 @Override
 public void onDataChange(DataSnapshot dataSnapshot) {
 Map <String, String> map = dataSnapshot.getValue(Map.class);

 }

 @Override
 public void onCancelled(DatabaseError databaseError) {
 Log.i("error", "error");
 }
 });
AL.
  • 36,815
  • 10
  • 142
  • 281

1 Answers1

1

Try this

Map<String,String> map = (Map<String,String>)dataSnapShot.getValue(Map.class);
Thiha
  • 175
  • 1
  • 3
  • I tried this and got this error `Class java.util.Map has generic type parameters, please use GenericTypeIndicator instead` – dylmatthews Feb 23 '17 at 10:12
  • found and answer on here `http://stackoverflow.com/questions/37688031/class-java-util-map-has-generic-type-parameters-please-use-generictypeindicator ` – dylmatthews Feb 23 '17 at 11:03