-1

please help me.I don't know what the error is. I have clean it already nothing happens.I only just put an action bar to that activity..

there's no error when I closed the eclipse and when i open it again, this happens. The import android.support.v7.app cannot be resolved ActionBarActivity cannot be resolved to a type The method onCreate(Bundle) of type MainViewActivity must override or implement a supertype method..etc

MY Code

    package com.example.slambook;

import android.support.v7.app.ActionBar;

import android.support.v7.app.ActionBarActivity;

import android.content.Intent;

import android.os.Bundle;

import android.view.Menu;

import android.view.MenuItem;

import android.view.View;

public class MainViewActivity extends ActionBarActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main_view);
        ActionBar aa = getSupportActionBar();
        aa.setDisplayShowTitleEnabled(false);

    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main_view, menu);
        return true;
    }
    public void onClick(View v){
        Intent i = new Intent(this,MainEditActivity.class);
        startActivity(i);
    }

    @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();
        if (id == R.id.action_edit) {
            Intent i = new Intent(this,MainEditActivity.class);
            startActivity(i);
        }
        return super.onOptionsItemSelected(item);
    }
}
Abhinav singh
  • 1,448
  • 1
  • 14
  • 31
lambda
  • 990
  • 1
  • 10
  • 29
  • `ActionBarActivity` is deprecated use `AppCompatActivity` – Pankaj Dec 18 '15 at 10:19
  • btw. there's an error in buildconfig.java in appcompat_v7 Implicit super constructor Object() is undefined for default constructor. Must define an explicit constructor – lambda Dec 18 '15 at 10:29
  • update your supportv7 library open SDK Manager and update your `support library` – Pankaj Dec 18 '15 at 10:31

1 Answers1

0

It's mostly a name change: ActionBarActivity doesn't really describe everything it now does. You can safely use ActionBarActivity if you wish to.

If you start a new development, then you should rather use new AppCompatActivity class right away. Check solutions for your problem:

The Import android.support.v7 cannot be resolved

ActionBarActivity cannot resolve a symbol

Android support v7 app cannot be resolved error

http://android-er.blogspot.in/2014/09/the-import-androidsupportv7-cannot-be.html

Thanks

Community
  • 1
  • 1
Androider
  • 3,833
  • 2
  • 14
  • 24