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 parameters:
public static AlertDialog.Builder getAlertDialog(String strArray[],
String strTitle, Activity v) {
return new AlertDialog.Builder(v)
.setTitle(strTitle).setItems(strArray,
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
}
});
}
But I cannot call this function via this piece of code which gives me an error:
getAlertDialog(strArray, strTitle, MakeCall.class).show();
The error is:
the method getAlertDialog(String[], String, Activity) in the type MakeCallAlertDialog is not applicable for the arguments (String[], String, Class<TestActivity>)
How can I get this correctly?