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

I resolved this issue and if anyone is experiencing this issue try these options(3rd point fixed my problem): Add multiDexEnabled true in defaultConfig of build.gradle. defaultConfig { applicationId “com.something.ranjith.androidprojdel” minSdkVersion 15 targetSdkVersion 22 versionCode 1 versionName “1.0” multiDexEnabled true } Remove android support library if your activity extends `AppcompatActivity’ compile ‘com.android.support:support-v4:22.+’ //remove this If you … Read more

AppCompatActivity instead of ComponentActivity in Jetpack compose

You can use the AppCompatActivity since it extends FragmentActivity which extends ComponentActivity. class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContent { val activity = LocalContext.current as AppCompatActivity Button(onClick={ showDatePicker(activity)}){ Text(“Picker”) } } } } fun showDatePicker(activity: AppCompatActivity){ val picker = MaterialDatePicker.Builder.datePicker().build() activity?.let { picker.show(it.supportFragmentManager, picker.toString()) picker.addOnPositiveButtonClickListener { } } } Note: … Read more

How to display menu item with icon and text in AppCompatActivity

@Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. // getMenuInflater().inflate(R.menu.menu_patient_home_screen, menu); menu.add(0, 1, 1, menuIconWithText(getResources().getDrawable(R.mipmap.user_2), getResources().getString(R.string.action_profile))); menu.add(0, 2, 2, menuIconWithText(getResources().getDrawable(R.mipmap.add_user), getResources().getString(R.string.action_add_user))); menu.add(0, 3, 3, menuIconWithText(getResources().getDrawable(R.mipmap.switch_profile), getResources().getString(R.string.action_switch_profile))); menu.add(0, 4, 4, menuIconWithText(getResources().getDrawable(R.mipmap.logout), getResources().getString(R.string.action_sign_out))); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle … Read more

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

Your application has an AppCompat theme <application android:theme=”@style/AppTheme”> But, you overwrote the Activity (which extends AppCompatActivity) with a theme that isn’t descendant of an AppCompat theme <activity android:name=”.MainActivity” android:theme=”@android:style/Theme.NoTitleBar.Fullscreen” > You could define your own fullscreen theme like so (notice AppCompat in the parent=) <style name=”AppFullScreenTheme” parent=”Theme.AppCompat.Light.NoActionBar”> <item name=”android:windowNoTitle”>true</item> <item name=”android:windowActionBar”>false</item> <item name=”android:windowFullscreen”>true</item> <item name=”android:windowContentOverlay”>@null</item> … Read more

What’s the enhancement of AppCompatActivity over ActionBarActivity?

As Chris wrote, new deprecated version of ActionBarActivity (the one extending AppCompatActivity class) is a safe to use backward compatibility class. Its deprecation is just a hint for you asking to use new AppCompatActivity directly instead. AppCompatActivity is a new, more generic implementation which uses AppCompatDelegate class internally. If you start a new development, then … Read more

Activity, AppCompatActivity, FragmentActivity, and ActionBarActivity: When to Use Which?

I thought Activity was deprecated No. So for API Level 22 (with a minimum support for API Level 15 or 16), what exactly should I use both to host the components, and for the components themselves? Are there uses for all of these, or should I be using one or two almost exclusively? Activity is … Read more