gpt4 book ai didi

android - 明确的 Intent 错误

转载 作者:行者123 更新时间:2023-11-29 14:04:49 24 4
gpt4 key购买 nike

我想在单击图像时进行新 Activity 。我已经在 list 文件中编写了 activity android:name=.openPdf

但它显示了一个错误:-

"android.content.ActivityNotFoundException: Unable to find explicit activity class {Parsing.this/openPdf.class}; have you declared this activity in your AndroidManifest.xml?
"

代码::

iv1.setOnClickListener(new View.OnClickListener() 
{
public void onClick(View v)
{
// Toast.makeText(getApplicationContext(), "hello",Toast.LENGTH_SHORT).show();

Intent pdf=new Intent(Parsing.this,openPdf.class);
startActivity(pdf);

}

});

最佳答案

请确保您正在启动的 Activity 在同一个包中,然后您可以像 android:name=.openPdf 那样编写,否则需要使用包的完整类名。

关于android - 明确的 Intent 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7685515/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com