这是我的APP改装界面
@FormUrlEncoded
@POST("sendorder.php")
Call<order> sendOrder(@Field("name") String name,
@Field("link") String link,
@Field("amount") int amount,
@Field("price") double price);
下面是我的try catch
方法,用于将数据存储到房间数据库中,我也希望将数据存储在mysql数据库中。我该怎么做,甚至有可能做到?
builder.setNegativeButton("CONFIRM", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
dialogInterface.dismiss();
try {
mService = Common.getAPI();
Cart cartItem = new Cart();
cartItem.name = txt_product_dialog.getText().toString();
cartItem.amount = Integer.parseInt(number);
cartItem.price = finalPrice;
cartItem.link = foodList.get(position).Link;
Common.cartRepository.insertToCart(cartItem);
Log.d("KANZEN_DEBUG", new Gson().toJson(cartItem));
Toast.makeText(context, "Successfully Added To Your Order!",Toast.LENGTH_SHORT).show();
} catch (Exception ex) {
Toast.makeText(context, ex.getMessage(),Toast.LENGTH_SHORT).show();
}
}});
builder.setView(itemView);
builder.show();