【问题标题】:Migrate to AndroidX :: android.content.ActivityNotFoundException: [duplicate]迁移到 AndroidX :: android.content.ActivityNotFoundException: [重复]
【发布时间】:2019-06-11 09:34:45
【问题描述】:
    //calling Activity written in kotlin but activity is 
    //not started and giving below-mentioned exception

异常:android.content.ActivityNotFoundException: 找不到明确的活动类 com.myApp.personal/com.myApp.personal.camera.CameraActivityKt 您是否在 AndroidManifest.xml 中声明了此活动?

    //while Registered in manifest file: 
   <activity 
   android:name=
   ".camera.CameraActivity"android:screenOrientation="fullSensor"/>



    try{ 
       File f = setUpPhotoFile(prefixString); mCurrentPhotoPath =
       f.getAbsolutePath();
       Intent intent = new Intent(this, CameraActivityKt.class);
       intent.putExtra(IConstant.PATH, mCurrentPhotoPath);    
       startActivityForResult(intent, actionCode); 
    } 
    catch(Exception ex) {
       e.printStackTrace(); 
    }

【问题讨论】:

  • 可以添加清单吗?您是否在清单中添加了此活动?
  • @VedprakashWagh 不工作已经尝试过您添加的链接
  • 清单活动是CameraActivity。关于CameraActivityKt的例外情况@

标签: android kotlin android-manifest android-fragmentactivity androidx


【解决方案1】:

我得到了解决方案 Kotlin 活动将像这样从 java 类中调用:

  Intent intent = new Intent(this, CameraActivity.class);
  intent.putExtra(IConstant.PATH, mCurrentPhotoPath);
 ((Activity) mContext).startActivityForResult(intent, actionCode);

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-02-03
    • 1970-01-01
    • 1970-01-01
    • 2019-06-27
    • 2020-01-27
    • 2019-11-05
    相关资源
    最近更新 更多