на самом деле я не знаю, почему возникает эта ошибка, поэтому я не могу повторить ошибку, но я создал новый проект с пустой активностью, но я столкнулся с этой ошибкой опять же... я делаю два действия и по намерению перемещаюсь между ними
Код: Выделить всё
Intent intent = new Intend(MainActivity.this, newActivity.class); startActivity(intent);
вот мой манифест
Код: Выделить всё
Код: Выделить всё
plugins {
id 'com.android.application'
}
android {
compileSdk 32
defaultConfig {
applicationId "com.example.tbgroup"
minSdk 28
targetSdk 32
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.7.0'
implementation 'com.google.android.material:material:1.12.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
}
Код: Выделить всё
package com.example.tbgroup;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Intent intent = new Intent(MainActivity.this, newActiivty.class);
startActivity(intent); //here is the error
}
}
Код: Выделить всё
package com.example.tbgroup;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
public class newActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.new_activity);
}
}
Подробнее здесь: https://stackoverflow.com/questions/786 ... atactivity