私は新しいレイアウトをテストしており、MainActivityからボタンをクリックすると新しいレイアウトを表示する必要があります。私はグーグルしてすべての答えを試みたが、コードのすべての部分は、アプリケーションがクラッシュする原因に終わる。現在、シンボルview
を解決できない問題が発生しています。ボタンをクリックしてビューを変更しようとしています
どのような考えですか?あなたの助けが大変ありがとうございます。ここに私のコードは次のとおりです。私のクラッシュログは、(Logcatから)以下である
package com.example.consumer.example;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.content.Intent;
import android.widget.Button;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button button = (Button) findViewById(R.id.next);
button.setOnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(MainActivity.this, LoginActivity.class);
startActivity(intent);
};
};
}
}
:
01-09 21:40:40.787 7001-7001/? E/android.os.Debug: failed to load memtrack module: -2
01-09 21:40:40.847 7006-7006/? E/memtrack: Couldn't load memtrack module (No such file or directory)
01-09 21:40:40.847 7006-7006/? E/android.os.Debug: failed to load memtrack module: -2
01-09 21:40:41.196 7022-7022/? E/memtrack: Couldn't load memtrack module (No such file or directory)
01-09 21:40:41.196 7022-7022/? E/android.os.Debug: failed to load memtrack module: -2
01-09 21:41:04.597 6950-6965/? E/EGL_emulation: tid 6965: eglSurfaceAttrib(1146): error 0x3009 (EGL_BAD_MATCH)
01-09 21:41:04.620 6950-6950/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.surrrge.consumer.surrrge, PID: 6950
java.lang.RuntimeException: Canvas: trying to draw too large(110327008bytes) bitmap.
at android.view.DisplayListCanvas.throwIfCannotDraw(DisplayListCanvas.java:260)
at android.graphics.Canvas.drawBitmap(Canvas.java:1415)
at android.graphics.drawable.BitmapDrawable.draw(BitmapDrawable.java:545)
at android.view.View.getDrawableRenderNode(View.java:17314)
at android.view.View.drawBackground(View.java:17250)
at android.view.View.draw(View.java:17062)
at android.view.View.updateDisplayListIfDirty(View.java:16053)
at android.view.View.draw(View.java:16837)
at android.view.ViewGroup.drawChild(ViewGroup.java:3764)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3550)
at android.view.View.updateDisplayListIfDirty(View.java:16048)
at android.view.View.draw(View.java:16837)
at android.view.ViewGroup.drawChild(ViewGroup.java:3764)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3550)
at android.view.View.updateDisplayListIfDirty(View.java:16048)
at android.view.View.draw(View.java:16837)
at android.view.ViewGroup.drawChild(ViewGroup.java:3764)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3550)
at android.view.View.updateDisplayListIfDirty(View.java:16048)
at android.view.View.draw(View.java:16837)
at android.view.ViewGroup.drawChild(ViewGroup.java:3764)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3550)
at android.view.View.updateDisplayListIfDirty(View.java:16048)
at android.view.View.draw(View.java:16837)
at android.view.ViewGroup.drawChild(ViewGroup.java:3764)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3550)
at android.view.View.draw(View.java:17074)
at com.android.internal.policy.DecorView.draw(DecorView.java:751)
at android.view.View.updateDisplayListIfDirty(View.java:16053)
at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:656)
at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:662)
at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:770)
at android.view.ViewRootImpl.draw(ViewRootImpl.java:2796)
at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2604)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2211)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1246)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6301)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:871)
at android.view.Choreographer.doCallbacks(Choreographer.java:683)
at android.view.Choreographer.doFrame(Choreographer.java:619)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:857)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
01-09 21:41:05.021 1519-4976/system_process E/EGL_emulation: tid 4976: eglSurfaceAttrib(1146): error 0x3009 (EGL_BAD_MATCH)
01-09 21:41:05.421 1994-2204/com.android.launcher3 E/EGL_emulation: tid 2204: eglSurfaceAttrib(1146): error 0x3009 (EGL_BAD_MATCH)
01-09 21:42:46.053 1519-1875/system_process E/JavaBinder: !!! FAILED BINDER TRANSACTION !!! (parcel size = 104)
01-09 21:42:46.059 1519-1875/system_process E/JavaBinder: !!! FAILED BINDER TRANSACTION !!! (parcel size = 108)
logcatからクラッシュログを投稿する –
@DrilonBlakqori Android開発に新しくなったので、logcatの使用方法を追跡する必要があります。 5分してください。 –
クラッシュログは元の回答にアップされました(更新済み) –