如何解决“没有找到处理意图的活动”错误? [英] How to solve 'no activity found to handle intent' error?
本文介绍了如何解决“没有找到处理意图的活动”错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我收到此错误:
I got this error :
android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.settings.APPLICATION_DETAILS_SETTINGS dat=Package:com.example.mjk.thefirst }
我用Kotlin写了这个,我试图在其他网站上做这个建议,但它没有用。 ..
I wrote this with Kotlin a I tried to do that suggestion in other websites,but It didn't work...
package com.example.mjk.thefirst
import android.content.Intent
import android.net.Uri
import android.support.v7.app.AppCompatActivity
import android.os.Bundle
import android.provider.ContactsContract
import android.provider.Settings
import kotlinx.android.synthetic.main.activity_intent.*
class IntentActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_intent)
saveButton.setOnClickListener{
addContact(name.text.toString(),phoneNumber.text.toString())
}
sendButton.setOnClickListener{
sendMessage(msgEditText.text.toString())
}
setButton.setOnClickListener{
openAppSetting()
}
callButton.setOnClickListener{
phoneCall(phoneNumber.text.toString())
}
}
/* private fun openSetting(){
val intent = Intent(Settings.ACTION_WIFI_SETTINGS)
startActivity(intent)
}*/
private fun phoneCall( PhoneNumber : String ){
val i = Intent(Intent.ACTION_DIAL)
i.data = Uri.parse("tel : $PhoneNumber")
startActivity(i)
}
private fun addContact(Name : String,Number:String){
val intent = Intent(Intent.ACTION_INSERT)
intent.type = ContactsContract.Contacts.CONTENT_TYPE
intent.putExtra(ContactsContract.Intents.Insert.NAME , Name)
intent.putExtra(ContactsContract.Intents.Insert.PHONE , Number)
startActivity(intent)
}
private fun sendMessage(Message : String){
val intent = Intent(Intent.ACTION_SEND)
intent.type = "text/plain"
intent.putExtra(Intent.EXTRA_TEXT,Message)
startActivity(intent)
}
private fun openAppSetting(){
val intent = Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS)
intent.data = Uri.fromParts("Package",packageName,null)
startActivity(intent)
}
}
此处显示:
And here is manifest :
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.mjk.thefirst">
<application
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".IntentActivity" android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="com.scytec.datamobile.vd.gui.android.AppPreferenceActivity" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
</manifest>
请帮助...
我尝试了什么:
我试过将此解析为清单文件:
Please Help...
What I have tried:
I tried to solve this to manifest file:
<intent-filter>
<action android:name="com.scytec.datamobile.vd.gui.android.AppPreferenceActivity" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
但是我没有工作
but I didn't work
推荐答案
PhoneNumber)
startActivity(i)
}
private fun addContact(Name:String,Number:字符串){
val intent = Intent(Intent.ACTION_INSERT)
intent.type = ContactsContract.Contacts.CONTENT_TYPE
intent.putExtra(ContactsContract.Intents.Insert.NAME,Name )
intent.putExtra(ContactsContract.Intents.Insert.PHONE,Number)
startActivity(intent)
}
私人乐趣sendMessage(Message:String){
val intent = Intent(Intent.ACTION_SEND)
intent.type =text / plain
intent.putExtra(Intent.EXTRA_TEXT,Message )
startActivity(意图)
}
私人乐趣openAppSetting(){
val intent =意图(设置) .ACTION_APPLICATION_DETAILS_SETTINGS)
intent.data = Uri.fromParts(Package,packageName,null)
startActivity(intent)
}
}
PhoneNumber") startActivity(i) } private fun addContact(Name : String,Number:String){ val intent = Intent(Intent.ACTION_INSERT) intent.type = ContactsContract.Contacts.CONTENT_TYPE intent.putExtra(ContactsContract.Intents.Insert.NAME , Name) intent.putExtra(ContactsContract.Intents.Insert.PHONE , Number) startActivity(intent) } private fun sendMessage(Message : String){ val intent = Intent(Intent.ACTION_SEND) intent.type = "text/plain" intent.putExtra(Intent.EXTRA_TEXT,Message) startActivity(intent) } private fun openAppSetting(){ val intent = Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS) intent.data = Uri.fromParts("Package",packageName,null) startActivity(intent) } }
这里有清单:
And here is manifest :
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.mjk.thefirst">
<application
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".IntentActivity" android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="com.scytec.datamobile.vd.gui.android.AppPreferenceActivity" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
</manifest>
请帮助...
我尝试了什么:
我试过将此解析为清单文件:
Please Help...
What I have tried:
I tried to solve this to manifest file:
<intent-filter>
<action android:name="com.scytec.datamobile.vd.gui.android.AppPreferenceActivity" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
但是我没有工作
but I didn't work
这篇关于如何解决“没有找到处理意图的活动”错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文