Facing problem in switching between two Activities........

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

Facing problem in switching between two Activities........

Postby Abhishek » Tue Jun 23, 2009 10:24 am

public class Abc extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
findViewById(R.id.Button1).setOnClickListener(m);
}
OnClickListener m = new OnClickListener() {
public void onClick(View v) {
Intent intent = new Intent(Abc.this,Def.class);

startActivity(intent);
}
};

}



public class Def extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.abc);
//findViewById(R.id.Button2).setOnClickListener(m);
}
OnClickListener m = new OnClickListener() {
public void onClick(View v) {
Intent intent = new Intent(Def.this,Abc.class);

startActivity(intent);
}
};

}
Abhishek
Junior Developer
Junior Developer
 
Posts: 13
Joined: Tue Jun 23, 2009 10:07 am

Top

Postby Sowmya » Tue Jun 23, 2009 11:10 am

Did you register the second activity in the Manifest file??
Sowmya
Experienced Developer
Experienced Developer
 
Posts: 51
Joined: Fri Mar 06, 2009 7:49 am

Postby Abhishek » Tue Jun 23, 2009 11:15 am

I don knw how to do that... can u plz. guide..?
Abhishek
Junior Developer
Junior Developer
 
Posts: 13
Joined: Tue Jun 23, 2009 10:07 am

Postby arams » Tue Jun 23, 2009 1:03 pm

<activity android:name=".Def"><intent-filter><action android:name="android.intent.action.MAIN"></action>
<category android:name="android.intent.category.Abc"></category>
</intent-filter>

Add it to manifeast file
arams
Experienced Developer
Experienced Developer
 
Posts: 89
Joined: Fri May 08, 2009 7:45 am

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 2 guests