I'm doing an application that needs to switch between screens and the following error appears:
inicio.java:
package com.example.deadsec.gerflores;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class inicio extends AppCompatActivity {
//identificando o botão
Button botaoestoque = (Button) findViewById(R.id.btn_estoque);
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_inicio);
//configurando o botão estoque
botaoestoque.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
Intent trocatela = new Intent(inicio.this,carrinho.class);
inicio.this.startActivity(trocatela);
inicio.this.finish();
}
});
}
}
AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.deadsec.gerflores">
<uses-permission android:name="android.permission.CAMERA" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/Theme.MyTheme">
<activity android:name=".inicio">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".carrinho"
android:label="carrinho">
</activity>
<activity android:name=".prateleira"
android:label="prateleira">
</activity>
<activity android:name=".cocho"
android:label="cocho">
</activity>
<activity android:name=".qrcodereader"
android:label="qrcodereader">
<meta-data android:name="com.google.android.gms.vision.DEPENDENCIES"
android:value="barcode"/>
</activity>
<activity android:name=".toolbar"
android:label="toolbar">
</activity>
</application>
</manifest>