I have a custom RadioButton class, i have placed it on Activity1. I am using its event "onClick" to open another Activity2. Below is the code:
public class custom_radiobutton extends RadioButton{
Paint myPaint = new Paint();
private Context cont;
public custom_radiobutton(Context context) {
super(context);
cont = context;
}
public custom_radiobutton(Context context, AttributeSet attrbs) {
super(context, attrbs);
cont = context;
}
@Override
protected void onDraw (Canvas canvas) {
super.onDraw(canvas);
String myText = (String) getText();
canvas.drawText(myText, 10, 10, myPaint);
this.setOnClickListener(radio_listener);
}
OnClickListener radio_listener = new OnClickListener() {
public void onClick(View v)
{
try
{
Intent intent = new Intent("com.moftak.db.ImageActivity");
// next line do nothing..
getContext().startActivity(intent);
// next line also not works
//cont.startActivity(intent);
}
catch(Exception ex)
{
Log.d("Image", "Error: "+ex.toString());
}
}
};
}
EDIT: The problem is that the line "getContext().startActivity(intent); " is throwing below error:
android.content.ActivityNotFoundException: No Activity found to handle Intent { act=com.moftak.db.ImageActivity (has extras) }
Can somebody help, please?
Thanks for your valuable time & help.
Please accept my apologies, i found the issue (VERY BIG MISTAKE, sorry for that), the Activity2 was not specified in the AndroidManifest.xml