IllegalStateException in my Android app caused by Theme.AppCompat

前端 未结 1 655
刺人心
刺人心 2021-01-26 11:19

I get a NPE when I try to launch the App. I don\'t know what causes it. The App should show a map at a website. Then the User can easily type his location into the edittext and

相关标签:
1条回答
  • 2021-01-26 12:10
    You need to use a Theme.AppCompat theme (or descendant) with this activity.
    

    You have

    public class MainActivity extends ActionBarActivity
    

    You are using ActionBar from support library and you need to have Theme.AppCompat for your activity

    Apply AppCompat theme for the activity in manifest file.

    <activity android:theme="@style/Theme.AppCompat
    

    Please check Adding Actionbar in the below link

    http://developer.android.com/guide/topics/ui/actionbar.html

    Also check this blog

    http://android-developers.blogspot.in/2013/08/actionbarcompat-and-io-2013-app-source.html

    Also btgo is not initialized which will cause NullPointerException

    0 讨论(0)
提交回复
热议问题