I recently moved to Android from python and am stuck here.
This is my class declaration to create a common function for an Alert Dialog which accepts necessary parameter
ButtonClickBySani(R.id.btnsehrabandi, sehrabandiActivity.class);
private void ButtonClickBySani(int ButtonId, final Class extends Activity> ActivityToOpen)
{
Button btn;
// Locate the button in activity_main.xml
btn = (Button) findViewById(ButtonId);
// Capture button clicks
btn.setOnClickListener(new OnClickListener() {
public void onClick(View arg0) {
startActivity(new Intent(getBaseContext(), ActivityToOpen));
// Start NewActivity.class
//Intent myIntent = new Intent(getBaseContext(), ActivityToOpen);
// startActivity(myIntent);
}
});
}