Skip to content

Instantly share code, notes, and snippets.

@parahall
Last active March 9, 2019 17:03
Show Gist options
  • Save parahall/b29b9dff205436f24c9122c208072f04 to your computer and use it in GitHub Desktop.
Save parahall/b29b9dff205436f24c9122c208072f04 to your computer and use it in GitHub Desktop.
NewOrderPresenter.java
public class NewOrderPresenter extends BasePresenter<NewOrderView> {
//...
private int insertOrder(Order order) {
//turn order to ContentValues object (used by SQL to insert values to Table)
ContentValues values = order.createLocalOrder(order);
//call resolver to insert data to the Order table
Uri uri = context.getContentResolver().insert(KolGeneContract.OrderEntry.CONTENT_URI, values);
//get Id for order.
if (uri != null) {
return order.getLocalId();
}
return -1;
}
//...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment