3

I have been following this guide from google ( https://developer.android.com/training/basics/firstapp/starting-activity.html ) to make my first app and got the follwoing error: Error:(48, 29) error: cannot find symbol class intent Since I don't know much about Java I don't know what to do now, so can someone please help me!

Here is the code of MainActivity.java:

package com.mycompany.myfirstapp;

import android.content.Intent;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.content.Intent;
import android.view.View;
import android.widget.EditText;


public class MainActivity extends ActionBarActivity {
    public final static String EXTRA_MESSAGE = "com.mycompany.myfirstapp.MESSAGE";

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


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

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();

        //noinspection SimplifiableIfStatement
        if (id == R.id.action_settings) {
            return true;
        }

        return super.onOptionsItemSelected(item);
    }

    /**Called when the user clicks 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);
    }
}
CryoDrakon
  • 268
  • 1
  • 3
  • 12

1 Answers1

3

Here is the correct statement

Intent intent = new Intent(this, DisplayMessageActivity.class);

You should brush up your java concepts first before going on to android development. Intent and intent are recognized as two different things in Java.

Shubham Batra
  • 1,278
  • 1
  • 14
  • 27