Вопрос

So I'm using jfeinstein10's SlidingMenu, I have a blank main activity that setup a left panel menu in this way:

setContentView(R.layout.activity_main);

menu.setMode(SlidingMenu.LEFT);
menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
menu.setShadowWidthRes(R.dimen.shadow_width);
menu.setShadowDrawable(R.drawable.shadow);
menu.setBehindOffsetRes(R.dimen.slidingmenu_offset);
menu.setFadeDegree(0.35f);

menu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT);
menu.setMenu(R.layout.activity_fpricerca_addetti);

...on the OnCreate method. It works, it calls the XML correctly but I cant get how to call an Activity. In this case a ListActivity called FPRicercaAddetti that extends ListFragment.

I want to call the onCreate method of the other Activity when the left panel is sliding. Any ideas?

Thanks.

PS: another solution is to call the customization of the left panel in the same main activity, but I dont want to call all the stuff when the app starts, but only when the left panel is focused.

Это было полезно?

Решение

Only one activity can run at a time. You cannot use an activity as the SlidingMenu.

From your description, I believe you want to use a Fragment. (A demo of fragment use is included with the library).

You can place a fragment (ListFragment) in the sliding menu which will keep all its code self contained or simply use any other view (such as a ListView) and access it exactly like you would any other view.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top