i am beginner to android plz help i hav a main page and i want to open one form on each button....but it is opening only one page the remaining pages gives error..... here is my xml code of main page
<?xml version="1.0" encoding="utf-8"?>
<SlidingDrawer xmlns:android="http://schemas.android.com/apk/res/android"
android:background="@drawable/stars"
android:id="@+id/slidingDrawer1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:content="@+id/content"
android:handle="@+id/handle" >
<ImageView
android:id="@+id/handle"
android:layout_width="70dp"
android:layout_height="70dp"
android:src="@drawable/arrowup" />
<LinearLayout
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="332dp"
android:orientation="vertical" >
<Button
android:id="@+id/btnlenght"
android:layout_width="192dp"
android:layout_height="36dp"
android:layout_marginLeft="66dp"
android:layout_marginTop="22dp"
android:background="#3366cc"
android:textColor="#ffffff"
android:text="@string/btnlenght" />
<Button
android:id="@+id/btnweight"
android:layout_width="192dp"
android:layout_height="36dp"
android:layout_marginLeft="66dp"
android:layout_marginTop="22dp"
android:layout_weight="0.00"
android:textColor="#ffffff"
android:background="#3366cc"
android:text="@string/btnweight" />
<Button
android:id="@+id/btnarea"
android:layout_width="197dp"
android:layout_height="36dp"
android:layout_marginLeft="66dp"
android:layout_marginTop="22dp"
android:background="#3366cc"
android:textColor="#ffffff"
android:text="@string/btnarea" />
<Button
android:id="@+id/btntemperature"
android:layout_width="197dp"
android:layout_height="36dp"
android:layout_marginLeft="66dp"
android:layout_marginTop="22dp"
android:textColor="#ffffff"
android:background="#3366cc"
android:text="@string/btntemperature" />
<ImageView
android:id="@+id/back"
android:layout_width="74dp"
android:layout_height="88dp"
android:layout_marginLeft="0dp"
android:layout_marginTop="0dp"
android:layout_weight="0.24"
android:src="@drawable/back" />
</LinearLayout>
</SlidingDrawer>
and here coding of main page...............
public class firstpage extends Activity {
/** Called when the activity is first created. */
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.firstpage);
Button btnlenght=(Button)findViewById(R.id.btnlenght);
Button btnweight=(Button)findViewById(R.id.btnweight);
Button btnarea=(Button)findViewById(R.id.btnarea);
Button btntemperature=(Button)findViewById(R.id.btntemperature);
final ImageView handle=(ImageView)findViewById(R.id.handle);
ImageView back=(ImageView)findViewById(R.id.back);
SlidingDrawer slidingDrawer1=(SlidingDrawer)findViewById(R.id.slidingDrawer1);
slidingDrawer1.setOnDrawerOpenListener(new OnDrawerOpenListener() {
@Override
public void onDrawerOpened() {
// TODO Auto-generated method stub
handle.setImageResource(R.drawable.downarrow1);
}
});
slidingDrawer1.setOnDrawerCloseListener(new OnDrawerCloseListener() {
@Override
public void onDrawerClosed() {
// TODO Auto-generated method stub
handle.setImageResource(R.drawable.arrowup);
}
});
btnlenght.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Intent n = new Intent(v.getContext(),lenght.class);
startActivity(n);
}
});
btnweight.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Intent a = new Intent(v.getContext(),weight.class);
startActivity(a);
}
});
btnarea.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Intent n = new Intent(v.getContext(),Area.class);
startActivity(n);
}
});
btntemperature.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Intent n = new Intent(v.getContext(),temperature.class);
startActivity(n);
}
});
back.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Intent n = new Intent(v.getContext(),A2ZunitconverterActivity.class);
startActivity(n);
finish();
System.exit(0);
}
});
}
}