0

Assume ClassA that define a static final string:

public class ClassA implements Serializable {

public final static String KeyString = "aKeyString";

And now ClassB trying to use this string:

anIntent.putExtra(ClassA.KeyString, anObject);

I get an error on the ClassA.KeyString part stating it cannot be resolved or is not a field. If I replace it with the string "aKeyString", it works fine. But I want to have a fixed key string to minimize typo erros.

Abdalrahman Shatou
  • 4,550
  • 6
  • 50
  • 79

0 Answers0