MCPcopy Create free account
hub / github.com/codenameone/CodenameOne / createImage

Method createImage

CodenameOne/src/com/codename1/ui/Image.java:179–192  ·  view source on GitHub ↗
(String path)

Source from the content-addressed store, hash-verified

177 ///
178 /// - `java.io.IOException`
179 @SuppressWarnings("PMD.DoNotCallGarbageCollectionExplicitly")
180 public static Image createImage(String path) throws IOException {
181 try {
182 return new Image(Display.impl.createImage(path));
183 } catch (OutOfMemoryError err) {
184 // Images have a major bug on many phones where they sometimes throw
185 // an OOM with no reason. A system.gc followed by the same call over
186 // solves the problem. This has something to do with the fact that
187 // there is no Image.dispose method in existance.
188 System.gc();
189 System.gc();
190 return new Image(Display.impl.createImage(path));
191 }
192 }
193
194 /// creates an image from the given native image (e.g. MIDP image object)
195 ///

Callers 15

toImageMethod · 0.95
tileLoadedMethod · 0.95
rasterizeMethod · 0.95
toImageMethod · 0.95
loadBaseColorTextureMethod · 0.95
circleTextureMethod · 0.95
imageMethod · 0.95
resolveArtMethod · 0.95
postResponseMethod · 0.95
ShareFormMethod · 0.95
screenshotMethod · 0.95
runMethod · 0.95

Calls 2

gcMethod · 0.95
createMutableImageMethod · 0.45

Tested by 15

screenshotTestMethod · 0.76
tryPaintHeadlessMethod · 0.76
runMethod · 0.76
captureMethod · 0.76
saveScreenshotMethod · 0.76
captureAndEmitMethod · 0.76
buildGridMethod · 0.76
runChecksMethod · 0.76
paintMethod · 0.76
buildBadgeMethod · 0.76
runTestMethod · 0.76
paintFrameMethod · 0.76