IllegalArgumentException when calling open() from Activity's onCreate
Closed this issue · 0 comments
I modified the sample with the following code :
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mSlideHolder = (SlideHolder) findViewById(R.id.slideHolder);
mSlideHolder.open();
}
If I want the menu to be opened when the screens shows up, I call the open() method from the onCreate, but I get an exception :
04-04 14:54:50.018: E/AndroidRuntime(20351): Caused by: java.lang.IllegalArgumentException: width and height must be > 0
04-04 14:54:50.018: E/AndroidRuntime(20351): at android.graphics.Bitmap.createBitmap(Bitmap.java:638)
04-04 14:54:50.018: E/AndroidRuntime(20351): at android.graphics.Bitmap.createBitmap(Bitmap.java:620)
04-04 14:54:50.018: E/AndroidRuntime(20351): at com.agimind.widget.SlideHolder.initSlideMode(SlideHolder.java:436)
04-04 14:54:50.018: E/AndroidRuntime(20351): at com.agimind.widget.SlideHolder.open(SlideHolder.java:153)
04-04 14:54:50.018: E/AndroidRuntime(20351): at com.agimind.sidemenuexample.MainActivity.onCreate(MainActivity.java:19)
Maybe the exception thrown should be more explicit, or there should not be any exception at all, and the menu would just open.
This should work if calling open() from the Activity's onResume(), but It would be great to work as well from onCreate.