Android.content.ActivityNotFoundException: Невозможно найти явный класс активности
Я получаю эту ошибку:
Но я объявил это в моем файле манифеста. Каковы могут быть другие причины такого исключения?
Вы объявили имя пакета в манифесте как com.Android.myApp и название действия. .Example андроид будет искать его из com.Android.myApp.Example . Но ваша деятельность находится в « com.Android.myApp/com.Android.myApp.Facebook.Example ». Дайте название деятельности как .Facebook.Example или полный путь, как указано ниже. В манифесте
Вы также можете использовать
У меня есть вариация этой проблемы. Я запускал операцию под названием «Настройки» и получал ту же ошибку, и все предлагаемые изменения в манифесте не устраняли проблему.
Дело в том, что в вызывающей активности я также использовал / импортировал android.provider.Settings, поэтому из того, что я могу видеть при попытке запуска этой активности, это путалось между ними. Таким образом, я изменил это в коде, а не на манифест, чтобы включить полный путь:
И это сработало. Конечно, другой, и лучший способ решить эту конкретную проблему – использовать лучшие имена для моей деятельности.
HTH кто-нибудь с этим вариантом проблемы.
Из вашего исключения, который является вашим классом – Facebook или Example Потому что вы объявили в пакете в манифесте как com.Android.myApp Но для деятельности facebook вы com.Android.myApp com.android.myApp.Facebook.Example И,
Если ваш пример означает ваше действие, вы должны объявить свою деятельность как com.Android.myApp.Facebook.Example Потому что это от другого пакета или вашего имени деятельности как Facebook.Example com.Android.myApp.Facebook.Example Итак, вы можете объявить свою деятельность, как com.Android.myApp.Facebook.Example ниже:
Просто убедитесь, что ваша активность украшена этим атрибутом:
Примечание. При необходимости установите только MainLauncher.
Это работает, если у вас есть объект Activity (который нужно запустить):
Источник
android.content.ActivityNotFoundException:
I am getting this exception while I am trying to call an activity from another one. The complete exception is
android.content.ActivityNotFoundException:Unable to find explicit activity class ;
I am doing an intent.setClass(«com.x.y»,»com.x.y.className») where className is the name of my activity class and com.x.y is the package it resides in.
My AndroidManifest.xml has the following content:
Am I missing anything?
Answers
Maybe you need to check that you added the new activity to the manifest.xml file
You declared package name in the manifest as com.Android.myApp and Activity Name .Example .So android will search it from com.Android.myApp.Example . But your activity is residing in » com.Android.myApp/com.Android.myApp.Facebook.Example «.So give the activity name as .Facebook.Example or full path as given below In the manifest
You have to differentiate the Intent’s Constructor,
Which assume com.android.main.HOMEPAGE as Intent’s action Filter. Which is not available in your application’s android manifest.xml file. You have
which should be,
OR just change it with,
I am seeing this crash too. It seems that LG has removed the newly introduced Usage Permission Setttings screen from their version of Lollipop.
The problem is that Html.fromHtml() creates URLSpan instances for embedded URLs, and this class «blindly» calls startActivity() with the supplied url. This crashes whenever the URL does not match with any registered activity.
The problem is well explained in this CommonsWare post. The solution/example there overrides onClick() and handles the ActivityNotFoundException to prevent the crash.
If what you want to do is to be more permissive about the link instead, you could override getURL() instead, for example as follows:
Источник
Android
FirstPrevNext
Re: Show a ProgressDialog inside a Fragment that is injected in a Tab
David Crow
2-Oct-17 4:09
i have a challenge in making this to work in a Fragment
«One man’s wage rise is another man’s price increase.» — Harold Wilson
«Fireproof doesn’t mean the fire will never come. It means when the fire comes that you will be able to withstand it.» — Michael Simmons
«You can easily judge the character of a man by how he treats those who can do nothing for him.» — James D. Miles
Sign In· View Thread
Re: Show a ProgressDialog inside a Fragment that is injected in a Tab
Vimalsoft(Pty) Ltd
2-Oct-17 8:11
Spoted in Daniweb— Sorry to rant. I hate websites. They are just wierd. They don’t behave like normal code.
Sign In· View Thread
Re: Show a ProgressDialog inside a Fragment that is injected in a Tab
David Crow
2-Oct-17 8:14
«One man’s wage rise is another man’s price increase.» — Harold Wilson
«Fireproof doesn’t mean the fire will never come. It means when the fire comes that you will be able to withstand it.» — Michael Simmons
«You can easily judge the character of a man by how he treats those who can do nothing for him.» — James D. Miles
Sign In· View Thread
Re: Show a ProgressDialog inside a Fragment that is injected in a Tab
Vimalsoft(Pty) Ltd
2-Oct-17 8:25
There is no Exception , the Context is the Application Context (Context.Android.Support.V4.App.Fragment.Context) , i also tried to declare the context at a fragment level and initialize it on OnCreateView (Android.Content.Context) but still it does not show the dialog.
Please note this dialog shows nicely in an Activity not a Fragment.
Spoted in Daniweb— Sorry to rant. I hate websites. They are just wierd. They don’t behave like normal code.
Sign In· View Thread
Re: Show a ProgressDialog inside a Fragment that is injected in a Tab
David Crow
2-Oct-17 8:30
There is no Exception.
You know this, even without a try/catch block?
, the Context is the Application Context (Context.Android.Support.V4.App.Fragment.Context) , i also tried to declare the context at a fragment level and initialize it on OnCreateView (Android.Content.Context) but still it does not show the dialog.
Have you tried using getActivity() when constructing the ProgressDialog ?
Please note this dialog shows nicely in an Activity not a Fragment.
«One man’s wage rise is another man’s price increase.» — Harold Wilson
«Fireproof doesn’t mean the fire will never come. It means when the fire comes that you will be able to withstand it.» — Michael Simmons
«You can easily judge the character of a man by how he treats those who can do nothing for him.» — James D. Miles
Sign In· View Thread
Re: Show a ProgressDialog inside a Fragment that is injected in a Tab
Vimalsoft(Pty) Ltd
2-Oct-17 8:37
Have you tried using getActivity() when constructing the ProgressDialog?
let me try that and i will get back to you.
Spoted in Daniweb— Sorry to rant. I hate websites. They are just wierd. They don’t behave like normal code.
Sign In· View Thread
Timing and fragment creation
David Crow
29-Sep-17 8:44
I created a small app based on a «Tabbed Activity.» It has two tabs. The content of both tabs will be a ListView filled from the Contacts database. Because of the new Permissions requirements that came out with Android 6, I need permission from the user at runtime to access that datastore. As such, I am calling checkSelfPermission() and requestPermissions() as prescribed in the docs.
If I put those calls in the activity, I get one request dialog asking for permission, and because requestPermissions() runs synchronously in a separate thread, the two fragments are allowed to finish their creation in the main thread. Once permission is granted, the activity sends both fragments a message indicating they can now populate their ListView s. This works fine, until I restart the app. Since permission has now been granted, requestPermissions() does not run, and the message that the activity sends to the fragments gets there before the fragments have been fully created. Just to see what would happen, I preceded the message with a 1-second sleep and that gave the fragments enough time to finish their creation. This works fine for both a first-time and restarted app. I did not like this approach because of the delay, so I kept looking.
If I put those calls in each fragment, I get two requests asking for permission. I can grant permission to neither, one or the other, or both, and the fragments will respond accordingly. The obvious problem is the two request dialogs. I could not find the proper way of having one fragment communicate to the other that it has already sought permission and that a second request is not necessary.
Another thing I tried was to put a call to checkSelfPermission() in each fragment’s onActivityCreated() method to continuously poll the desired permission. The call to requestPermission() was still done once in the activity. Once the permission was granted, each fragment would then go about populating its ListView . This worked, but it still felt wrong given the pausing and polling each fragment was having to do.
I feel my first approach is the proper way to go, but cannot find a suitable solution to the timing issue. I found out a long time ago when doing Windows development that inserting code to slow down or speed up your program’s execution is a major recipe for disaster. Better to signal events instead. So far I’m unable to find a comparable solution in either Java or Android.
Any helpful suggestions?
«One man’s wage rise is another man’s price increase.» — Harold Wilson
«Fireproof doesn’t mean the fire will never come. It means when the fire comes that you will be able to withstand it.» — Michael Simmons
«You can easily judge the character of a man by how he treats those who can do nothing for him.» — James D. Miles
Sign In· View Thread
Android.Content.ActivityNotFoundException: Unable to find explicit activity class
Vimalsoft(Pty) Ltd
28-Sep-17 7:43
Good Day Everyone
From my AppCompatActivity class i am trying to open an activity as an intent like this
and my package name in the manifest is package=»com.vimalsoft.toletsa» . My assembly name is Toletsa and my namespace is Toletsa
The layout file for my Activity that i want to open as an intent is
when i run the project i get an error when starting the activity
Unhandled Exception: Android.Content.ActivityNotFoundException: Unable to find explicit activity class ; have you declared this activity in your AndroidManifest.xml?
Spoted in Daniweb— Sorry to rant. I hate websites. They are just wierd. They don’t behave like normal code.
Sign In· View Thread
Re: Android.Content.ActivityNotFoundException: Unable to find explicit activity class
Richard MacCutchan
28-Sep-17 10:44
Sign In· View Thread
Re: Android.Content.ActivityNotFoundException: Unable to find explicit activity class
Vimalsoft(Pty) Ltd
28-Sep-17 23:44
i was able to resolve the issue i just changed this
in my Manifest to
and this solved my problem , the code was ok
Spoted in Daniweb— Sorry to rant. I hate websites. They are just wierd. They don’t behave like normal code.
Sign In· View Thread
How are chat application in Android used?
Salfishya Mary
28-Sep-17 4:58
technology stack for Android chat application. Anyone explain it clearly.
Sign In· View Thread
Re: How are chat application in Android used?
Richard MacCutchan
28-Sep-17 6:20
Type «Android chat» into Google and you will find all the information you need.
Sign In· View Thread
Re: How are chat application in Android used?
Sienna Amelia
3-Oct-17 3:07
Before to start building a chat app you need to focus on both Client and Server separately. Technology stack behind the Android chat application are
Server : Ejabberd Language : Erlang Protocol : XMPP Database management : Mnesia & Mysql Multimedia files storage : YAWS Operating system : FreeBSD
Sign In· View Thread
SQL server connection in Android
Malashree Halade
19-Sep-17 21:26
I have to connect sql srver from my laptop in android application, what i do.
java.sql.SQLException: Unknown server host name ‘Unable to resolve host’
getting above problem.
Tell me steps, hoe to connect to sql server.
Sign In· View Thread
Re: SQL server connection in Android
Richard MacCutchan
19-Sep-17 23:11
The error message is quite clear, your host name either does not exist or cannot be reached from the client system.
Sign In· View Thread
Re: SQL server connection in Android
Vimalsoft(Pty) Ltd
25-Sep-17 5:12
Spoted in Daniweb— Sorry to rant. I hate websites. They are just wierd. They don’t behave like normal code.
Sign In· View Thread
Access MySql using php script from Android app..
Member 13416547
18-Sep-17 17:03
Hello,
I have a super simple php script that runs successfully when I paste the url into a browser (windows, chrome).
My php code has values hardcoded in it and these values are successfully inserted into mySql database (running on a WAMP). At this point EVERYTHING is hardcoded in the php. I appreciate any help, I think I am missing something fundamental (new to android development).
Problem: I can not access/run this same script from my andoroid app. Do I need to run it async? I simply have the below code in a function that is run when the button is clicked on the phone (using an emulator so phone displays app while I am in debug mode in Android.)
Clues: It bombs out on the last line. Strangely debug (IOException) value is blank. Manifest has:
Re: Access MySql using php script from Android app..
David Crow
19-Sep-17 10:47
Strangely debug (IOException) value is blank.
«One man’s wage rise is another man’s price increase.» — Harold Wilson
«Fireproof doesn’t mean the fire will never come. It means when the fire comes that you will be able to withstand it.» — Michael Simmons
«You can easily judge the character of a man by how he treats those who can do nothing for him.» — James D. Miles
Sign In· View Thread
Re: Access MySql using php script from Android app..
Member 13416547
20-Sep-17 17:03
Sign In· View Thread
Re: Access MySql using php script from Android app..
Member 13416547
20-Sep-17 20:24
I just saw this video which indicated I need to use an AsyncTask. if that is required then that is my issue I think. How to Connect Android with PHP, MySQL — Best Android Studio Tutorial 2017 — YouTube[^]
Sign In· View Thread
Re: Access MySql using php script from Android app..
David Crow
20-Sep-17 17:52
(I reworked code and it doen’t go to CATCH now.)
Because you are trying to catch a specific exception. Try using Exception instead. Have you considered the exception’s getMessage() method?
Also, I suggest using Log.d() calls instead of popping up Toast messages when debugging.
«One man’s wage rise is another man’s price increase.» — Harold Wilson
«Fireproof doesn’t mean the fire will never come. It means when the fire comes that you will be able to withstand it.» — Michael Simmons
«You can easily judge the character of a man by how he treats those who can do nothing for him.» — James D. Miles
Sign In· View Thread
Re: Access MySql using php script from Android app..
Member 13416547
23-Sep-17 16:03
Thanks David, I will look at using Exception & getMessage as well as log.d (I am new to android dev as you can probably tell.)
Sign In· View Thread
FCM notification
Malashree Halade
9-Sep-17 4:26
if any one know then tell me. when application is in background, then how to read notification?
Sign In· View Thread
Re: FCM notification
David Crow
9-Sep-17 5:55
«One man’s wage rise is another man’s price increase.» — Harold Wilson
«Fireproof doesn’t mean the fire will never come. It means when the fire comes that you will be able to withstand it.» — Michael Simmons
«You can easily judge the character of a man by how he treats those who can do nothing for him.» — James D. Miles
Sign In· View Thread
Re: FCM notification
Malashree Halade
9-Sep-17 6:38
Thanks for reply. But actually I want to update one value in sqlite after getting a notification. I had done code with this in message received method but problem is that, when app is in background, then I will get notification but can’t update value in sqlite. So tell me any solution.
Sign In· View Thread
Last Visit: 31-Dec-99 19:00 Last Update: 4-Dec-21 12:59
Refresh
ᐊ Prev1 . 18192021 22 2324252627 Next ᐅ
General News Suggestion Question Bug Answer Joke Praise Rant Admin
Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.