【持续更新】我遇到的问题

1,Service Intent must be explicit: Intent

   不要以为你想什么代码都知道,还是要写出来滴~~。比方这个,你一定没有告诉代码你要打开哪个activity或者service.

   正确姿势:Intent intent=newIntent(Activity.this, Service.class);

2,xml预览时Missing styles. Is the correct theme chosen for this layout?

Use the Theme combo box above the layout to choose a different layout, or fix the theme style references.

Failed to find style 'textViewStyle' in current theme

  

 

3, Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.content.Context.getPackageName()' on a null object reference

    原来是我重写Activity的onCreate方法时,重写了public void onCreate(Bundle savedInstanceState, PersistableBundle persistentState),并没有默认调用它,默认调用的是protected void onCreate(Bundle savedInstanceState),所以并没有执行setContentView(),界面也没有任何东西。看来就算会自动补全还是要记住方法的参数,还是要好好选,不能啪一下回车就过了。



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值