Q:

Android deleting a row from a DB

I am trying to delete a row from my data base, I want to read in the user input and delete that row. What i am having trouble with is getting the user information and using that to delete the row. 
This is my code to read in the row information. I dont know what to write in the onClick method or weather that is even the right place
package com.example.rory.dbtest;

import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;

import com.pinchtapzoom.R;

public class delete extends Activity {

Button delete;
Public EditText edit1;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_delete);

    delete = (Button) findViewById(R.id.button);
    editi = (EditText) findViewById(R.id.edit1);
    delete.setOnClickListener((android.view.View.OnClickListener) this);

public void onClick(View v) {
    //what code do i enter here to read in and send rowid to the db class
}

}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.delete, menu);
    return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();
    if (id == R.id.action_settings) {
        return true;
    }
    return super.onOptionsItemSelected(item);
}
}

This is the DB code I am using as well
//---deletes a particular record---
public boolean deleteContact(long rowId)
{
    return db.delete(DATABASE_TABLE, KEY_ROWID + "=" + rowId, null) > 0;
}

A:

First you need to get the user input and validate if it's a valid value corresponding to your KEY_ROWID datatype (if it's an integer or long for example).
Assuming that yout KEY_ROWID its a Long number, you would do something like this:
public void onClick(View v) {
    //what code do i enter here to read in and send rowid to the db class
    //..this code:
    String userInput = edit1.getText().toString();

    //if the ROW ID its a number (long)
    try{
        long rowID = Long.parseLong(userInput);
        //call the delete method
        deleteContact(rowID);
    }catch(NumberFormatException e){
        Log.e("INPUT ERROR","Input is not a number!",e);
        //notify the user that the input is invalid.
        Toast.makeText(this,"Invalid Value!",Toast.LENGTH_LONG).show();
    }
}

