Skip to content

Instantly share code, notes, and snippets.

@gehaxelt
Created June 2, 2012 21:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gehaxelt/2859966 to your computer and use it in GitHub Desktop.
Save gehaxelt/2859966 to your computer and use it in GitHub Desktop.
SQLInjectionActivity-Class for an android application
package in.gehaxelt.sqlinjection;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
public class SQLInjectionActivity extends Activity implements OnClickListener {
/** Called when the activity is first created. */
Button gobutton;
EditText injection;
Databasehelper DB;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
gobutton=(Button)findViewById(R.id.gobutton);
injection=(EditText)findViewById(R.id.injection);
gobutton.setOnClickListener(this);
DB = new Databasehelper(getApplicationContext());
}
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
if(v==gobutton) {
debugger.debug(injection.getText().toString());
try {
String ouput= DB.getID(injection.getText().toString());
debugger.debug(ouput);
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment