Click here to Skip to main content
15,891,841 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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 }


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
Posted
Updated 13-Sep-18 9:46am

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900