开发中遇到的问题(一)——java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.

1、错误描述:

  java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.

2、起因:

  在Manifest中设置我的activity全屏



1 <activity android:name=".SplashActivity"
2             android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen">


3、原因:
  从错误提示中提到Theme.AppCompat theme,这是因为我们的activity一定是继承了兼容包中的类,比如我这里就无意中继承了AppCompatActivity,它来自android.support.v7.app.AppCompatActivity。

4、解决:

  改为继承自Activity,即来自import android.app.Activity。

(而继续继承AppCompatActivity该如何解决还有待研究。)

时间: 2024-07-31 15:44:15

开发中遇到的问题(一)——java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.的相关文章

Android开发中使用数据库时出现java.lang.IllegalStateException: Cannot perform this operation because the connection pool has been closed.

最近在开发一个 App 的时候用到了数据库,可是在使用数据库的时候就出现了一些问题,在我查询表中的一些信息时出现了一下问题: Caused by: java.lang.IllegalStateException: Cannot perform this operation because the connection pool has been closed. at android.database.sqlite.SQLiteConnectionPool.throwIfClosedLocked(

android 修改listview中adapter数据时抛出异常java.lang.IllegalStateException: The content of the adapter has changed but ListView did not receive a notification问题

近日在做项目时遇到非必现crush,具体异常信息为: // Short Msg: java.lang.IllegalStateException // Long Msg: java.lang.IllegalStateException: The content of the adapter has changed but ListView did not receive a notification. Make sure the content of your adapter is not mo

常见错误之java.lang.IllegalStateException: The application’s PagerAdapter changed the adapter’s cont。。。

如果在logcat日志中出现以下错误: java.lang.IllegalStateException: The application's PagerAdapter changed the adapter's contents without calling PagerAdapter#notifyDataSetChanged! Expected adapter item count: 0, found: 4 Pager id: com.activity_test.logo:id/viewpag

response.sendRedirect 报 java.lang.IllegalStateException 异常的解决思路

今天在进行代码开发的时候,出现了 java.lang.IllegalStateException异常,response.sendRedirect("./DEFAULT.html"); 这一条语句出错. 在网上进行查找之后,发现问题很有可能是因为response.sendRedirect方法执行了两次,其中一次肯定是项目框架里面的跳转,而我自己要进行跳转的话,就显得极其不方便,最后我把目光放到前端页面,在前端页面进行跳转. 一开始我的前端语句是:window.location.href=

java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState

1. 场景: 在开发过程中遇到这么一个需要,在主页点击按钮进入另一个Activity(ReadActivity),在该ReadActivity中点击一个按钮再返回主页并指定主页选中特定的Tab.主页是用FragmentTabHost + Fragment 实现.思路是通过startActivityForResult以及setResult() 以及requestCode作为标志位,是ReadActivity返回,因为还有其他的requestCode.再通过 FragmentTabHost的setC

Android开发:java.lang.IllegalStateException报错

常见于ListView列表刷新数据时,更改UI. LOG: The content of the adapter has changed but ListView did not receive a notification. Make sure the content of your adapter is not modified from a background thread, but only from the UI thread. DDMS中的log无法定位到准确的出错位置.检查错误可

Struts2中使用execAndWait后,在 Action中调用getXXX()方法报告java.lang.NullPointerException异常的原因和解决方法

使用 Struts2 编写页面,遇到一个要长时间运行的接口,因此增加了一个execAndWait ,结果在 Action 中调用 getContext()的时候报告异常 1 ActionContext context = ActionContext.getContext(); 2 ServletContext servletContext = (ServletContext) context.get(ServletActionContext.SERVLET_CONTEXT); //抛空指针异常

JSON中 net.sf.json.JSONException: java.lang.NoSuchMethodException异常

在json对象和java对象转换时 String s = "{'name':'name1','pwd':'pwd1'}"; Person p = (Person)JSONObject.toBean(JSONObject.fromObject(s), Person.class); System.out.println(p.getPwd()); 上面代码中出现以下异常: net.sf.json.JSONException: java.lang.NoSuchMethodException [

开发问题及解决--java.lang.IllegalStateException: Circular dependencies cannot exist in RelativeLayout

<?xml version="1.0" encoding="utf-8"?> <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" > <Horiz