[Android Software Development] adilshoukat:
Hi,

I am new to android development. I am facing problem in switching between activities. I am attaching the code files ... Please help me solve this problem

Being a new user the Forum doesn't allow me to write atTheRateSign in my message ... I am replacing it with % sign. Please don't confuse it.

Main Activity:

package swz.pkg;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class SWMainActivity extends Activity {
/** Called when the activity is first created. */
%Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);

Button btnMSrch = (Button) findViewById(R.id.btnClosetSearch);

try{
btnMSrch.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Intent myIntent = new Intent(v.getContext(),ClosetSearchAct.class);
startActivityForResult(myIntent,0);
}

});
}
catch (Exception ex)
{
System.out.println("---------------------******------------------------");
ex.printStackTrace();
System.out.println();
System.out.println("---------------------******------------------------");
}

}
}

main.xml

<?xml version="1.0" encoding="utf-8"?>
<AbsoluteLayout
android:id="%+id/widget0"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="ht ... android"
>

<Button
android:id="%+id/btnMeasurementSearch"
android:layout_width="fill_parent"
android:layout_height="150px"
android:background="#ffffffff"
android:text="Measurement Search"
android:textSize="26sp"
android:typeface="serif"
android:textStyle="bold"
android:textColor="#ff8c2528"
android:layout_x="0px"
android:layout_y="47px"
>
</Button>
<Button
android:id="%+id/btnClosetSearch"
android:layout_width="fill_parent"
android:layout_height="150px"
android:text="Closet Search"
android:textSize="26sp"
android:typeface="serif"
android:textStyle="bold"
android:textColor="#ff462556"
android:layout_x="0px"
android:layout_y="213px"
>
</Button>

</AbsoluteLayout>

closetSearch activity(The next activity I want to move to):

package swz.pkg;

import android.app.Activity;
import android.os.Bundle;

public class ClosetSearchAct extends Activity {
public void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.closetsearchact);

}
}

closetsearchact.xml

<?xml version="1.0" encoding="utf-8"?>
<AbsoluteLayout
android:id="%+id/widget1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="ht .... android"
>
<Spinner
android:id="%+id/spinner1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_x="0px"
android:layout_y="33px"
>
</Spinner>
<Spinner
android:id="%+id/spinner2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_x="0px"
android:layout_y="101px"
>
</Spinner>
<Spinner
android:id="%+id/spinner3"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_x="0px"
android:layout_y="173px"
>
</Spinner>
<ImageButton
android:id="%+id/btnReg"
android:layout_width="128px"
android:layout_height="wrap_content"
android:src="%drawable/reg"
android:layout_x="151px"
android:layout_y="279px"
>
</ImageButton>
<ImageButton
android:id="%+id/btnSearch"
android:layout_width="114px"
android:layout_height="49px"
android:src="%drawable/search"
android:layout_x="37px"
android:layout_y="279px"
>
</ImageButton>
</AbsoluteLayout>

AndroidManifest.xml:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="ht ... android"
package="swz.pkg"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="%drawable/icon" android:label="%string/app_name">
<activity android:name=".SWMainActivity"
android:label="%string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

<activity android:name=".ClosetSearchAct" android:label="%string/app_name"> </activity>

</application>

</manifest>