Solved

DisplayMessageActivity not a type?

Posted on 2014-11-03
4
477 Views
Last Modified: 2014-11-10
Noob developing Android apps.


public void sendMessage(View view) {
    	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);
    }

Open in new window


Does not know what DisplayMessageActivity is.  It says:

DisplayMessageActivity cannot be resolved to a type.

Here are my includes:

package com.netendeavor.ws;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.EditText;

//DisplayMessageActivity.class;

import android.app.Activity;
import android.content.Intent;
import android.widget.TextView;
import android.view.View;
import android.os.Bundle;
0
Comment
Question by:knowlton
  • 2
  • 2
4 Comments
 
LVL 17

Accepted Solution

by:
Chris Harte earned 500 total points
ID: 40420122
Another google cockup by the looks of it. If you are doing the google tutorial, read this solution

http://stackoverflow.com/questions/13190256/displaymessageactivity-cannot-be-resolved-to-a-type-building-first-android-app/15978679#15978679
0
 
LVL 5

Author Closing Comment

by:knowlton
ID: 40422599
They don't explain that later on you create an activity fragment for the class in question.  Meh.

I was left thinking this was some sort of built-in method.
0
 
LVL 17

Expert Comment

by:Chris Harte
ID: 40423773
You are not the first to be caught out by this. If you are using eclipse (and I assume android studio), when you mouse over a class name it will pop up its declaration, whether it is a library function or one of your own. If it does not exist it will tell you and give you the option of creating it. This can be useful when doing poorly constructed tutorials.
0
 
LVL 5

Author Comment

by:knowlton
ID: 40433027
>>>>This can be useful when doing poorly constructed tutorials.

LOL
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A short article about problems I had with the new location API and permissions in Marshmallow
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
This video is in connection to the article "The case of a missing mobile phone (https://www.experts-exchange.com/articles/28474/The-Case-of-a-Missing-Mobile-Phone.html)". It will help one to understand clearly the steps to track a lost android phone.
This video demonstrates how to sync Microsoft Exchange Public Folders with smartphones using CodeTwo Exchange Sync and Exchange ActiveSync. To learn more about CodeTwo Exchange Sync and download the free trial, go to: http://www.codetwo.com/excha…

822 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question