Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9220889
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T03:27:12+00:00 2026-06-18T03:27:12+00:00

This is the main java code where in i have created a main game

  • 0

This is the main java code where in i have created a main game menu the settings page i have tried with an xml file:

 package com.self;
 import android.app.Activity;
 import android.content.Intent;
 import android.os.Bundle;
 import android.view.View;
 import android.view.View.OnClickListener;
 import android.widget.Button;
 import android.widget.TextView;

 public class main extends Activity implements OnClickListener {

TextView c, ng, h, cr, s, e;

@Override
protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(com.self.R.layout.main);
    c = (TextView) findViewById(com.self.R.id.cont);
    ng = (TextView) findViewById(com.self.R.id.newg);
    h = (TextView) findViewById(com.self.R.id.help);
    cr = (TextView) findViewById(com.self.R.id.credits);
    s = (TextView) findViewById(com.self.R.id.settings);
    e = (TextView) findViewById(com.self.R.id.exit);
    c.setOnClickListener(this);
    ng.setOnClickListener(this);
    h.setOnClickListener(this);
    cr.setOnClickListener(this);
    s.setOnClickListener(this);
    e.setOnClickListener(this);

}

@Override
public void onClick(View v) {
    // TODO Auto-generated method stub
    switch (v.getId()) {
    case com.self.R.id.settings:
        Class myclass;
        try {
            myclass = Class.forName("com.self.settings");

            Intent myint = new Intent(main.this, myclass);
            startActivity(myint);
        } catch (ClassNotFoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        break;

    }

   }

    }

and the settings.xml file which is supposed to open when i click on the settings textview in main xml file .

   <TextView android:text="@string/sound" 
            android:layout_width="fill_parent" android:layout_height="20dp"
            android:layout_gravity="right" android:id="@+id/sound">                             
</TextView>

<TextView android:text="@string/music" android:id="@+id/music"
     android:layout_width="fill_parent"
    android:layout_height="20dp" style="@style/MenuFont">
</TextView>

<TextView android:text="@string/vibrate" android:layout_width="fill_parent"
     android:layout_height="20dp" android:id="@+id/vibrate"
    style="@style/MenuFont">
</TextView>
<TextView android:text="@string/graphics"
    android:layout_width="fill_parent" android:layout_height="20dp"
     android:id="@+id/graphics" style="@style/MenuFont">
</TextView>
<TextView android:text="@string/back" 
    android:layout_width="fill_parent" android:layout_height="20dp"

    android:id="@+id/back" style="@style/MenuFont">
</TextView>

     </LinearLayout>

And This is my manifest :

<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=".settings" android:label="@string/app_name"> 
      <intent-filter> 
            <action android:name="android.intent.action.SETTINGS" /> 
                  <category android:name="android.intent.category.DEFAULT" />

This is my Logcat report :

ERROR/AndroidRuntime(438): FATAL EXCEPTION: main ERROR/AndroidRuntime(438): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.self/com.self.settings}: android.content.res.Resources$NotFoundException: Resource ID #0x7f060002 type #0x12 is not valid
ERROR/AndroidRuntime(438): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1622)
ERROR/AndroidRuntime(438): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1638)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T03:27:13+00:00Added an answer on June 18, 2026 at 3:27 am

    The issue is with the contentview . can you please let me know why have you set the layout as id? setContentView(com.self.R.id.settings); besides you should set it as setContentView(R.layout.settings);

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I created a List.java file in folder UtilityPack which contains this code package Utilities;
I have a GridView like this( main.xml ): <?xml version=1.0 encoding=utf-8?> <GridView xmlns:android=http://schemas.android.com/apk/res/android android:id=@+id/gridView1
This is my code in my main java file. How would i make another
i write this code in main.java ArrayList<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(); try{ HttpClient httpclient
Try this code - import java.io.StringReader; public class StringReaderTest { public static void main(String[]
my android app crash before load main.xml. This is the exception thrown java.lang.RuntimeException: Unable
I have the code on github, https://github.com/Quillion/Game And I would like to make it
I have this code: public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); ListView lv =
I have created three threads in a java program. One is the main program,
I have created an Android Library. That has all the main code. Also I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.