- android.app.Application cannot be cast to org.kodein.di.KodeinAware #288
- Comments
- forntoh commented Feb 17, 2020
- romainbsl commented Feb 17, 2020 •
- forntoh commented Feb 17, 2020
- romainbsl commented Feb 17, 2020
- forntoh commented Feb 18, 2020
- romainbsl commented Feb 18, 2020
- forntoh commented Feb 18, 2020
- Question ⬇️
- Error cannot be cast to android.app.Activity
- ClassCastException: MainActivity cannot be cast to android.view.View$OnClickListener
- android.app.Application cannot be cast to android.app.Activity
- Další témata . (Topics)
- Change Screen Orientation Programmatically Android | change-screen-orientation-programmatically-android
- Draw Path drawPath draw the trajectory of shot Android basic example | draw-path-drawpath-android-basic-example
- Get package name Context-getPackageName Android example | get-package-name-context-getpackagename-android-example
- tag should specify a target API level Warning | uses-sdk-tag-should-specify-target-api
- 6. Fragments Tutorial Summary – Czech language | 6-fragments-tutorial-summary-czech-language
android.app.Application cannot be cast to org.kodein.di.KodeinAware #288
Comments
forntoh commented Feb 17, 2020
I get the following error when the app starts, I’ve tried to trace it but to no avail
The text was updated successfully, but these errors were encountered:
romainbsl commented Feb 17, 2020 •
My guess would be that when you are using the function closestKodein() , Kodein-DI finds the applicationContext from the android.app.Application , but for some reason, this context cannot be cast to KodeinAware .
Is your Application extending android.app.Application somehow?
If not you should consider it, and then declare your bindings in it.
forntoh commented Feb 17, 2020
My guess would be that when you are using the function closestKodein() , Kodein-DI finds the applicationContext from the android.app.Application , but for some reason, this context cannot be cast to KodeinAware .
Is your Application extending android.app.Application somehow?
If not you should consider it, and then declare your bindings in it.
My application extends MultiDexApplication and implements Kodeinaware
MultidexApplication inturn extends android.app.Application
romainbsl commented Feb 17, 2020
Maybe you could try to force the App class to be use as the application context.
override val kodein by lazy
forntoh commented Feb 18, 2020
Maybe you could try to force the App class to be used as the application context.
override val kodein by lazy
I tried that too, but still not working 😞 .
romainbsl commented Feb 18, 2020
Do you have a reproducible case / repo that I could try ?
forntoh commented Feb 18, 2020
Maybe you could try to force the App class to be used as the application context.
override val kodein by lazy
Oh. What I tried was override val kodein by lazy < (applicationContext as KodeinAware).kodein >
But (applicationContext as App).kodein , works 😊
Question ⬇️
Please can you tell me why forcing it works now, because since the debut of the project I have used closestKodein() and it worked, untill now.
Источник
Error cannot be cast to android.app.Activity
I’m trying to change the code to use a sliding menu but i’m having problems
This is the error
12-16 13:09:56.272: E/AndroidRuntime(1176): Caused by: java.lang.ClassCastException: com.ebspma.activity.ReservasSalasFragment cannot be cast to android.app.Activity
I have already changed to getActivity() only and i’m still hving this error
Any help please?
Thank you for your help
This is the logcat
Their is class cast exception you are casting Fragment to activity.
I am not able to figure out which line it is but you can do go on Logcat and click on this line.
Caused by: java.lang.ClassCastException: com.ebspma.activity.ReservasSalasFragment cannot be cast to android.app.Activity
this will take you to exact line where is error then post that line then we can figure out.
Reply if you not found your solution
Источник
ClassCastException: MainActivity cannot be cast to android.view.View$OnClickListener
Ошибка: Caused by Android java.lang.ClassCastException: android.app.Application cannot be cast
Здравствуйте. Очень нужен ваш совет. При запуске приложения появляется ошибка: Caused by.
Не отлавливается View.OnClickListener
Написал следующий код, список появляется с элементами все работает. а вот на карточку внутри.
BaseActivity with drawer + MainActivity + google tabs with view pager = NullPointerException
Здравствуйте! Такая проблема, у меня есть приложение, в котором drawer должен быть во всех.
В чем разница (View view) и (View v)
Я только начинаю изучать программирование под андроид (до этого вобще программированием не.
так трудно понять
есть варианты
сделать полный ресет программы
или переустановить
или в импорт добавить
import android.view.View;
Как сделать невидимым один из view в предыдущем item of recycler view
Здравствуйте ! Как сделать чтобы при клике на кнопку в элементе рисайклеравью в предыдущем.
OnClickListener не может вызвать метод с MainActivity
В MainActivity в onClickListener я могу вызвать метод selectCardFromList: public class.
По нажатию кнопки на View Controllere открыть Table View Controller
Как по нажатию кнопки на View Controllere открыть Table View Controller
Вместо navigation bar с table view хочу сделать просто view controller
добрый вечер. В xcode есть стандартный темплейт с navigation controller, но там по дефолту.
Как во view добавить вычисляемую колонку с порядковым номером записи во view?
Как во view добавить вычисляемую колонку с порядковым номером записи во view?
Как передать параметры из одного View в EditorFor другого View
Здравствуйте. Есть 2 view, первое просто отображает данные, 2 должно их редактировать, в 1 view.
Источник
android.app.Application cannot be cast to android.app.Activity
397LW NO topic_id
Další témata . (Topics)
Change Screen Orientation Programmatically Android | change-screen-orientation-programmatically-android
Draw Path drawPath draw the trajectory of shot Android basic example | draw-path-drawpath-android-basic-example
Get package name Context-getPackageName Android example | get-package-name-context-getpackagename-android-example
tag should specify a target API level Warning | uses-sdk-tag-should-specify-target-api
Warning in AndroidManifest.xml:
tag should specify a target API level (the highest verified version; when running on
later versions, compatibility behaviors may be enabled) with android:targetSdkVersion=»?»
Solution:
6. Fragments Tutorial Summary – Czech language | 6-fragments-tutorial-summary-czech-language
6. Fragments Tutorial Summary – Czech language
— FrameLayout: můžeme měnit obsah kontejneru
— fragment s plnou cestou: nelze měnit obsah za jiný fragment
— pozor na šírku kontejnerů:
Složku layout-large lze přejmenovat na swXXXdp např. sw600dp a pak si zařízení bere automaticky resource z této složky, pokud nejmenší rozměr obrazovky je roven, či větší 600dp.
To lze využít k oklamání zařízení při testování. Pokud máte jen malý telefon a chcete na něm zkoušet dva panely, tak složku přejmenujte, po dobu testování, např. na sw300dp a pak i malé zařízení zobrazí oba panely. Po ukončení testování je třeba zase složku přejmenovat na původní nejmenší přípustnou šířku zařízení (w600dp), nebo nejmenší rozměr jedné ze stran obrazovky (sw600dp).
Pozor na implementaci správné třídy, pokud si vytvoříte novou třídu se seznamem položek,
je třeba přejemnova HeadlinesFragment na NovyNazevTridyKdeMateListView
implements HeadlinesFragment.OnHeadlineSelectedListener
na
implements NovyNazevTridyKdeMateListView.OnHeadlineSelectedListener
Fragment používa onCreateView() místo onCreate()
Ipsum je veřejná třída, která obsahuje
dvě pole řetězců — stringů.
Pole Headlines slouží jako uložiště pro názvy, které
budou načteny do ListView — seznamu v HeadlinesFragment.java
Pole Articles je v našem případě zásobárnou článků, které
budou načteny dle pozice položky ListView předané z HeadlinesFragment
zoětbě do MainActivity a
odtud do ArticleFragment.java, jako parametr metody
articleFrag.updateArticleView(position);
nebo jako argument Bundle
Bundle args = new Bundle();
args.putInt(ArticleFragment.ARG_POSITION, position);
Stringy — ukládat do souboru java je ošemetné (problémy s kódováním, vyhledávání výrazů atd.)
U většího množství článků pak nepřehledné.
Navíc, uživatel nemůže tento text editovat.
K ukládaní většího množství dat, k jejich vyhledávání
a editaci je lépe používat databáze.
Editace: 2015-11-28 18:55:09
Počet článků v kategorii: 397
Url:android-app-application-cannot-be-cast-to-android-app-activity
Источник