/**
  * Called when "Clear" button is clicked.
  *
  * @param v View that was clicked.
  */
 public void onClearClick(View v) {
   smartStoreIntf.deleteAccountsSoup();
   smartStoreIntf.deleteOpportunitiesSoup();
   smartStoreIntf.createAccountsSoup();
   smartStoreIntf.createOpportunitiesSoup();
   Toast.makeText(this, "Offline data has been cleared.", Toast.LENGTH_SHORT).show();
 }
 /**
  * Called when the join query button is clicked.
  *
  * @param v View that was clicked.
  */
 public void onJoinQueryClick(View v) {
   final String smartSql = getString(R.string.join_button_query);
   final JSONArray opportunities = smartStoreIntf.query(smartSql);
   if (opportunities != null) {
     launchResultActivity(opportunities.toString());
   }
 }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    smartStoreIntf = new SmartStoreInterface();

    // Creates soups, if they don't exist already.
    smartStoreIntf.createAccountsSoup();
    smartStoreIntf.createOpportunitiesSoup();

    // Configures options for the progress indicator.
    progressDialog = new ProgressDialog(this);
    progressDialog.setTitle("Fetching records...");
    progressDialog.setMessage("Please wait...");
    progressDialog.setCancelable(true);
    progressDialog.setIndeterminate(true);
  }