I am working on a game and I want to set the layout of game such that it works on Multiple device screens. So, instead of fetching images from asset's folder
, I making looking for some way to fetch it from the drawable folder
. So, that later on I can get the images according to the screen of the device.
Update:
I tried it using
mFaceTextureRegionLifeLine = (TiledTextureRegion) TextureRegionFactory.createFromResource(mTextureLifeLine, this, R.drawable.icon, 100, 100);
And, it fired me with and error below-
09-05 19:02:38.923: ERROR/AndroidRuntime(4161): FATAL EXCEPTION: main
09-05 19:02:38.923: ERROR/AndroidRuntime(4161): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.engine/com.engine.BallDemo}: java.lang.ClassCastException: org.anddev.andengine.opengl.texture.region.TextureRegion
09-05 19:02:38.923: ERROR/AndroidRuntime(4161): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
09-05 19:02:38.923: ERROR/AndroidRuntime(4161): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
09-05 19:02:38.923: ERROR/AndroidRuntime(4161): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
09-05 19:02:38.923: ERROR/AndroidRuntime(4161): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
09-05 19:02:38.923: ERROR/AndroidRuntime(4161): at android.os.Handler.dispatchMessage(Handler.java:99)
09-05 19:02:38.923: ERROR/AndroidRuntime(4161): at android.os.Looper.loop(Looper.java:123)
09-05 19:02:38.923: ERROR/AndroidRuntime(4161): at android.app.ActivityThread.main(ActivityThread.java:4627)
09-05 19:02:38.923: ERROR/AndroidRuntime(4161): at java.lang.reflect.Method.invokeNative(Native Method)
09-05 19:02:38.923: ERROR/AndroidRuntime(4161): at java.lang.reflect.Method.invoke(Method.java:521)
09-05 19:02:38.923: ERROR/AndroidRuntime(4161): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
09-05 19:02:38.923: ERROR/AndroidRuntime(4161): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
09-05 19:02:38.923: ERROR/AndroidRuntime(4161): at dalvik.system.NativeStart.main(Native Method)
09-05 19:02:38.923: ERROR/AndroidRuntime(4161): Caused by: java.lang.ClassCastException: org.anddev.andengine.opengl.texture.region.TextureRegion
09-05 19:02:38.923: ERROR/AndroidRuntime(4161): at com.engine.BallDemo.onLoadResources(BallDemo.java:132)
09-05 19:02:38.923: ERROR/AndroidRuntime(4161): at org.anddev.andengine.ui.activity.BaseGameActivity.onCreate(BaseGameActivity.java:57)
09-05 19:02:38.923: ERROR/AndroidRuntime(4161): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
09-05 19:02:38.923: ERROR/AndroidRuntime(4161): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
09-05 19:02:38.923: ERROR/AndroidRuntime(4161): ... 11 more
So, if it is possible let me know. Thanks, Suri Sahani.