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

  • SEARCH
  • Home
  • 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 8929833
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T08:45:32+00:00 2026-06-15T08:45:32+00:00

First- sorry if my question a bit dumb, I’m totally new to Android development

  • 0

First- sorry if my question a bit dumb, I’m totally new to Android development …

I’m trying to start a new activity from my “LAUNCHER” activity and run it on the emulator, but every time I click on the “Next” button (which should start my second activity), I get an error msg saying: “unfortunately, Omis hang man free has stopped”, and then closes the app…
also, when I re-launch the same app in the emulator without re-installing it from Eclipse, it doesn’t even showing me the first screen…

I don’t even know where my problem lies, so I attached 5 codes:

1’st activity layout (named “activity_open”)

<?xml version="1.0" encoding="utf-8" ?>
<LinearLayout 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:orientation="vertical"
    tools:context=".OpenActivity"
    android:background="#DCDCDC" >

    <LinearLayout 
        android:layout_height="fill_parent"
        android:layout_width="fill_parent"
        android:gravity="center"
        android:layout_weight="30" >

        <TextView
            android:id="@+id/tvEnterName"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:gravity="center"
            android:text="@string/stEnterName"
            android:textSize="24sp" />

    </LinearLayout>
    <LinearLayout 
        android:layout_height="fill_parent"
        android:layout_width="fill_parent"
        android:gravity="center"
        android:layout_weight="40" >

        <EditText
            android:id="@+id/etNameInput"
            android:layout_width="250dp"
            android:layout_height="fill_parent"
            android:background="#FFFFFF"
            android:focusableInTouchMode="true"
            android:gravity="center"
            android:hint="@string/stHintNameEnter"
            android:singleLine="true" />

    </LinearLayout>
<LinearLayout
    android:layout_height="fill_parent"
    android:layout_width="fill_parent"
    android:gravity="center"
    android:layout_weight="30" >

<Button
    android:id="@+id/bNext"
    android:layout_width="75dp"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:text="@string/stNext"
    android:textSize="24sp" />
</LinearLayout>

</LinearLayout>

1’st activity class (named “OpenActivity”)

package com.omi.hangmanfree;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Color;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

public class OpenActivity extends Activity {

TextView tvEnterYourName;
EditText etName;
Button bContinue;
String myName, tmp;
final String errorStr = "\nYou must enter a name!";

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_open);

    initialize();

    bContinue.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
            myName = etName.getText().toString();

            if(etName.getText().toString().equals("") == true)
            {
                tvEnterYourName.setText(tmp + errorStr);
                tvEnterYourName.setTextColor(Color.RED);
            }
            else
            {
                try {
                    Intent gameIntent = new    Intent("com.omi.hangmanfree.GAMEACTIVITY");
                    startActivity(gameIntent);
                } catch (Exception e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }
    });
}

private void initialize() {
    // TODO Auto-generated method stub
    tvEnterYourName = (TextView)findViewById(R.id.tvEnterName);
    etName = (EditText)findViewById(R.id.etNameInput);
    bContinue = (Button)findViewById(R.id.bNext);
    myName = "~";
    tmp = tvEnterYourName.getText().toString();
}



@Override
protected void onPause() {
    // TODO Auto-generated method stub
    super.onPause();

    finish();
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.activity_open, menu);
    return true;
}

}

2’nd activity class (named “GameActivity”)
package com.omi.hangmanfree;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.widget.GridView;
import android.widget.TextView;

public class GameActivity extends Activity {

TextView tt;
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_game);

    GridView gvGrid = (GridView)findViewById(R.id.gvHagdara);
    tt.setText("_");
    gvGrid.addView(tt);
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.activity_game, menu);
    return true;
}

}

2’nd activity layout (named “layout_game”)

<?xml version="1.0" encoding="utf-8" ?>
<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"
tools:context=".GameActivity" >

<TextView
    android:id="@+id/textView1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_centerVertical="true"
    android:text="@string/hello_world" />

<GridView
    android:id="@+id/gvHagdara"
    android:layout_width="match_parent"
    android:layout_height="50dp"
    android:layout_below="@+id/textView1"
    android:layout_centerInParent="false"
    android:numColumns="auto_fit" >

</GridView>

</RelativeLayout>

5. manifest

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.omi.hangmanfree"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="17" />

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name=".OpenActivity"
        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=".GameActivity"
        android:label="@string/title_activity_game" >
        <intent-filter>
            <action android:name="com.omi.hangmanfree.GAMEACTIVITY" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
</application>

</manifest>

I’m not looking for code improvements (I am only learning the language), so please do not send me suggestions to improve the code (I know there are a lot!) — I just want this code to work.

  • 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-15T08:45:33+00:00Added an answer on June 15, 2026 at 8:45 am

    The problem may be in the Intent. Try this:

    Intent gameIntent = new Intent(OpenActivity.this, GameActivity.class);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

first sorry if its a stupid question but im lost a bit. So when
First of all sorry if it's a dumb question (and surely it is), but
first of all, sorry if that question is dumb but I´m a total newbie
First of all, I'm fairly new to Java, so sorry if this question is
I'm sorry to make my first question here a bit of a simple one
Well, first of all sorry about this question it must be pretty straight forward
First off, sorry if this is a stupid question. I installed code::blocks to try
First of all, sorry if this isn't an appropriate question for StackOverflow. I've tried
First off, I'm sorry for asking such a simple question in such a sophisticated
Sorry, this's my first time to ask a question here. So, I don't have

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.