У меня проблема. Я создал новое занятие и пытаюсь связать его
к тому, что у меня был раньше. Я создал намерение, а приложение не дает
я ошибаюсь, но на телефоне я получаю это сообщение: Waiting for Debugger: force close, и я должен закрыть его.
Любой совет?
Я тоже попробовал это: Intent intent = new Intent(StartScreen.this, MainActivity.class);, но потом у меня возникла ошибка:
no suitable constructor found for Intent(<anonymous OnClickListener>,Class<MainActivity>) constructor Intent.Intent(String,Uri) is not applicable (argument mismatch; <anonymous OnClickListener> cannot be converted to String) constructor Intent.Intent(Context,Class<?>) is not applicable (argument mismatch; <anonymous OnClickListener> cannot be converted to Context)
Это код:
public class StartScreen extends AppCompatActivity {
public static final String TAG = "StartScreen";
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.start);
Log.d(TAG, "onClick: Starting.");
Button startBtn = (Button) findViewById(R.id.startBtn);
startBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Log.d(TAG, "onClick: clicked startBtn.");
Intent intent = new Intent(getApplicationContext(), MainActivity.class);
startActivity(intent);
}
});
}
}
Logcat 05-25 21:52:18.345 23261-23261/? E/Zygote: v2 05-25 21:52:18.345 23261-23261/? I/libpersona: KNOX_SDCARD checking this for 10265 KNOX_SDCARD not a persona 05-25 21:52:18.347 23261-23261/? E/Zygote: accessInfo : 0 05-25 21:52:18.347 23261-23261/? W/SELinux: SELinux selinux_android_compute_policy_index : Policy Index[2], Con:u:r:zygote:s0 RAM:SEPF_SECMOBILE_7.0_0009, [-1 -1 -1 -1 0 1] 05-25 21:52:18.350 23261-23261/? I/SELinux: SELinux: seapp_context_lookup: seinfo=untrusted, level=s0:c512,c768, pkgname=com.example.mariacristina.quizzz 05-25 21:52:18.356 23261-23261/? I/art: Late-enabling -Xcheck:jni 05-25 21:52:18.399 23261-23261/? D/TimaKeyStoreProvider: TimaKeyStore is not enabled: cannot add TimaSignature Service and generateKeyPair Service 05-25 21:52:18.659 23261-23261/com.example.mariacristina.quizzz W/System: ClassLoader referenced unknown path: /data/app/com.example.mariacristina.quizzz-1/lib/arm 05-25 21:52:18.698 23261-23261/com.example.mariacristina.quizzz I/InstantRun: starting instant run server: is main process 05-25 21:52:19.245 23261-23261/com.example.mariacristina.quizzz W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable 05-25 21:52:19.820 23261-23261/com.example.mariacristina.quizzz D/TextView: setTypeface with style : 0 05-25 21:52:19.823 23261-23261/com.example.mariacristina.quizzz D/TextView: setTypeface with style : 0 05-25 21:52:19.947 23261-23261/com.example.mariacristina.quizzz D/TextView: setTypeface with style : 0 05-25 21:52:19.949 23261-23261/com.example.mariacristina.quizzz D/TextView: setTypeface with style : 0 05-25 21:52:19.980 23261-23261/com.example.mariacristina.quizzz D/TextView: setTypeface with style : 0 05-25 21:52:20.027 23261-23261/com.example.mariacristina.quizzz D/Choreographer: init sf_choreo_doframe debug_Level : 0x4f4cdebug_game_running : false 05-25 21:52:20.157 23261-23261/com.example.mariacristina.quizzz D/ViewRootImpl@577b63b[MainActivity]: ThreadedRenderer.create() translucent=false 05-25 21:52:20.170 23261-23261/com.example.mariacristina.quizzz D/InputTransport: Input channel constructed: fd=71 05-25 21:52:20.173 23261-23261/com.example.mariacristina.quizzz D/ViewRootImpl@577b63b[MainActivity]: setView = DecorView@a20c158[MainActivity] touchMode=true 05-25 21:52:20.209 23261-23261/com.example.mariacristina.quizzz D/ViewRootImpl@577b63b[MainActivity]: dispatchAttachedToWindow 05-25 21:52:20.240 23261-23261/com.example.mariacristina.quizzz D/ViewRootImpl@577b63b[MainActivity]: Relayout returned: oldFrame=[0,0][0,0] newFrame=[0,0][720,1280] result=0x27 surface = {isValid=true -256112640} surfaceGenerationChanged=true 05-25 21:52:20.241 23261-23261/com.example.mariacristina.quizzz D/ViewRootImpl@577b63b[MainActivity]: mHardwareRenderer.initialize() mSurface = {isValid=true -256112640} hwInitialized=true 05-25 21:52:20.344 23261-23261/com.example.mariacristina.quizzz W/art: Before Android 4.1, method int android.support.v7.widget.DropDownListView.lookForSelectablePosition(int, boolean) would have incorrectly overridden the package-private method in android.widget.ListView 05-25 21:52:20.373 23261-23277/com.example.mariacristina.quizzz D/libEGL: loaded /vendor/lib/egl/libGLES_mali.so 05-25 21:52:20.450 23261-23277/com.example.mariacristina.quizzz I/OpenGLRenderer: Initialized EGL, version 1.4 05-25 21:52:20.450 23261-23277/com.example.mariacristina.quizzz D/OpenGLRenderer: Swap behavior 1 05-25 21:52:20.532 23261-23277/com.example.mariacristina.quizzz D/mali_winsys: EGLint new_window_surface(egl_winsys_display*, void*, EGLSurface, EGLConfig, egl_winsys_surface**, egl_color_buffer_format*, EGLBoolean) returns 0x3000, [720x1280]-format:1 05-25 21:52:21.320 23261-23261/com.example.mariacristina.quizzz D/ViewRootImpl@577b63b[MainActivity]: MSG_RESIZED_REPORT: frame=Rect(0, 0 - 720, 1280) ci=Rect(0, 48 - 0, 0) vi=Rect(0, 48 - 0, 0) or=1 05-25 21:52:21.321 23261-23261/com.example.mariacristina.quizzz I/Choreographer: Skipped 56 frames! The application may be doing too much work on its main thread.
удалите USB-кабель, затем попробуйте, вы пытаетесь подключить отладчик во время работы
@Deepakkaku Я уже пробовал, но это то же самое
@SuhaibRoomy Я сделал это, но мое приложение все еще вылетает
опубликуйте свой логарифм
@SuhaibRoomy я выкладываю
Вы делаете что-то на своей основной странице, что отнимает много времени, поэтому вы попадаете в состояние ANR. Я не думаю, что код, который вы разместили выше, является проблемой, это в какой-то другой части кода
@SuhaibRoomy Я нашел проблему. Спасибо за совет
Рад был помочь!!




может попробовать это. Намерение намерения = новое намерение (StartScreen.this, MainActivity.class);