appcompatactivity

Out of Memory : android.support.v7.app.AppCompatActivity.onCreate

血红的双手。 提交于 2019-12-02 13:56:23
we recently switched to using AppCompatActivity instead of FragmentActivity and now some devices are randomly crashing with the following error. No idea why this is happening. Fatal Exception: java.lang.OutOfMemoryError: Failed to allocate a 16008012 byte allocation with 4277152 free bytes and 4MB until OOM at dalvik.system.VMRuntime.newNonMovableArray(VMRuntime.java) at android.graphics.BitmapFactory.nativeDecodeAsset(BitmapFactory.java) at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:856) at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:675) at

Android Studio: ActionBar.TabListener does not work with AppCompatActivity?

*爱你&永不变心* 提交于 2019-12-02 11:24:11
问题 I am trying to upgrade some code from FragmentActivity to AppCompatActivity and ActionBar to android.support.v7.app.ActionBar due to deprecation. I've spent a few hours trying to fix this, but I am sure someone with more experience might be able to solve this very quickly. So my class looks like this now: import android.support.v7.app.ActionBar; import android.support.v7.app.AppCompatActivity; //...many other imports here public class MyClass extends AppCompatActivity implements ActionBar

Why does the XML onClick attribute set an OnClickListener TWICE on AppCompatButtons

点点圈 提交于 2019-12-02 08:52:45
When Android inflates a Button with an onClick XML attribute, it internally sets a DeclaredOnClickListener on that Button which then uses reflection to trigger the actually onClick method in our code. case R.styleable.View_onClick: [...] final String handlerName = a.getString(attr); if (handlerName != null) { setOnClickListener(new DeclaredOnClickListener(this, handlerName)); } break; I noticed that for AppCompatButton s (i.e. normal Buttons in an AppCompatActivity ) the same process gets repeated in the AppCompatViewInflater class, resulting in 2 different DeclaredOnClickListener s set in

Android Studio: ActionBar.TabListener does not work with AppCompatActivity?

落爺英雄遲暮 提交于 2019-12-02 07:04:51
I am trying to upgrade some code from FragmentActivity to AppCompatActivity and ActionBar to android.support.v7.app.ActionBar due to deprecation. I've spent a few hours trying to fix this, but I am sure someone with more experience might be able to solve this very quickly. So my class looks like this now: import android.support.v7.app.ActionBar; import android.support.v7.app.AppCompatActivity; //...many other imports here public class MyClass extends AppCompatActivity implements ActionBar.TabListener{ @Override public void onTabSelected(ActionBar.Tab tab, FragmentTransaction

What to use instead of getSupportActionBar() in Library 22?

此生再无相见时 提交于 2019-12-01 19:36:56
There is a line in my code, that marked as yellow: getSupportActionBar().setDisplayShowHomeEnabled(true); After installing appcompat-v7:22.1 it shows a hint: "Method invocation may produce java.lang.nullpointerexception". What should be used instead of getSupportActionBar() ? getSupportActionBar().setDisplayShowHomeEnabled(true); Should say if (getSupportActionBar() != null) { getSupportActionBar().setDisplayShowHomeEnabled(true); } getSupportActionBar() can return null so you the hint is telling you about this. I found another way, using AppCompatDelegate : getDelegate().getSupportActionBar()

can't resolve AppCompatActivity

不羁岁月 提交于 2019-11-27 18:08:12
After renaming application package name, Android Studio displayed this error can't resolve symbol AppCompatActivity Things I tried: Clean project Clean Android Studio cache Clean Gradle cache Re-installed IDE File-> Invalidate cache/restart But nothing really helped. The project build successfully, but I can not use syntax highlighting. I used com.android.support:appcompat-v7:23.1.1 Screenshots Okay, to anybody who might stumble upon this now, Android Studio is very, very, very weird. Solution : Go to your build.gradle file and in your dependencies find the appcompat one, something like

Getting exception : java.lang.NoClassDefFoundError: android.support.v7.app.AppCompatDelegateImplV14

被刻印的时光 ゝ 提交于 2019-11-27 15:39:31
I updated Android Studio and the android design library recently since then I am getting an exception java.lang.NoClassDefFoundError: android.support.v7.app.AppCompatDelegateImplV14 . Not sure what is the problem, I tried almost everything, its working in lollipop 5.1 device(nexus 4) but it does not work in Android 4.4 device and 4.02 device. It was working before the updation in all versions. I tried all solutions mentioned in stackoverflow but nothing worked for me. Also tried removing the line compile 'com.android.support:support-v4:22.2.0' in build.gradle but it did not work too. Also

Do not request Window.FEATURE_ACTION_BAR issue

假装没事ソ 提交于 2019-11-27 08:38:37
I'm trying to build my app but without success.. I tried several way but nothing was worked. The exception is: Caused by: java.lang.IllegalStateException: This Activity already has an action bar supplied by the window decor. Do not request Window.FEATURE_ACTION_BAR and set windowActionBar to false in your theme to use a Toolbar instead. My style.xml is: <resources> <style name="AppTheme" parent="Theme.AppCompat.Light"> <!-- theme customizations --> <item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimaryDark">@color/colorPrimaryDark</item> <item name="colorAccent">@color

How to fix: “You need to use a Theme.AppCompat theme (or descendant) with this activity”

蓝咒 提交于 2019-11-27 08:01:23
I am having trouble running my Android app in a fullscreen mode per instructions of a video. When it tries to run, the app crashes with the error. "You need to use a Theme.AppCompat theme (or descendant) with this activity Manifest File <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.djsg38.hikerswatch"> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.INTERNET" />

java.lang.NoSuchMethodError: No static method setOnApplyWindowInsetsListener

☆樱花仙子☆ 提交于 2019-11-27 05:15:49
I upgraded my android studio to 2.1.3. And now I am getting following error java.lang.NoSuchMethodError: No static method setOnApplyWindowInsetsListener(Landroid/view/View;Landroid/support/v4/view/OnApplyWindowInsetsListener;)V in class Landroid/support/v4/view/ViewCompatLollipop; or its super classes (declaration of 'android.support.v4.view.ViewCompatLollipop' appears in /data/data/com.restroshop.restroowner/files/instant-run/dex/slice-internal_impl-24.2.0_7c318f8d2adb03d07a9def5d35a14e39204ecef2-classes.dex) at android.support.v4.view.ViewCompat$LollipopViewCompatImpl