tags:

views:

74

answers:

2

I want to know how to move from one class to other class in android.
I have one main class i.e Addition.java(Main Activity) and i created other subactivity(Form.java). I want to how to make my move from one class(ie.Activity)to other.

I tried this,but not working out,just trying to figure out

Intent intent = new Intent();
intent.setClass(this.getParent(),Form.class);
startActivity(intent);

here Form.class is the subactivity, this.getParent I hope it represents main activity. And I created one activity in manifest.xml file and named it as .Form

Am i working right?

+1  A: 

The below code works perfectly.
Try it:

@Override
public void onClick(View v) 
{
Intent intent = new Intent();
intent.setClass(v.getContext(),Form.class);
startActivity(intent);
}
PM - Paresh Mayani
+1  A: 

make sure that activity is declared in Android.manifest.

Vishal
Hi Guys,I got my problem cleared,pblm is due to fact that i created constructor for that activity similar to java class,after removing it,it worked fineThanks for your help guys
Rakesh
You have a low rate. Important on SO, you have to mark accepted answers by using the tick on the left of the posted answer, below the voting. This will increase your rate.
Pentium10