我正在使用start activity
我将第二个活动改为碎片。现在我使用start activity
Intent intentToOrder = new Intent(Food_Profile.this,
OrderMeal.class);
startActivity(intentToOrder);
请注意OrderMeal
是片段
public boolean onTouch(View v, MotionEvent event) {
if ((event.getAction() & MotionEvent.ACTION_MASK) == MotionEvent.ACTION_DOWN) {
// down
tv_orderMeal.setCompoundDrawablesWithIntrinsicBounds(0,
R.drawable.order_clicked, 0, 0);
} else if ((event.getAction() & MotionEvent.ACTION_MASK) == MotionEvent.ACTION_UP) {
tv_orderMeal.setCompoundDrawablesWithIntrinsicBounds(0,
R.drawable.order, 0, 0);
Basket.setRestaurant(restaurant);
List<OrderFood> foodsToOrder = new LinkedList<OrderFood>();
OrderFood oneFoodOrder = new OrderFood();
oneFoodOrder.setRestaurantFood(restaurantFood);
oneFoodOrder.setNumber(1);
foodsToOrder.add(oneFoodOrder);
Basket.setFoods(foodsToOrder);
Intent intentToOrder = new Intent(Food_Profile.this,
OrderMeal.class);
startActivity(intentToOrder);
// up
}
return true;
}
});
答案 0 :(得分:0)
试试这个:
Intent intentToOrder = new Intent(getActivity(),OrderMeal.class);
startActivity(intentToOrder);