Activity does not return the view

Asked

Viewed 36 times

0

I’m trying to compile but it’s not giving, my layoute is like this:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:orientation="vertical"
  android:background="#F9F9F9" >

<include
    android:id="@+id/toolbar_actionbar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    layout="@layout/toolbar_default" />

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="DRAGÃO"
    android:id="@+id/textView"
    android:layout_centerVertical="true"
    android:layout_centerHorizontal="true"
    android:textSize="@dimen/abc_text_size_display_3_material"
    android:textColor="#ff0000" />
</RelativeLayout>

In my Activity I did so:

import android.support.v7.app.ActionBarActivity;
import org.androidannotations.annotations.EActivity;

@EActivity(R.layout.activity_comentarios)
public class ComentariosActivity extends ActionBarActivity {

}

I tried to remove the line

@EActivity(R.layout.activity_comentarios)

worked but when I enter the screen it gets all orange like in the image. inserir a descrição da imagem aqui

In case it should be like this:

inserir a descrição da imagem aqui

In the Logcat this error appears:

Error:(7, 1) error: The Androidmanifest.xml file contains the original Component, and not the Androidannotations generated Component. Please Register ComentariosActivity_Instead of Commentasactivity

On my Androidmanifest it’s like this:

<activity android:name=".ComentariosActivity"
       android:label="Comentarios"
       android:screenOrientation="portrait" />

2 answers

3

Error itself already gives the solution

Please Register ComentariosActivity_Instead of Commentasactivity

, on Androidmanifest put:

<activity android:name=".ComentariosActivity_"
   android:label="Comentarios"
   android:screenOrientation="portrait" />
  • I tried to do this and still the screens were not called

1


I managed to solve the problem, it was enough to change my class to:

package com.fomedemais.FomeDemais;

import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import org.androidannotations.annotations.EActivity;


public class ComentariosActivity extends ActionBarActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_comentarios);
    }
}

And yet add in AndroidManifest as my friend @sparkss' reply

<activity android:name=".ComentariosActivity_"
  android:label="Comentarios"
  android:screenOrientation="portrait" />

Browser other questions tagged

You are not signed in. Login or sign up in order to post.