title: List view content-deleting query crashes the application
body: <p>This is a code for an account book app, where total of expenses would be shown on top, and the date would be shown right below it. There's one query that tries to delete an entry and subtract the sum of the expenses to the subtracted sum upon long press of the content. App image shown here : <a href="https://imgur.com/a/qUwqlFJ#X2etJ0S" rel="nofollow noreferrer">https://imgur.com/a/qUwqlFJ#X2etJ0S</a></p>
  
  <p>This, however, would crash the app, and I don't know why as I am very new on doing SQLite for android dev. Here are the code :</p>
  
  <p>Main activity code, where the error is suspected to happen :</p>
  
  <pre><code>list.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
              @Override
              public boolean onItemLongClick(AdapterView&lt;?&gt; adapterView, View view, int i, long l) {
  
                  new AlertDialog.Builder(MainActivity.this).setIcon(android.R.drawable.ic_delete)
                  .setTitle("Confirm Deletion")
                  .setMessage("Are you sure to delete this content?")
                  .setPositiveButton("Yes", new DialogInterface.OnClickListener() {
                      @Override
                      public void onClick(DialogInterface dialogInterface, int i) {
                          EditText eContext = (EditText) findViewById(R.id.edit_context);
                          EditText ePrice = (EditText) findViewById(R.id.edit_price);
                          String contexts = eContext.getText().toString();
                          int price = Integer.parseInt(ePrice.getText().toString());
                          String today_Date = getToday_date();
                          Log.d(TAG, "Value confirmed" + contexts + ", " + price + ", " + today_Date);
  
                          //Deletion query
                          String query = "DELETE FROM " + TABLE_NAME + " WHERE " + KEY_CONTEXT + "=? AND "
                                  + KEY_PRICE + "=? AND " + KEY_DATE + "=?";
                          db.execSQL(query, new String[]{contexts, ePrice.getText().toString(), String.format("%s", View_DATE)});
  
                          // Calculate sum value
                          String queryPriceSum = String.format(
                                  " SELECT SUM(price) FROM %s WHERE date = '%s'", TABLE_NAME, View_DATE);
                          cursor = db.rawQuery(queryPriceSum, null);
                          cursor.moveToNext();
                          String sum = String.valueOf(cursor.getInt(0));
                          Log.d(TAG, "sum : " + sum);
                          sum_view.setText(sum);
  
  
                          // cursor.requery();
                          String querySelectAll = String.format("SELECT * FROM %s WHERE date = '%s'", TABLE_NAME, View_DATE);
                          cursor = db.rawQuery(querySelectAll, null);
                          myAdapter.changeCursor(cursor);
                          //myAdapter.notifyDataSetChanged();
  
                          eContext.setText("");
                          ePrice.setText(0);
  
                          //InputMethodManager imm =
                          //        (InputMethodManager) getSystemService( Context.INPUT_METHOD_SERVICE );
                          //imm.hideSoftInputFromWindow( ePrice.getWindowToken(), 0 );
  
                      }
                  })
                  .setNegativeButton("No", null)
                  .show();
                  return true;
              }
          });
  </code></pre>
  
  <p>DBHelper class :</p>
  
  <pre><code>public MyDBHelper(Context context) {
  
          super(context, "My_Account_Data.db", null, 4);
      }
  
      public void onCreate(SQLiteDatabase db) {
          String query = String.format("CREATE TABLE %s ("
                  + "%s INTEGER PRIMARY KEY AUTOINCREMENT, "
                  + "%s TEXT, "
                  + "%s INTEGER, "
                  + "%s TEXT);", TABLE_NAME, KEY_ID, KEY_CONTEXT, KEY_PRICE, KEY_DATE);
          db.execSQL(query);
      }
  
      public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
          String query = String.format("DROP TABLE IF EXISTS %s", TABLE_NAME);
          db.execSQL(query);
          onCreate(db);
      }
  </code></pre>
  
  <p>Cursor Adapter class : </p>
  
  <pre><code> String TAG = "MyCursorAdapter";
      public MyCursorAdapter(Context context, Cursor c) {
          super(context, c);
      }
      @Override
      public View newView(Context context, Cursor cursor, ViewGroup parent) {
          LayoutInflater inflater = LayoutInflater.from( context );
          View v = inflater.inflate( R.layout.list_item, parent,false );
          return v;
  
      }
  
      @Override
      public void bindView(View view, Context context, Cursor cursor) {
  
          TextView item_context = (TextView) view.findViewById( R.id.item_context );
          TextView item_price = (TextView) view.findViewById( R.id.item_price );
  
  
          String contexts = cursor.getString( cursor.getColumnIndex( MainActivity.KEY_CONTEXT ) );
          String price = cursor.getString( cursor.getColumnIndex( MainActivity.KEY_PRICE ) );
  
          Log.d(TAG, contexts + ", " + price);
  
          item_context.setText( contexts );
          item_price.setText( price );
  
      }
  </code></pre>
  
  <p>Logcat :</p>
  
  <pre><code>2019-06-21 08:32:57.052 17280-17280/org.androidtown.mycalendar D/InputMethodManager: getNavigationBarColor() -855310
  2019-06-21 08:32:57.188 17280-17280/org.androidtown.mycalendar D/ViewRootImpl@ef6be96[MainActivity]: ViewPostIme pointer 1
  2019-06-21 08:32:57.190 17280-17280/org.androidtown.mycalendar D/AbsListView: onTouchUp() mTouchMode : -1
  2019-06-21 08:32:57.650 17280-17280/org.androidtown.mycalendar D/ViewRootImpl@1632a00[MainActivity]: ViewPostIme pointer 0
  2019-06-21 08:32:57.751 17280-17280/org.androidtown.mycalendar D/ViewRootImpl@1632a00[MainActivity]: ViewPostIme pointer 1
  2019-06-21 08:32:57.768 17280-17280/org.androidtown.mycalendar D/AndroidRuntime: Shutting down VM
  2019-06-21 08:32:57.770 17280-17280/org.androidtown.mycalendar E/AndroidRuntime: FATAL EXCEPTION: main
      Process: org.androidtown.mycalendar, PID: 17280
      java.lang.NumberFormatException: For input string: ""
          at java.lang.Integer.parseInt(Integer.java:627)
          at java.lang.Integer.parseInt(Integer.java:650)
          at org.androidtown.mycalendar.MainActivity$2$1.onClick(MainActivity.java:128)
          at android.support.v7.app.AlertController$ButtonHandler.handleMessage(AlertController.java:166)
          at android.os.Handler.dispatchMessage(Handler.java:106)
          at android.os.Looper.loop(Looper.java:214)
          at android.app.ActivityThread.main(ActivityThread.java:7045)
          at java.lang.reflect.Method.invoke(Native Method)
          at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:965)
  2019-06-21 08:32:57.790 17280-17280/org.androidtown.mycalendar I/Process: Sending signal. PID: 17280 SIG: 9
  </code></pre>
  
  <p>Any help for pinpointing the problem and/or on solving it would be appreciated, thank you in advance!</p>