腾讯云
开发者社区
文档
建议反馈
控制台
登录/注册
首页
学习
活动
专区
圈层
工具
MCP广场
文章/答案/技术大牛
搜索
搜索
关闭
发布
文章
问答
(9999+)
视频
沙龙
1
回答
findViewById
()不
能为
空
android
、
xml
、
android-studio
、
kotlin
、
nullpointerexception
在onCreate()方法中,我使用
findViewById
(R.id...)初始化了这些变量 当我运行代码时,应用程序崩溃了,logcat向我展示了一个NullPointerException,它说
findViewById
(R.id.drawerLayout)不能是
空
。= null,这帮助我避免了
findViewById
行中的
findViewById
,但在我的代码的另一部分中给了我另一个层次的麻烦,我必须使用drawerLayout?.我向一个询问了我在单击侦听器中遇到的错误,一般的共识是不要使用这种方
浏览 10
提问于2021-08-16
得票数 0
1
回答
findViewById
不
能为
空
android
、
kotlin
我所做的是,我已经为购物车图标和图像创建了一个布局,然后我将其放大到菜单选项,使其看起来像一个购物车
findViewById
(R.id.cartIcon)不
能为
null
浏览 13
提问于2019-11-04
得票数 0
3
回答
Android Kotlin
findViewById
不
能为
空
android
、
kotlin
、
android-alertdialog
java.lang.IllegalStateException:
findViewById
(R.id.btnYES)下面发布的错误不
能为
空
btnDIALOG =
findViewById
(R.id.btnDIALOG) etStudentName =
findViewByI
浏览 0
提问于2018-08-15
得票数 15
回答已采纳
3
回答
kotlin android出现"
findViewById
不
能为
空
“错误
android
、
xml
、
android-studio
、
kotlin
、
spinner
在本活动中,我在kotlin和
findViewById
中为xml文件中的三个微调器视图获取了三个变量。ComponentInfo{com.sahil.randoms/com.sahil.randoms.activity_name_gender}: java.lang.IllegalStateException:
findViewById
super.onCreate(savedInstanceState) spnGender=
浏览 223
提问于2020-10-16
得票数 0
回答已采纳
1
回答
TextView不能正常工作
java
、
android
、
xml
、
textview
android:attr/textAppearanceLarge" /> 下面是MainActivity: TextView myText = (TextView)
findViewById
浏览 0
提问于2014-04-01
得票数 0
1
回答
不能从FragmentActivity调用意图
android
、
button
、
android-intent
、
android-activity
savedInstanceState); Button loginBtn = (Button)
findViewById
浏览 1
提问于2014-01-21
得票数 0
回答已采纳
2
回答
创建自定义吐司时,
findViewById
()不
能为
空
android
、
kotlin
可以显示自定义的吐司 val inflater = layoutInflater val text: TextView = layout.
findViewById
setContentView(R.layout.activity_main)下面的主活动上调用这个函
浏览 2
提问于2020-03-26
得票数 0
回答已采纳
1
回答
Android:开关情况下的致命异常
android
、
fatal-error
、
switch-statement
super.onCreate(savedInstanceState); Button signin = (Button)
findViewById
(R.id.regmalebtn); //(R.id.regetfirstname); EditText etxt_pass = (EditText)
浏览 0
提问于2011-06-21
得票数 0
回答已采纳
2
回答
Android Kotlin
findViewById
(R.id.txt_email)不
能为
空
android
、
kotlin
super.onCreate(savedInstanceState) edtEmail=
findViewById
(R.id.edt_email) edtPassword=
findViewById
(R.id
浏览 12
提问于2021-12-16
得票数 1
2
回答
findViewById
(R.id.deleteButton)在kotlin中不
能为
空
xml
、
kotlin
、
button
、
android-recyclerview
、
view
但是,每当我尝试实现该按钮时,我都会得到错误"
findViewById
(R.id.deleteButton)不
能为
null“。super.onCreate(savedInstanceState)
findViewById
recyclerLinear.adapter = AdapterLinear(Flashcard.getHardcodedFlashcards()) val de
浏览 7
提问于2022-02-08
得票数 0
1
回答
android.support.design.widget.FloatingActionButton : kotlin.TypeCastException:不能将空转换为非
空
类型
android
、
kotlin
它给我的错误是'kotlin.TypeCastException: null不能在我的logcat中转换为非
空
类型的kotlin.TypeCastException。{ setContentView(R.layout.activity_main) } val tabLa
浏览 1
提问于2018-06-26
得票数 0
1
回答
为什么我在.setOnTouchListener()上得到一个nullpointerexception?
java
、
android
、
nullpointerexception
、
imageview
super.onCreate(savedInstanceState); cameraButton = (Button)
findViewById
(R.id.camerabutton); colordisplay = (ImageView)
findViewById
(R.id.colordisplay); cameraButton.s
浏览 0
提问于2012-03-29
得票数 0
回答已采纳
2
回答
从AsyncTask调用自定义对话框
android
、
android-asynctask
、
android-listview
、
customdialog
R.string.app_name ); final ListView ResultView = (ListView)
findViewById
浏览 2
提问于2011-03-01
得票数 2
回答已采纳
5
回答
我在文本视图的settext(charSeq)方法上得到
空
指针异常?
android
、
textview
super.onCreate(savedInstanceState); bt=(Button)
findViewById
dialog.setTitle("This is my custom dialog box"); TextView t=(TextView)
findViewById
浏览 0
提问于2012-05-22
得票数 1
1
回答
Android setOnItemClickListener inside适配器未崩溃
android
、
android-fragments
、
android-adapter
imageView = (ImageView) convertView; GridView mygrid = (GridView) imageView.
findViewById
浏览 0
提问于2015-02-27
得票数 0
3
回答
RecyclerView没有显示数据
android
、
android-recyclerview
、
kotlin
我目前正在尝试用一个recyclerView创建一个动态头。我写了ListAdapter和ViewHolder。添加自定义列表元素,列表中元素的编号也是正确的,但不知何故,它没有显示对象数据,而是只显示在布局设计中添加的dummyText。class HeaderListAdapter(val context: Context, val headers: List<CustomHeader>) : RecyclerView.Adapter<HeaderViewHolder>() { override fun onCreateV
浏览 0
提问于2018-04-12
得票数 0
回答已采纳
2
回答
如何在android中禁用选项卡栏项目?
android
、
android-widget
、
android-tabhost
、
android-tabactivity
、
android-tabs
我搜索并找到了以下方法: tabHost.getTabWidget().getChildTabViewAt
浏览 0
提问于2012-06-12
得票数 0
回答已采纳
1
回答
java.lang.IllegalStateException:
findViewById
(R.id.addNotes)不
能为
空
android
this, "Welcome to NoteActivity", Toast.LENGTH_SHORT).show() addNotes =
findViewById
(R.id.addNotes) // onclick add notes btn addNotes.setOnClickListenerandroid.app.serv
浏览 0
提问于2020-10-19
得票数 1
1
回答
试图在
空
对象引用上调用虚方法的void android.widget.ListView.setAdapter(android.widget.ListAdapter)‘
android
大多数情况下,我检查了获取关于
空
对象引用的错误 ListView mylistView= (ListView)
findViewById
浏览 0
提问于2015-09-18
得票数 1
回答已采纳
1
回答
Dart:如何从可
空
列表中安全地获取元素?
flutter
、
dart
我有一个可
能为
空
的列表。如何使用dart的
空
安全操作符从其中获取元素? aNullList?[0] ?? "None" (也
不
编译)
浏览 0
提问于2019-07-10
得票数 1
回答已采纳
点击加载更多
相关
资讯
刘丰老师:《心经》隐藏的神奇密码——色不异空,空不异色
大波动回落如期来,不破两点不转空
名创优品被做空,到底冤不冤?
浑身发痒:拼多多终于不唱空自己了!
瑞银:比特币是泡沫 不建议投资和做空
热门
标签
更多标签
云服务器
ICP备案
对象存储
云点播
实时音视频
活动推荐
运营活动
广告
关闭
领券