在Tablelayout中的运行时添加控件时出错 [英] Error in Adding control on runtime in Tablelayout

查看:80
本文介绍了在Tablelayout中的运行时添加控件时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨 我是android的初学者
我已经制作了一个文件(list_mushic.xml),并且在scrollview中添加了tablelayout,并且以这种方式获得了(TableLayout table _ =(TableLayout)findViewById(R.id.song_table)),并且在运行时放置了一些textview和图像当我单击以显示结果但显示以下错误时,任何人都可以帮助我.



无法启动活动ComponentInfo {com.sample.activityswitching1/com.sample.activityswitching1.Page2}:java.lang.NullPointerException

Hi i am beginner to android
i have made a file (list_mushic.xml) and i have add tablelayout in scrollview and i have get(TableLayout table_=(TableLayout) findViewById(R.id.song_table) in this way and i am adding some textview and images on runtime put when i click on to show result but it is showing me following error can any one help me please.



Unable to start activity ComponentInfo{com.sample.activityswitching1/com.sample.activityswitching1.Page2}: java.lang.NullPointerException

推荐答案

java.lang. NullPointerException
这只是意味着您正在尝试使用实际上是NULL的对象的属性

在引发此异常的地方进行调试,然后检查是否有任何对象为NULL并尝试使用其属性.


仅用于您的知识库和参考 [调试java.lang.NullPointerException的建议 [
java.lang.NullPointerException
This simply means that you are trying to use a property of an object which is actually a NULL

DEBUG around the lines from where this exception is thrown and then check if any object is NULL whose property you are trying to use.


Just for your knowledgebase and reference[^].

This also, is a good one: Suggestions for debugging java.lang.NullPointerException[^]


这篇关于在Tablelayout中的运行时添加控件时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆