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 8258485
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T02:33:09+00:00 2026-06-08T02:33:09+00:00

I am a new android developer and encountered a problem while following the tutorial

  • 0

I am a new android developer and encountered a problem while following the tutorial on Android’s site – http://developer.android.com/training/basics/firstapp/starting-activity.html

My program loads on the emulator fine, but when you type something into the EditText and then hit the send button, a window pops up saying “App has stopped working”. It seems as though my new activity isn’t being created and I’m not sure as to why. I’ve scoured the web (and my code) to see if I could get a solution but did so to no avail. Any help would be appreciated.

The code for my first activity:

package com.example.appli;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.widget.EditText;

public class MainActivity extends Activity {
public final static String EXTRA_MESSAGE = "com.example.myapp.MESSAGE";

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.testlayout);

   //////Button myButton = (Button) findViewById(R.id.my_button); //Told in tutorial to put this in onCreate
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.activity_main, menu);
    return true;
}


/** Called when the user selects the Send button */
public void sendMessage(View view) {
    // Do something in response to button
    Intent intent = new Intent(this, DisplayMessageActivity.class);
    EditText editText = (EditText) findViewById(R.id.edit_message);
    String message = editText.getText().toString();
    intent.putExtra(EXTRA_MESSAGE, message);
    startActivity(intent);
}

}

The code for my second activity (the one being called)

 package com.example.appli;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.TextView;

    public class DisplayMessageActivity extends Activity{

@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        //get message from intent
        Intent intent = getIntent();
        String message = intent.getStringExtra(MainActivity.EXTRA_MESSAGE);

        // Create the text view
        TextView textView = new TextView(this);
        textView.setTextSize(40);
        textView.setText(message);

        setContentView(textView);
    }
}

The Manifest

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.appli"
android:versionCode="1"
android:versionName="1.0" >

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

<application

    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >

    <activity android:name="com.example.myapp.DisplayMessageActivity" />

    <activity
        android:name=".MainActivity"
        android:label="@string/title_activity_main" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

</manifest>
  • 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-08T02:33:12+00:00Added an answer on June 8, 2026 at 2:33 am

    you have declared only one Activity that’s also wrong package name

    already your manifest has the package name

    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.appli"
    

    so just declare like this

    <activity android:name=".DisplayMessageActivity" />
    

    and you need to add this in your manifest also

     <activity android:name=".MainActivity />
    

    remove the target SDK version that you mentioned

    android:targetSdkVersion="15"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to Android and I'm playing around with the sample code at http://developer.android.com/training/basics/fragments/index.html
New Android developer here. I'm following a tutorial at http://www.vogella.de/ . The first applications
The new Android 2.1 SDK (version 7) has a new class called SignalStrength: http://developer.android.com/reference/android/telephony/SignalStrength.html
I was reading the new Android Design Standards here: http://developer.android.com/design/patterns/selection.html and was wondering first
The new Android design docs mention use of an Up caret: http://developer.android.com/design/patterns/actionbar.html The up
The tutoriel in question is http://developer.android.com/resources/tutorials/views/hello-gridview.html The Tutorial asks that you 1- Create a
The new Android in-app billing (http://developer.android.com/guide/market/billing/billing_testing.html) page says: To test in-app billing in an
I'm following the instructions found at http://developer.android.com/guide/publishing/licensing.html I made a copy of the <sdk>/market_licensing
Aloha, I've been following the guidelines here: http://developer.android.com/resources/tutorials/testing/helloandroid_test.html To create some simple test cases
I'm following the android developer tutorials on tab layouts. (im very very new to

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.