* commit 'ba1ae3af76466b94efedf06c4efac365fd7b9300': Don't instantiate non-Fragments in Fragment.instantiate
This commit is contained in:
@ -580,6 +580,10 @@ public class Fragment implements ComponentCallbacks2, OnCreateContextMenuListene
|
||||
if (clazz == null) {
|
||||
// Class not found in the cache, see if it's real, and try to add it
|
||||
clazz = context.getClassLoader().loadClass(fname);
|
||||
if (!Fragment.class.isAssignableFrom(clazz)) {
|
||||
throw new InstantiationException("Trying to instantiate a class " + fname
|
||||
+ " that is not a Fragment", new ClassCastException());
|
||||
}
|
||||
sClassMap.put(fname, clazz);
|
||||
}
|
||||
Fragment f = (Fragment)clazz.newInstance();
|
||||
|
Reference in New Issue
Block a user