我正在为 Android 创建一个动态壁纸应用程序。我已经编写了一些代码,但出现以下错误原因是: android.content.ActivityNotFoundException: 找不到处理意图的活动 { act=android.service.wallpaper.CHANGE_LIVE_WALLPAPER (has extras) }
请帮忙
MyPoint.java
public class MyPoint {
public String text;
public float x;
public float y;
public MyPoint(String text, float x, float y) {
this.text = text;
this.x = x;
this.y = y;
}
}
Run Code Online (Sandbox Code Playgroud)
MyPreferencesActivity.java
public class MyPreferencesActivity extends PreferenceActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.prefs);
Preference circlePreference = getPreferenceScreen().findPreference(
"numberOfCircles");
circlePreference.setOnPreferenceChangeListener(numberCheckListener);
}
Preference.OnPreferenceChangeListener numberCheckListener = new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用以下代码启动地图。
public static void navigate(Context context, double lat, double lon) {
String locationQuery = lat + "," + lon;
Uri gmmIntentUri = Uri.parse("google.navigation:q=" + locationQuery);
Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri);
mapIntent.setPackage("com.google.android.apps.maps");
context.startActivity(mapIntent);
}
Run Code Online (Sandbox Code Playgroud)
但是在某些情况下,我没有发现任何处理意图崩溃的活动。我在这里做错了。
我有这个小方法:
private fun showWebsiteWithUrl(url: String) {
val i = Intent(Intent.ACTION_VIEW)
i.data = Uri.parse(url)
startActivity(i)
}
Run Code Online (Sandbox Code Playgroud)
我在 google play 中看到有时这种方法会抛出android.content.ActivityNotFoundException异常。
该url参数是一个有效的 url,如下所示:http : //www.stackoverflow.com/
这是堆栈跟踪的开始:
由 android.content.ActivityNotFoundException 引起:No Activity found to handle Intent { act=android.intent.action.VIEW dat= http://www.stackoverflow.com/ ... }
我无法在我的手机上重现该问题,用户在华为 Y5 (DRA-L21) Android 8 上遇到此错误,有时在使用 android 9 的小米设备上也会遇到此错误。
我添加了对新模块的引用,并尝试从中打开一个Activity.它throws的Exception,上面写着:
__PRE__
我是否需要在引用新模块旁边添加任何其他内容?
android module android-manifest android-activity activitynotfoundexception
我有一个正在生产的应用程序,一些用户收到关于 VIEW https 意图的奇怪 ActivityNotFoundException。我无法在我的物理设备或模拟器上本地重现它。我还假设每个 Android 都有一个默认打开 URL 的浏览器,我错了吗?(遇到该错误的设备都没有被root)。问题可能是因为手机没有 chrome 吗?
我使用 CustomTabsIntent 打开 URL:
public static void openUrl(final Uri url, final Activity activity) {
CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder();
builder.setToolbarColor(ContextCompat.getColor(activity, R.color.denis_red));
builder.setCloseButtonIcon(
BitmapFactory.decodeResource(activity.getResources(),
R.drawable.ic_arrow_back_white_24dp));
builder.setStartAnimations(activity, R.anim.activity_slide_in_right,
R.anim.activity_slide_out_left);
builder.setExitAnimations(activity, R.anim.activity_slide_in_left,
R.anim.activity_slide_out_right);
builder.build().launchUrl(activity, url);
}
Run Code Online (Sandbox Code Playgroud)
如果有帮助的话,我会添加一些堆栈跟踪。谢谢!
1:
android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=https://redirect.denis.de/... (has extras) }
at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:2031)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1686)
at android.app.Activity.startActivityForResult(Activity.java:4506)
at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:767)
at android.app.Activity.startActivity(Activity.java:4825)
at android.support.v4.content.ContextCompat.startActivity(ContextCompat.java:248)
at android.support.customtabs.CustomTabsIntent.launchUrl(CustomTabsIntent.java:263)
at de.boxine.denisapp.util.web.ChromeTabUtil.openUrl(ChromeTabUtil.java:26)
at de.boxine.denisapp.denis.list.DenisListActivity.onOptionsItemSelected(DenisListActivity.java:82)
at android.app.Activity.onMenuItemSelected(Activity.java:3469)
at …Run Code Online (Sandbox Code Playgroud) https android android-intent activitynotfoundexception chrome-custom-tabs
对不起,我是Android应用程序的新手.创建.我已经提到了几乎所有的解决方案,但这不起作用......我在下面的简单代码中没有看到任何问题.我的应用很简单,加载启动画面,然后加载webview.下面是什么问题?
android.content.ActivityNotFoundException: Unable to find explicit activity class {com.wwes.EZEE/com.wwes.EZEE.SecondPage}; have you declared this activity in your Manifext.xml
Run Code Online (Sandbox Code Playgroud)
[评论]请.看下面,我已经宣布了.怎么了?
MainActivity.java:在这里我加载了splashscreen图像.
package com.example.EZEE;
import com.wwes.EZEE.SecondPage;
public class MainActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//Thread for displaying the Splash Screen //
Thread splash_screen = new Thread() {
public void run() {
try {
sleep(1000);
} catch (Exception e){
e.printStackTrace();
} finally {
Intent i = new Intent(MainActivity.this, SecondPage.class);
startActivity(i);
}
}
}; splash_screen.start();
}
@Override …Run Code Online (Sandbox Code Playgroud)我正在使用 Android 并在创建服务并从主活动线程运行它时遇到以下错误。我确实浏览了与此错误相关的所有线程,但他们看到的错误主要是针对 Activity 任务。以下是错误和代码的详细信息
android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.serviceexample/com.example.serviceexample.MyServiceBg}; have you declared this activity in your AndroidManifest.xml?
Run Code Online (Sandbox Code Playgroud)
我确实检查了我的 AndriodManifest.xml,我确实看到了声明的服务
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.serviceexample">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="ServiceExample"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<service
android:name=".MyIntentService"
android:exported="false"></service>
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service android:name=".MyBgService"/>
</application>
</manifest>
Run Code Online (Sandbox Code Playgroud)
主活动.java:
package com.example.serviceexample;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) { …Run Code Online (Sandbox Code Playgroud)