我想學習如何開發我的第一個應用程序,但日食返回我的錯誤 「構造意圖是未定義」當我嘗試編譯此代碼:錯誤:構造意圖是不確定的
package com.baruckis.SlidingMenuImplementation.FromClass;
import android.app.Activity;
import android.content.Intent;
import android.widget.Toast;
import com.baruckis.SlidingMenuImplementation.R;
import com.baruckis.SlidingMenuImplementation.SlidingMenuListItem;
import com.baruckis.SlidingMenuImplementation.prova;
import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu;
public class SlidingMenuBuilderBase {
protected Activity activity;
protected SlidingMenu menu = null;
public void createSlidingMenu(Activity activity) {
this.activity = activity;
menu = new SlidingMenu(activity);
menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
menu.setShadowWidthRes(R.dimen.sliding_menu_shadow_width);
menu.setShadowDrawable(R.drawable.sliding_menu_shadow);
menu.setBehindOffsetRes(R.dimen.sliding_menu_offset);
menu.setFadeDegree(0.35f);
menu.attachToActivity(activity, SlidingMenu.SLIDING_WINDOW);
menu.setMenu(R.layout.sliding_menu_frame);
SlidingMenuListFragment slidingMenuListFragment = new SlidingMenuListFragment();
slidingMenuListFragment.setMenuBuilder(this);
activity.getFragmentManager().beginTransaction()
.replace(R.id.sliding_menu_frame, slidingMenuListFragment)
.commit();
}
public SlidingMenu getSlidingMenu() {
return menu;
}
public void onListItemClick(SlidingMenuListItem selectedSlidingMenuListItem) {
CharSequence text;
switch (selectedSlidingMenuListItem.Id) {
case R.slidingmenu.list_item_municipio_id:
Intent ii = new Intent(this, prova.class);
startActivity(ii);
finish();
break;
case R.slidingmenu.list_item_basic_id:
text = "Clicked item 「"
+ selectedSlidingMenuListItem.Name
+ "」. "
+ activity
.getString(R.string.toast_sliding_menu_custom_action);
Toast.makeText(activity, text, Toast.LENGTH_LONG).show();
break;
default:
text = "Clicked item. "
+ activity
.getString(R.string.toast_sliding_menu_no_action_default);
Toast.makeText(activity, text, Toast.LENGTH_LONG).show();
break;
}
}
}
我已經試過尋找其他線程的解決方案,但我沒有找到一種方法爲我工作!
優秀!它適用於我,謝謝:) – Peppegiuseppe