Hello everybody,

I want to create a menu for an android application. But i have a problem, i want that when we click on a button "theme1" a new screen open. But it doesn't in my code. Can somebody helps me?


I made the following stuff

In XML


HTML Code:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context="my.menu.MainActivity" >
 
    <Button
        android:id="@+id/theme1"
        android:layout_width="90dp"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:layout_marginLeft="20dp"
        android:layout_marginTop="24dp"
        android:text="Theme 1" />
     
     
    <application android:icon="@drawable/ic_launcher" android:label="@string/app_name">
    <activity android:name=".Main"
        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=".screentheme1"
        </activity>
</application>
 
     
    <Button
        android:id="@+id/option"
        android:layout_width="90dp"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/theme2"
        android:layout_alignParentBottom="true"
        android:layout_marginBottom="60dp"
        android:text="Option" />
 
    <Button
        android:id="@+id/privé"
        android:layout_width="90dp"
        android:layout_height="wrap_content"
        android:layout_alignBaseline="@+id/option"
        android:layout_alignBottom="@+id/option"
        android:layout_alignLeft="@+id/theme1"
        android:text="privé" />
 
    <Button
        android:id="@+id/theme2"
        android:layout_width="90dp"
        android:layout_height="wrap_content"
        android:layout_alignBaseline="@+id/theme1"
        android:layout_alignBottom="@+id/theme1"
        android:layout_alignParentRight="true"
        android:layout_marginRight="42dp"
        android:text="Theme 2" />
 
    <Button
        android:id="@+id/theme4"
        android:layout_width="90dp"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/theme2"
        android:layout_below="@+id/theme2"
        android:layout_marginTop="88dp"
        android:text="Theme 4" />
 
    <Button
        android:id="@+id/theme3"
        android:layout_width="90dp"
        android:layout_height="wrap_content"
        android:layout_alignBaseline="@+id/theme4"
        android:layout_alignBottom="@+id/theme4"
        android:layout_alignLeft="@+id/privé"
        android:text="Theme 3" />
 
</RelativeLayout>

In XML le screentheme 1 who is the screen who open when push buton "theme1"


HTML Code:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >
 
     <TextView
        android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:gravity="center_horizontal"
    android:textSize="10pt"></TextView>
    
</LinearLayout>

In screentheme1 java:

Code:
package my.menu; 
 
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
 
public class screentheme1 extends Activity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.screentheme1); 
    }
     
    public class Main extends Activity {
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.Main);
            findViewById(R.id.theme1).setOnClickListener(new handleButton());
        }
        class handleButton implements OnClickListener {
            public void onClick(View v) {
            Intent intent = new Intent(Main.this, screentheme1.class);
            startActivity(intent); 
        }
        }
    }
}

string xml


HTML Code:
<?xml version="1.0" encoding="utf-8"?>
<resources>
 
    <string name="app_name">my.menu</string>
    <string name="hello_world">Hello world!</string>
    <string name="action_settings">Settings</string>
    <string name="button">button</string>
    <string name="Theme1">button</string>
     
 
</resources>



Thanks by advance. I'am a bit lost and i should really apreciate some help.