Rename package in Android Studio

Rename package in Android Studio In Android Studio, you can do this:   For example, if you want to change com.example.app to my.awesome.game, then: In your Project pane, click on the little gear icon (  ) Uncheck / De-select the Compact Empty Middle Packages option   Your package directory will now be broken up in individual directories Individually select each directory you want to rename, and: Right-click it Select Refactor Click on Rename In the Pop-up dialog, click on Rename Package instead of Rename Directory Enter the new name and hit Refactor Click Do Refactor in the bottom Allow a minute to let Android…

Read More

Could not find com.android.tools.build:aapt2:3.2.0-4818971 Android Studio

Could not find com.android.tools.build:aapt2:3.2.0-4818971 Android Studio Most likely you do not have the Google repository in your project’s build.gradle file. Add google() in BOTH locations as shown below: buildscript {     repositories {         google()         jcenter()     }     dependencies {         classpath ‘com.android.tools.build:gradle:3.2.0’     } } allprojects {     repositories {         google()         jcenter()     } }

Read More

Communication Within an Android App With EventBus

Communication Within an Android App With EventBus A typical Android app tends to be composed of many layers, modules or structures such as Fragments, Activities, Presenters, and Services. Effective communication between these components can become difficult if they are tightly coupled together.  In the lower level of your app architecture, such as the database, when an action happens, you might want to send data to a higher level such as the view. To do this, you might want to create a listener interface, async tasks or callbacks. All of these…

Read More

Registration form in Android (Check if email is valid and if EditText is empty)

Registration form in Android (Check if email is valid and if EditText is empty) On Click method:  bt_register.setOnClickListener(new View.OnClickListener() {             @Override             public void onClick(View v) {                 boolean isConnected = ConnectivityReceiver.isConnected();                 if (isConnected) {                     chekdata();                 } else {              …

Read More

Set container layout above BottomNavigationView

Set container layout above BottomNavigationView I have used a FrameLayout to prevent the BottomNavigationView from overlapping with layouts above it. <?xml version=”1.0″ encoding=”utf-8″?> <android.support.constraint.ConstraintLayout xmlns:android=”http://schemas.android.com/apk/res/android”     xmlns:app=”http://schemas.android.com/apk/res-auto”     xmlns:tools=”http://schemas.android.com/tools”     android:id=”@+id/container”     android:layout_width=”match_parent”     android:layout_height=”match_parent”     tools:context=”com.xxx.xxx.xxxx”>     <FrameLayout         android:id=”@+id/fragment_container”         android:layout_width=”0dp”         android:layout_height=”0dp”         app:layout_constraintTop_toTopOf=”parent”         app:layout_constraintBottom_toTopOf=”@+id/navigation”         app:layout_constraintLeft_toLeftOf=”parent”         app:layout_constraintRight_toRightOf=”parent”>         <include        …

Read More

Retrofit 2 – How to show progress bar On Receiving JSON Response

Retrofit 2 – How to show progress bar On Receiving JSON Response private void loadJSON() {         Retrofit retrofit = new Retrofit.Builder()                 .baseUrl(BASEURL)                 .addConverterFactory(GsonConverterFactory.create())                 .build();         newsAPI = retrofit.create(NewsAPI.class);         Call < JSONResponse > call =                 newsAPI.topNews(“soure”, “api-key”);         // Set up progress before call  …

Read More

Error:Could not determine the class-path for interface com.android.builder.model.AndroidProject

Error:Could not determine the class-path for interface com.android.builder.model.AndroidProject Solution: I had same problem but finally I could solve it forever Steps: 1)Delete gradle and .gradle folders from your project folder. 2)Restart Android Studio 3)buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile(‘proguard-android.txt’), ‘proguard-rules.pro’ } }

Read More

Android Studio: Drawable Folder: How to put Images for Multiple dpi?

Android Studio: Drawable Folder: How to put Images for Multiple dpi? The standard procedures are: Choose Project > app > scr > main Right click “res”, choose “New” and choose “Android resource directory”  In the opened dialog, at Resource Type choose “drawable”  In the list Available qualifier choose Density, then click the right arrow at the middle.  Choose the Density that you like then press OK 

Read More