Search result for Question Taged
There are some results of your Tag:
    How to deal with deprecated gradle features were used in this build, making it incompatible with gradle 8.0

    1. FAILURE
    2. Sometime when you try to build the app you may encounter this FAILURE.
      ..."Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0."
      

    3. Most common Solution
    4. Run the Gradle build with a command line argument --warning-mode=all to see what exactly the deprecated features are.

      It will give you a detailed description of found issues with links to the Gradle docs for instructions how to fix your build.

      Adding --stacktrace to that, you will also be able to pinpoint where the warning comes from, if it's triggered by outdated code in one of the plugins and not your build script.

    5. Solution 2
    6. if the abouve Solution dont work Try this one

      cd android && ./gradlew clean && ./gradlew :app:bundleRelease
      

    7. Solution 3
    8. The process below worked in many case- First check Gradle Version:

      cd android
      ./gradlew -v
      

      In my case it was 6.5

      Go to https://developer.android.com/studio/releases/gradle-plugin and you'll get the plugin version for your gradle version. For gradle version 6.5, the plugin version is 4.1.0

      Then go to app/build.gradle and change classpath 'com.android.tools.build:gradle:<plugin_version>

    9. Solution 4
    10. if your project is incompatible with Gradle 8.0 .Here's what worked for you: First write this line of code in the Android Studio terminal:

      ./gradlew build --warning-mode all
      

      When you do that, you will be shown in the logcat what is found to be deprecated or an issue in your project, for me it was the jcenter() repository that needed to be removed in my settings.gradle file and also I needed to update classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.21" to classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.30" in my build.gradle project file.

      Once I did these things, my project built perfectly and installed on my emulator

    Kyle Elkins 2022-08-09
    Show entire bottom sheet with EditText above Keyboard

    1. FAILURE
    2. implementing a UI where a bottom sheet will appear above the keyboard with an EditText for the user to enter a value. The problem is the View is being partially overlapped by the keyboard, covering up the bottom of the bottom sheet.

    3. Most common Solution
    4. Just reposting @jblejder from this question Keyboard hides BottomSheetDialogFragment since it worked for me, to make it easier for others to find:

      The most convenient way that I found to change this is by creating style:

      <style name="DialogStyle" parent="Theme.Design.Light.BottomSheetDialog">
          <item name="android:windowIsFloating">false</item>
          <item name="android:statusBarColor">@android:color/transparent</item>
          <item name="android:windowSoftInputMode">adjustResize</item>
      </style>
      

      And set this in onCreate method of your BottomSheetDialogFragment:

      override fun onCreate(savedInstanceState: Bundle?) {
          super.onCreate(savedInstanceState)
          setStyle(DialogFragment.STYLE_NORMAL, R.style.DialogStyle)
      }
      

      This is how it looks on my device:

      enter image description here

      ==== UPDATE ====

      As already mentioned in the Comments a few times, you might also need to set the state of the BottomSheetDialog to STATE_EXPANDED like in Nordknight's answer below

      dialog = new BottomSheetDialog(getContext(), R.style.BottomSheetDialog);  
      dialog.setOnShowListener(new DialogInterface.OnShowListener() {
      @Override
      public void onShow(DialogInterface dialog) {
                  new Handler().postDelayed(new Runnable() {
                      @Override
                      public void run() {
                          BottomSheetDialog d = (BottomSheetDialog) dialog;
                          FrameLayout bottomSheet = d.findViewById(R.id.design_bottom_sheet);
                          BottomSheetBehavior bottomSheetBehavior = BottomSheetBehavior.from(bottomSheet);
                          bottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
                      }
                  },0);
              }
          });
      

    5. Solution 2
    6. This might be a redundant answer. Although just pointing out the issue. If you're using BottomSheetDialogFragment, the only way is to enable the attribute android:windowIsFloating to true. This will enable the whole window to be on top of whatever is trying to take the space behind it.

      <style name="BottomSheetDialogThemeNoFloating" parent="Theme.Design.Light.BottomSheetDialog">
              <item name="android:windowIsFloating">false</item>
              <item name="android:windowSoftInputMode">adjustResize|stateVisible</item>
      </style>
      

      Then in your onCreate() of your dialog, set this style.

      override fun onCreate(savedInstanceState: Bundle?) {
              super.onCreate(savedInstanceState)
              // set the window no floating style
              setStyle(DialogFragment.STYLE_NORMAL, R.style.AppRoundedBottomSheetDialogThemeNoFloating)
      }
      

      This is handy for those who frequently use bottom sheets and may want to deal with EditText and soft keyboard overlapping each other.

      Note: The class KeyboardUtil by mikepenz has an issue in which on certain phones, the content view with input field is automatically pushed above keyboard despite giving bottom padding to the whole content view supplied.

    7. Solution 3
    8. dialog = new BottomSheetDialog(getContext(), R.style.BottomSheetDialog);  
      dialog.setOnShowListener(new DialogInterface.OnShowListener() {
      @Override
      public void onShow(DialogInterface dialog) {
                  new Handler().postDelayed(new Runnable() {
                      @Override
                      public void run() {
                          BottomSheetDialog d = (BottomSheetDialog) dialog;
                          FrameLayout bottomSheet = d.findViewById(R.id.design_bottom_sheet);
                          BottomSheetBehavior bottomSheetBehavior = BottomSheetBehavior.from(bottomSheet);
                          bottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
                      }
                  },0);
              }
          });
      

      This code works fine at Fragment's onCreateView method (thanks for ADM)

    9. Solution 4
    10. Some answers seem to do the trick better than others but will need modification when using the new material design components instead of the older support libraries while also using kotlin

      Hope this will help someone.

      BottomSheetDialog(this, R.style.DialogStyle).apply {
          setContentView(layoutInflater.inflate(R.layout.bottom_sheet, null))
          window?.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE)
          findViewById<EditText>(R.id.time_et)?.requestFocus()
      
          show()
      }
      

      layout/bottom_sheet.xml

      <?xml version="1.0" encoding="utf-8"?>
      <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
              xmlns:app="http://schemas.android.com/apk/res-auto"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:background="#ffffff"
              android:padding="16dp">
      
          <LinearLayout
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:orientation="vertical">
      
      
              <LinearLayout
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:orientation="horizontal">
      
                  <View
                          android:layout_width="0dp"
                          android:layout_height="match_parent"
                          android:layout_weight="1" />
      
                  <LinearLayout
                          android:layout_width="0dp"
                          android:layout_height="wrap_content"
                          android:layout_weight="5"
                          android:orientation="vertical">
      
                      <TextView
                              android:layout_width="wrap_content"
                              android:layout_height="wrap_content"
                              android:text="Time"
                              android:textColor="#000000"
                              android:textSize="24sp"
                              android:textStyle="bold" />
      
                      <LinearLayout
                              android:layout_width="wrap_content"
                              android:layout_height="wrap_content"
                              android:layout_marginTop="8dp"
                              android:orientation="horizontal">
      
                          <EditText
                                  android:id="@+id/time_et"
                                  android:layout_width="wrap_content"
                                  android:layout_height="wrap_content"
                                  android:inputType="numberSigned"
                                  android:minWidth="50dp"
                                  android:text="15" />
      
                          <TextView
                                  android:layout_width="wrap_content"
                                  android:layout_height="wrap_content"
                                  android:layout_marginLeft="8dp"
                                  android:text="min" />
      
                      </LinearLayout>
      
      
                  </LinearLayout>
      
              </LinearLayout>
      
      
              <Button
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:layout_marginTop="16dp"
                      android:background="#000"
                      android:text="Save"
                      android:textColor="#fff" />
      
          </LinearLayout>
      
      </ScrollView>
      

      styes.xml (Split for v-21 for using statusBarColor)

          <style name="DialogStyle" parent="Theme.MaterialComponents.Light.BottomSheetDialog">
              <item name="android:windowIsFloating">false</item>
              <item name="android:statusBarColor">@android:color/transparent</item>
              <item name="android:windowSoftInputMode">adjustResize</item>
          </style>
      
    Salvatrix Ngải 2022-08-11
    build android apps from nodejs

    If You Can Build A Website, You Can Build An Android App!
    Android.js simple takes your node.js website and puts it into a WebView.

    Yeah, i know that's a lot of disadvantages there but it also provides different APIs for you to interact with.

    an android.js application isn't only a WebView like a front end of a site, it can also interact with the backend and interact with files and much more!

    installation

    npm install androidjs
    
    Enter fullscreen mode Exit fullscreen mode

    Install Android JS project generator and builder

    npm install -g androidjs-builder
    
    Enter fullscreen mode Exit fullscreen mode

    initialize

    mkdir AndroidApp
    cd AndroidApp
    androidjs g
    npm install
    
    Enter fullscreen mode Exit fullscreen mode

    it will generate a sample project inside AndroidApp directory.

    Which will look like:

    AndroidApp
        |__ assets
        |       |__ ipc, css, js
        |
        |__ views
        |       |__ index.html
        |
        |__ main.js
        |__ package.json
    
    Enter fullscreen mode Exit fullscreen mode
    • main.js is the main file or we can say it is back process of your app which execute all the code written in node, so you have to write all the node js code inside main.js
    • index.html is the first view which is render by app initially
    • package.json to keep track of all your node packages
    • assets to store all assets of your app

    time to build

    cd AndroidApp
    androidjs b
    
    Enter fullscreen mode Exit fullscreen mode

    it will generate apk file inside dist folder

    if this build command fails or generated any error, try to build with force command

    androidjs b -f
    
    Enter fullscreen mode Exit fullscreen mode

    Why not to use it

    Android.js isn't better than react-native
    But, at least you can (somewhat) throw your existing code in it and generate an API to work on a device just like android application.
    React native stays the best way to make Android applications with react (JavaScript).

    other resources

    docs - documentation for android.js

    Sample apps - some sample apps to go with..

    conclusion

    Android.js is an amazing framework if you don't know react

    But if you know react, react native comes in handy at the first place.

    originally published here at my blog

    Make sure you're subscribed to the high dose javascript newsletter

    of course I can't make you, but it take me a considerable amount of time to write these..

    tweet this if you like it.
    thanks!

    Jožica Lidiya 2022-08-11
    chain validation failed SSLHandshakeException 5 Solution

    1. FAILURE
    2. Sometime when you try to do a HTTPS POST request to your server. you get SSLHandshakeException - Chain chain validation failed, all the time. but when using POSTMAN you get a response from the server. What can be causing this error when I try to send the request from the application?

    3. Most common Solution
    4. In many case it was the wrong date on phone.

      Fixing date resolved an issue

    5. Solution 2
    6. if the abouve Solution dont work Try this one

      The problem may be that the certificate was expired.

    7. Solution 3
    8. If you're using an emulated device it may solve the problem if you just 'Cold Boot' it.

      Sometimes the date on those things can get stuck if you let them run for some time, which results in this expired-certificate-problem.

    9. Solution 4
    10. In my case, I fetch this issue on Android Emulator. When I clear emulator cache has resolved the issue.

      enter image description here

    Pétur Gulnara 2022-08-09
    how to solve Could not find or load main class org.gradle.wrapper.GradleWrapperMain

    1. FAILURE
    2. execution of the command ./gradlew leads to the following output:
      usr$ ./gradlew tasks
      Error: Could not find or load main class org.gradle.wrapper.GradleWrapperMain
      

    3. What is gradle wrapper
    4. gradlew is the gradle wrapper executable - batch script on windows and shell script elsewhere. The wrapper script when invoked, downloads the defined gradle version and executes it. By distributing the wrapper with your project, anyone can work with it without needing to install Gradle beforehand. Even better, users of the build are guaranteed to use the version of Gradle that the build was designed to work with.

    5. Restoring gradle wrapper
    6. It used to be that you needed to add a wrapper task to your build.gradle to restore gradle wrapper and all its dependencies. For instance:

      task wrapper(type: Wrapper) {
          gradleVersion = '4.1'
      }
      

      Newer versions of gradle do not require this. It is now a built-in task. Just run:

      gradle wrapper
      

      You can also supply additional flags to specify versions etc

      gradle wrapper --gradle-version 6.2 --distribution-type all
      

      When you run this task, a gradle wrapper script, and the required jar files are added to your source folders. Properties are stored in gradle/wrapper/gradle-wrapper.properties

      (You may need to install gradle locally to run this. brew install gradle on mac for instance. See more detailed instructions here)

    7. Why was it missing in the first place?
    8. OP seems to have deleted something that gradle wrapper depends on.

      But a common reason is that a .gitignore entry prevents wrapper jars from being checked into git. Note that the .gitignore in effect may be in the source folder, or a global one in your user home folder or git global configuration. It is common to have a *.jar entry in .gitignore.

      You can add an exception for gradlew's jar files in .gitignore

      *.jar
      !gradle/wrapper/gradle-wrapper.jar
      

      or force add the wrapper jar into git

      git add -f gradle/wrapper/gradle-wrapper.jar
      

      --
      Ref: Gradle Wrapper

    9. Other Solution
    10. What worked for me is to first run:

       gradle wrapper
      

      After successful build I was able to run

      ./gradlew assembleRelease
      

      Note: To be able run gradle wrapper first run brew install gradle. If installation successful run gradle wrapper from project root.

      Source and thanks: http://gradle.org/docs/current/userguide/gradle_wrapper.html and https://stackoverflow.com/users/745574/rage

      In my case it was a global .gitignore, as explained in @HankCa's answer.

      Instead of forcefully adding the jar, which you'll need to remember to do in each Gradle project, I added an override to re-include the wrapper jar in my global .gitignore:

      *.jar
      !gradle/wrapper/gradle-wrapper.jar
      

      This is useful to me as I have many projects that use Gradle; Git will now remind me to include the wrapper jar.

      This override will work so long as no directories above gradle-wrapper.jar (such as gradle and wrapper) are ignored -- git will not descend in to ignored directories for performance reasons.

    Laxmi Queenie 2022-08-11
    How to solve Error building Android library

    1. FAILURE
    2. We are now seeing this error when building one of our library modules:
      $ ./gradlew library_module:assemble
      
      Execution failed for task ':library_module:bundleDebugAar'.
      > Direct local .aar file dependencies are not supported when building an AAR. 
      The resulting AAR would be broken because the classes and Android resources from any local .aar 
      file dependencies would not be packaged in the resulting AAR. Previous versions of the Android 
      Gradle Plugin produce broken AARs in this case too (despite not throwing this error). The 
      following direct local .aar file dependencies of the :library_module project caused this error: 
      ______.aar
      

    3. Most common Solution
    4. I recently encountered the same issue, the fix was to remove the library from libs/ and import it using File -> New -> New Module -> Import .JAR/.AAR Package, then referencing it in the library module build.gradle file:

      dependencies {
        implementation project(":imported_aar_module")
      }
      

      If you are on a newer Android Studio version (4.0.0+), this option is not available. Instead you have to do it manually.

      1. Create a new directory and put the following content into the build.gradle file withing the new directory:
      configurations.maybeCreate("default")
      artifacts.add("default", file('[nameOfTheAar].aar'))
      
      1. Place the aar into this new directoy. Next to the build.gradle file.
      2. Add the new created Gradle project to the settings.gradle file:
      include(":pathToTheCreatedDirectory")
      
      1. Include the project in your library where you want to use the aar:
      implementation project(":pathToTheCreatedDirectory", configuration = "default")
      

    5. Solution 2
    6. When building an Android library that depends on other Android libraries (i.e., aar files), you will get the following error message if you include the aar files as dependencies in the project:

      Direct local .aar file dependencies are not supported when building an AAR. The resulting AAR would be broken because the classes and Android resources from any local .aar file dependencies would not be packaged in the resulting AAR. Previous versions of the Android Gradle Plugin produce broken AARs in this case too (despite not throwing this error).

      As the above message states, when you build an Android library project, any aar it depends on is not packaged. If you built this way prior to AGP (Android Gradle Plugin) 4, you probably noticed that you had to include the aar dependencies on the project consuming your library.

      You can compile your Android library project by specifying that the aar dependencies are compileOnly. See this for more info on when to use compileOnly.

      So just add the following to your app build.gradle file:

      compileOnly files('libs/some-library.aar')
      

      Note that if you do this you will have to include the aar dependencies on the application project that consumes your library.

      Alternatively, you can create a module that imports your aar dependency as @Sandi mentioned in the answer above.

      Another way is to publish your aar dependencies to a maven repository and then add them to your library project like this:

      implementation 'mylibrarygroup:mylibraryartifact:version-x.y.z@aar'
      

    7. Solution 3
    8. I want to call out @StefMa's comment on this question which was incredible simple and solved this issue for me, but it's buried among many other comments on this thread and is easily missed.

      The 'correct' answer on this thread no longer works because it's not possible to import AARs in Android Studio anymore as referred to in that answer. But, the solution referred to in StefMa's comment linking to this GitHub post does, and it works perfectly.

      Long story short - put your AAR into a separate module.

      There's no need to muck around with creating lib directories, just follow these directions -

      1. Create a new directory in your project's root directory. The image below shows two of them - spotify-app-remote and spotify-auth, but one is sufficient. Within that, put your AAR in, and create a new build.gradle file.

        Folder structure

      2. Within the build.gradle file, add the following, replacing the aar filename with the name of your AAR file -

        configurations.maybeCreate("default")
        artifacts.add("default", file('spotify-app-remote-release-0.7.1.aar'))
        
      3. Add this to your settings.gradle file, substituting the name of the directory you created

        include ':spotify-app-remote'
        
      4. Include your new module in the module you wish to use the AAR. eg, if you want to use it within your app module, open app's build.gradle and add

        api project(':spotify-app-remote')
        

        within your dependencies { } block, obviously again substituting spotify-app-remote with whatever the name of your module is.

    9. Solution 4
    10. In my experience, when Gradle Plugin version is 4.2.2+ and Gradle version is 7.1+, as in @Luis's answer 'compileOnly' works.

      compileOnly files('libs/your_library_name.aar')
      

      It didn't work when the Gradle versions were lower.

    Filibert Nosizwe 2022-08-11
    android - Cannot call this method while RecyclerView is computing a layout or scrolling when try remove item from recyclerview

    I am Trying to remove my item from recyclerview, but i always getting error

    java.lang.IllegalStateException: Cannot call this method while RecyclerView is computing a layout or scrolling

    i am using notify datasetchanged, can i solve this?

    public class AdapterIntransit extends RecyclerView.Adapter<AdapterIntransit.ViewHolder> {
        private Context context;
        List<DataIntransit> data;
    
        public AdapterIntransit(Context context, List<DataIntransit> data) {
            this.context = context;
            this.data = data;
        }
    
        @Override
        public AdapterIntransit.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
            View itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.cardintransit, parent, false);
            return new ViewHolder(itemView);
        }
    
        @Override
        public void onBindViewHolder(AdapterIntransit.ViewHolder holder, int position) {
            if (data.get(position).getJml1() - data.get(position).getJml2() <= 0) {
                data.remove(position);
                notifyItemRemoved(position);
                notifyItemRangeChanged(position, getItemCount());
                notifyDataSetChanged();
            } else {
                holder.kode.setText(data.get(position).getKode());
                holder.nama.setText(data.get(position).getNama());
                holder.jumlah.setText(String.valueOf(data.get(position).getJml1() - data.get(position).getJml2()));
            }
        }
    
        @Override
        public int getItemCount() {
            return data.size();
        }
        public class ViewHolder extends RecyclerView.ViewHolder{
            TextView kode, nama, jumlah;
            public ViewHolder(View itemView) {
                super(itemView);
                kode = (TextView)itemView.findViewById(R.id.kode);
                nama = (TextView)itemView.findViewById(R.id.nama);
                jumlah = (TextView)itemView.findViewById(R.id.jumlah);
    
            }
        }
    }
    
    Ethan Savitr 2022-08-16
    java - How to launch an Activity from another Application in Android

    I want to launch an installed package from my Android application. I assume that it is possible using intents, but I didn't find a way of doing it. Is there a link, where to find the information?

    Edna Morgen 2022-08-14
    menuitem - How to change the Text color of Menu item in Android?

    Can I change the background color of a Menu item in Android?

    Please let me know if anyone have any solution to this. The last option will be obviously to customize it but is there any way for changing the text color without customizing it.

    Ganesh Quique 2022-08-15
    android - You need to use a Theme.AppCompat theme (or descendant) with this activity. Change to Theme.AppCompat causes other error

    I use appcompat v22.1.0 in my App and use Toolbar. Everything was fine when I use Theme.AppCompat.Light.NoActionBar. When I start implement AlertDialog, it produce error like this:

    java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
            at android.support.v7.app.AppCompatDelegateImplBase.onCreate(AppCompatDelegateImplBase.java:113)
            at android.support.v7.app.AppCompatDelegateImplV7.onCreate(AppCompatDelegateImplV7.java:146)
            at android.support.v7.app.AppCompatDialog.<init>(AppCompatDialog.java:47)
            at android.support.v7.app.AlertDialog.<init>(AlertDialog.java:92)
            at android.support.v7.app.AlertDialog$Builder.create(AlertDialog.java:882)
            at com.ramabmtr.map.findingmoo.MainActivity.onOptionsItemSelected(MainActivity.java:216)
            at android.app.Activity.onMenuItemSelected(Activity.java:2572)
            at android.support.v4.app.FragmentActivity.onMenuItemSelected(FragmentActivity.java:353)
            at android.support.v7.app.AppCompatActivity.onMenuItemSelected(AppCompatActivity.java:144)
            at android.support.v7.internal.view.WindowCallbackWrapper.onMenuItemSelected(WindowCallbackWrapper.java:99)
            at android.support.v7.internal.view.WindowCallbackWrapper.onMenuItemSelected(WindowCallbackWrapper.java:99)
            at android.support.v7.internal.app.ToolbarActionBar$2.onMenuItemClick(ToolbarActionBar.java:74)
            at android.support.v7.widget.Toolbar$1.onMenuItemClick(Toolbar.java:164)
            at android.support.v7.widget.ActionMenuView$MenuBuilderCallback.onMenuItemSelected(ActionMenuView.java:740)
            at android.support.v7.internal.view.menu.MenuBuilder.dispatchMenuItemSelected(MenuBuilder.java:802)
            at android.support.v7.internal.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:153)
            at android.support.v7.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:949)
            at android.support.v7.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:939)
            at android.support.v7.widget.ActionMenuView.invokeItem(ActionMenuView.java:598)
            at android.support.v7.internal.view.menu.ActionMenuItemView.onClick(ActionMenuItemView.java:139)
            at android.view.View.performClick(View.java:4084)
            at android.view.View$PerformClick.run(View.java:16989)
            at android.os.Handler.handleCallback(Handler.java:615)
            at android.os.Handler.dispatchMessage(Handler.java:92)
            at android.os.Looper.loop(Looper.java:137)
            at android.app.ActivityThread.main(ActivityThread.java:4812)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:511)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:792)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:559)
            at dalvik.system.NativeStart.main(Native Method)
    

    Based on that error, I change my theme to Theme.AppCompat and put this:

    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>
    

    to my theme. But it produce the same error.

    Style.xml (old)

    <resources>
    <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    </style>
    </resources>
    

    Style.xml (new)

    <resources>
    <style name="AppTheme" parent="Theme.AppCompat">
        <item name="windowActionBar">false</item>
        <item name="windowNoTitle">true</item>
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    </style>
    </resources>
    

    Anyone knows how to fix it??

    MainActivity.java

    package com.ramabmtr.map.findingmoo;
    
    import android.content.DialogInterface;
    import android.graphics.Typeface;
    import android.os.Bundle;
    import android.support.v4.widget.DrawerLayout;
    import android.support.v7.app.ActionBarDrawerToggle;
    import android.support.v7.app.AlertDialog;
    import android.support.v7.app.AppCompatActivity;
    import android.support.v7.widget.RecyclerView;
    import android.support.v7.widget.Toolbar;
    import android.view.View;
    import android.widget.TextView;
    import android.widget.Toast;
    
    public class MainActivity extends AppCompatActivity {
    
    private Toolbar toolbar;
    private TextView toolbarTitle;
    
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    
        toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);
        getSupportActionBar().setDisplayShowTitleEnabled(false);
    
        Typeface myTypeface = Typeface.createFromAsset(getAssets(), "fonts/panpizza.ttf");
        toolbarTitle = (TextView) findViewById(R.id.toolbar_title);
        toolbarTitle.setTypeface(myTypeface);
    
        AlertDialog.Builder builder = new AlertDialog.Builder(getApplicationContext());
        builder.setTitle(R.string.filter_title);
        builder.setMessage("test");
        builder.setPositiveButton(R.string.ok_button, new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int id) {
                dialog.dismiss();
            }
        });
        builder.setNegativeButton(R.string.cancel_button, new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int id) {
                dialog.dismiss();
            }
        });
        AlertDialog dialog = builder.create();
        dialog.show();
    }
    }
    
    Margrit Simon 2022-08-17
    How to move to previous caret position in Android Studio

    How can one move to previous caret position(s) in android studio? It was possible in Eclipse.

    Filibert Nosizwe 2022-08-16
    android - How to add dividers and spaces between items in RecyclerView

    This is an example of how it could have been done previously in the ListView class, using the divider and dividerHeight parameters:

    <ListView
        android:id="@+id/activity_home_list_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:divider="@android:color/transparent"
        android:dividerHeight="8dp"/>
    

    However, I don't see such possibility in the RecyclerView class.

    <android.support.v7.widget.RecyclerView
        android:id="@+id/activity_home_recycler_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:scrollbars="vertical"/>
    

    In that case, is it ok to define margins and/or add a custom divider view directly into a list item's layout or is there a better way to achieve my goal?

    Yitro Usman 2022-08-12
    Android: alternate layout xml for landscape mode

    How can I have one layout for landscape and one for portrait? I want to assume extra width and conserve vertical space when the user rotates the phone over sideways.

    Ganesh Quique 2022-08-16
    android - RelativeLayout is taking fullscreen for wrap_content

    Why does FOOBARZ get layed out all the way at the bottom when no elements are layout_height="fill_parent" in other words, all elements are wrap_content for height? enter image description here

    <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content">
        <TextView
            android:id="@+id/feed_u"
            android:layout_width="50dip"
            android:layout_height="50dip"
            android:layout_marginLeft="5dip"
            android:scaleType="centerCrop"
            android:drawableTop="@android:drawable/presence_online"
            android:text="U" />
        <RelativeLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_toRightOf="@id/feed_u">
            <ImageView
                android:id="@+id/feed_h"
                android:layout_alignParentRight="true"
                android:layout_alignParentTop="true"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:src="@android:drawable/btn_minus" />
            <ImageView
                android:id="@+id/feed_ha"
                android:layout_toLeftOf="@id/feed_h"
                android:layout_alignParentRight="true"
                android:layout_alignParentTop="true"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:src="@android:drawable/btn_plus" />
            <TextView
                android:id="@+id/feed_t"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Title">
            </TextView>
            <TextView
                android:id="@+id/feed_a"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Band"
                android:layout_below="@id/feed_t">
            </TextView>
            <TextView
                android:id="@+id/feed_s"
                android:layout_below="@id/feed_a"
                android:text="S"
                android:layout_height="wrap_content"
                android:layout_width="wrap_content">
            </TextView>
            <TextView
                android:id="@+id/feed_tm"
                android:layout_alignParentBottom="true"
                android:layout_alignParentRight="true"
                android:text="FOOBARZ"
                android:layout_height="wrap_content"
                android:layout_width="wrap_content">
            </TextView>
    
        </RelativeLayout>
    </RelativeLayout>
    
    Sveinn Erland 2022-08-16
    Error: Unfortunately you can't have non-Gradle Java modules and > Android-Gradle modules in one project

    I have an IntelliJ 14.1.2 Project consisting of two modules - one is an Android Gradle based module and the other is a Spring Java-based module with Maven.

    gps-trackman.v1 is my root project and I've not configured any outputs or facets for this project. The app is my android gradle module and I've configured Android and Android-Gradle Facet for this project and gps-trackman isn't my Spring Maven Project. I want to be able to build everything all together. Is it possible?

    I now get this error message in my IntelliJ Eventlog

    Unsupported Modules Detected: Compilation is not supported for following modules: gps-trackman, gps-trackman.v1, app. Unfortunately you can't have non-Gradle Java modules and Android-Gradle modules in one project.

    The project 'gps-trackman.v1' is not a Gradle-based

    Is this error just due to a misconfiguration of my project or is it really not possible to have a maven module and a Gradle module in one project?

    Do I have to configure any Facets for the root project? Alternatively, do I have to convert my maven to gradle?

    Krystle Müjgan 2022-08-14
    java - Android gives error "Cannot fit requested classes in a single dex file"

    I don't know why but it's impossible to launch my app on my mobile this morning. I get this error message:

    Cannot fit requested classes in a single dex file. Try supplying a main-dex list.

    # methods: 68061 > 65536 Message{kind=ERROR, text=Cannot fit requested classes in a single dex file. Try supplying a main-dex list.

    # methods: 68061 > 65536, sources=[Unknown source file], tool

    I'm really new to Android and I don't understand the problem and what I need to do? And why I get this problem now and not before?

    Winnie Zubin 2022-08-17
    Is there a convenient way to create Parcelable data classes in Android with Kotlin?

    I'm currently using the excellent AutoParcel in my Java project, which facilitates the creation of Parcelable classes.

    Now, Kotlin, which I consider for my next project, has this concept of data classes, that automatically generate the equals, hashCode and toString methods.

    Is there a convenient way to make a Kotlin data class Parcelable in a convenient way (without implementing the methods manually)?

    Jana Lailoken 2022-08-15
    android - How to set RecyclerView app:layoutManager="" from XML?

    How to set RecyclerView layoutManager from XML?

        <android.support.v7.widget.RecyclerView
            app:layoutManager="???"
            android:layout_width="match_parent"
            android:layout_height="match_parent"/>
    
    Elise Pankaj 2022-08-15
    gitlab ci - Android Command line tools sdkmanager always shows: Warning: Could not create settings

    I use the new command line tools for Android because the old sdk-tools repository of Android isn't available anymore. So I changed my gitlab-ci to load the commandlintools. But when I try to run it I get the following error:

    Warning: Could not create settings
    java.lang.IllegalArgumentException
        at com.android.sdklib.tool.sdkmanager.SdkManagerCliSettings.<init>(SdkManagerCliSettings.java:428)
        at com.android.sdklib.tool.sdkmanager.SdkManagerCliSettings.createSettings(SdkManagerCliSettings.java:152)
        at com.android.sdklib.tool.sdkmanager.SdkManagerCliSettings.createSettings(SdkManagerCliSettings.java:134)
        at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:57)
        at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:48)
    

    I already tried executing those commandy by hand, but I get the same error. Also if I run sdkmanager --version, the same error occurs. My gitlab-ci looks like:

    image: openjdk:9-jdk
    
    variables:
      ANDROID_COMPILE_SDK: "29"
      ANDROID_BUILD_TOOLS: "29.0.3"
      ANDROID_SDK_TOOLS:   "6200805"
    
    before_script:
      - apt-get --quiet update --yes
      - apt-get --quiet install --yes wget tar unzip lib32stdc++6 lib32z1
      - wget --quiet --output-document=android-sdk.zip https://dl.google.com/android/repository/commandlinetools-linux-${ANDROID_SDK_TOOLS}_latest.zip
      - unzip -d android-sdk-linux android-sdk.zip
      - echo y | android-sdk-linux/tools/bin/sdkmanager "platform-tools" "platforms;android-${ANDROID_COMPILE_SDK}" >/dev/null
      #- echo y | android-sdk-linux/tools/bin/sdkmanager "platform-tools" >/dev/null
      - echo y | android-sdk-linux/tools/bin/sdkmanager "build-tools;${ANDROID_BUILD_TOOLS}" >/dev/null
      - export ANDROID_HOME=$PWD/android-sdk-linux
      - export PATH=$PATH:$PWD/android-sdk-linux/platform-tools/
      - chmod +x ./gradlew
      # temporarily disable checking for EPIPE error and use yes to accept all licenses
      - set +o pipefail
      - yes | android-sdk-linux/tools/bin/sdkmanager --licenses
      - set -o pipefail
    
    stages:
      - build
      - test
    
    lintDebug:
      stage: build
      script:
        - ./gradlew -Pci --console=plain :app:lintDebug -PbuildDir=lint
    
    assembleDebug:
      stage: build
      script:
        - ./gradlew assembleDebug
      artifacts:
        paths:
        - app/build/outputs/
    
    debugTests:
      stage: test
      script:
        - ./gradlew -Pci --console=plain :app:testDebug
    
    Kyle Elkins 2022-08-15
    stringtokenizer - Convert time value to format “hh:mm Am/Pm” using Android

    I am getting date value from database like "2013-02-27 06:06:30" using StringTokenizer I will get time separately like below

    String startTime = "2013-02-27 06:06:30";
    
    StringTokenizer token = new StringTokenizer(startTime);
    String date1 = token.nextToken();  
    String time1 = token.nextToken(); 
    

    and in time1 I am getting the result 06:06:30,

    Can I re-store it in another variable of type String as follows?

    String displayValue = "06:06 AM";
    

    And if time1 variable has the value of

    String time = 16:00:00;
    

    then it should be converted to:

    String displayValue = "04:00 PM";
    
    Helle Sigrid 2022-08-21
    android - Build and Install unsigned apk on device without the development server?

    As I am new in react-native so if there is anything wrong in steps let me know.

    I have build a react native android app using the command as per documentation

    react-native android

    while running on device the following command was used

    react-native run-android

    which gives me the output of 2 apk files in my projectfolder/android/app/build/outputs/apk

    enter image description here

    now when I use to install this apk after the installation it ask for an development server to connect to bundle the JS. But my requirement is that the user doesn't have to struggle with the development server just he needs to install the apk and everything is done.

    Have gone through some stackoverflow Questions but not helpful to build unsigned apk which doesn't require development server.

    Can you guys help me finding the way that how to build and unsigned apk in react native?

    Beatrycze Luc 2022-08-15
    java - How can I give an imageview click effect like a button on Android?

    I have imageview in my Android app that I am using like a button with the onClick event given, but as you might guess it is not giving imageview a clickable effect when clicked. How can I achieve that?

    Markos Agatha 2022-08-17
    What is the difference between background, backgroundTint, backgroundTintMode attributes in android layout xml?

    While working with the android layout xml I came across backgroundTint attribute . I don't understand what is for.

    Also what is backgroundTintMode ??

    Urbain Vidar 2022-08-16
    android - onActivityResult() & onResume()

    Could someone tell me which gets called first, is it onActivityResult() or is it onResume()? Example:

    Activity A calls startActivityForResult() to start Activity B. B executes, completes and returns a result to A, but which method of A is called first, onActivityResult() or onResume()?

    I know someone has answered this question already by referring to the Activity Docs, however I couldn't find in there myself.

    Laxmi Queenie 2022-08-16
    java - How to send data from DialogFragment to a Fragment?

    I have a fragment that opens a Dialogfragment to get user input (a string, and an integer). How do I send these two things back to the fragment?

    Here is my DialogFragment:

    public class DatePickerFragment extends DialogFragment {
        String Month;
        int Year;
    
        @Override
        public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
            getDialog().setTitle(getString(R.string.Date_Picker));
            View v = inflater.inflate(R.layout.date_picker_dialog, container, false);
    
            Spinner months = (Spinner) v.findViewById(R.id.months_spinner);
            ArrayAdapter<CharSequence> monthadapter = ArrayAdapter.createFromResource(getActivity(),
                    R.array.Months, R.layout.picker_row);
                  months.setAdapter(monthadapter);
                  months.setOnItemSelectedListener(new OnItemSelectedListener(){
                      @Override
                      public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int monthplace, long id) {
                          Month = Integer.toString(monthplace);
                      }
                      public void onNothingSelected(AdapterView<?> parent) {
                        }
                  });
    
            Spinner years = (Spinner) v.findViewById(R.id.years_spinner);
            ArrayAdapter<CharSequence> yearadapter = ArrayAdapter.createFromResource(getActivity(),
                 R.array.Years, R.layout.picker_row);
            years.setAdapter(yearadapter);
            years.setOnItemSelectedListener(new OnItemSelectedListener(){
              @Override
              public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int yearplace, long id) {
                  if (yearplace == 0){
                      Year = 2012;
                  }if (yearplace == 1){
                      Year = 2013;
                  }if (yearplace == 2){
                      Year = 2014;
                  }
              }
              public void onNothingSelected(AdapterView<?> parent) {}
            });
    
            Button button = (Button) v.findViewById(R.id.button);
            button.setOnClickListener(new View.OnClickListener() {
               public void onClick(View v) {
                   getDialog().dismiss();
                }
            });
    
            return v;
        }
    }
    

    I need to send the data after the button click and before getDialog().dismiss()

    Here is the fragment that data needs to be sent to:

    public class CalendarFragment extends Fragment {
    int Year;
    String Month;
    
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    
        int position = getArguments().getInt("position");
        String[] categories = getResources().getStringArray(R.array.categories);
        getActivity().getActionBar().setTitle(categories[position]);
        View v = inflater.inflate(R.layout.calendar_fragment_layout, container, false);    
    
        final Calendar c = Calendar.getInstance();
        SimpleDateFormat month_date = new SimpleDateFormat("MMMMMMMMM");
        Month = month_date.format(c.getTime());
        Year = c.get(Calendar.YEAR);
    
        Button button = (Button) v.findViewById(R.id.button);
        button.setText(Month + " "+ Year);
        button.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
               new DatePickerFragment().show(getFragmentManager(), "MyProgressDialog");
            }
        });
       return v;
      }
    }
    

    so once the user selects a date in the Dialogfragment, it must return the month and year.

    Then, the text on the button should change to the month and year specified by user.

    Mandlenkosi Shantelle 2022-08-20
    Fullscreen Activity in Android?

    How do I make an activity full screen? Without the notification bar.

    Ibrahim Yaron 2022-08-14
    How to use android canvas to draw a Rectangle with only topleft and topright corners round?

    I found a function for rectangles with all 4 corners being round, but I want to have just the top 2 corners round. What can I do?

    canvas.drawRoundRect(new RectF(0, 100, 100, 300), 6, 6, paint);
    
    Salvatrix Ngải 2022-08-18
    android - Couldn't resolve resource @id/visible when using TextInputLayout

    Couldn't resolve resource @id/visible when using TextInputLayout on appcompat-v7:25.x.x

    Tried these steps below, but the problem is still persist:

    1. Rebuild Project
    2. Clean and Rebuild Project
    3. Clear Cache and Restart Android Studio

    Below is the code in the layout file.

        <android.support.design.widget.TextInputLayout
                android:id="@+id/tilFirstName"
                android:layout_width="match_parent"
                android:layout_height="wrap_content">
    
                <android.support.design.widget.TextInputEditText
                    android:id="@+id/etFirstName"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:hint="@string/first_name"
                    android:inputType="textPersonName"/>
        </android.support.design.widget.TextInputLayout>
    

    Below is the message displayed in Android Studio

    Rendering Problems.

    Couldn't resolve resource @id/visible

    Tip: Try to refresh the layout.

    NOTE: @id/visible is not present in the code.

    Sisu Célio 2022-08-17
    Duplicate ID, tag null, or parent id with another fragment for com.google.android.gms.maps.MapFragment

    I have an application with three tabs.

    Each tab has its own layout .xml file. The main.xml has its own map fragment. It's the one that shows up when the application first launches.

    Everything works fine except for when I change between tabs. If I try to switch back to the map fragment tab, I get this error. Switching to and between other tabs works just fine.

    What could be wrong here?

    This is my main class and my main.xml, as well as a relevant class that I use ( you will also find the error log at the bottom )

    main class

    package com.nfc.demo;
    
    import android.app.ActionBar;
    import android.app.ActionBar.Tab;
    import android.app.Activity;
    import android.app.Fragment;
    import android.app.FragmentTransaction;
    import android.os.Bundle;
    import android.widget.Toast;
    
    public class NFCDemoActivity extends Activity {
    
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
    
            ActionBar bar = getActionBar();
            bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
            bar.setDisplayOptions(0, ActionBar.DISPLAY_SHOW_TITLE);
    
            bar.addTab(bar
                    .newTab()
                    .setText("Map")
                    .setTabListener(
                            new TabListener<MapFragment>(this, "map",
                                    MapFragment.class)));
            bar.addTab(bar
                    .newTab()
                    .setText("Settings")
                    .setTabListener(
                            new TabListener<SettingsFragment>(this, "settings",
                                    SettingsFragment.class)));
            bar.addTab(bar
                    .newTab()
                    .setText("About")
                    .setTabListener(
                            new TabListener<AboutFragment>(this, "about",
                                    AboutFragment.class)));
    
            if (savedInstanceState != null) {
                bar.setSelectedNavigationItem(savedInstanceState.getInt("tab", 0));
            }
            // setContentView(R.layout.main);
    
        }
    
        @Override
        protected void onSaveInstanceState(Bundle outState) {
            super.onSaveInstanceState(outState);
            outState.putInt("tab", getActionBar().getSelectedNavigationIndex());
        }
    
        public static class TabListener<T extends Fragment> implements
                ActionBar.TabListener {
            private final Activity mActivity;
            private final String mTag;
            private final Class<T> mClass;
            private final Bundle mArgs;
            private Fragment mFragment;
    
            public TabListener(Activity activity, String tag, Class<T> clz) {
                this(activity, tag, clz, null);
            }
    
            public TabListener(Activity activity, String tag, Class<T> clz,
                    Bundle args) {
                mActivity = activity;
                mTag = tag;
                mClass = clz;
                mArgs = args;
    
                // Check to see if we already have a fragment for this tab,
                // probably from a previously saved state. If so, deactivate
                // it, because our initial state is that a tab isn't shown.
                mFragment = mActivity.getFragmentManager().findFragmentByTag(mTag);
                if (mFragment != null && !mFragment.isDetached()) {
                    FragmentTransaction ft = mActivity.getFragmentManager()
                            .beginTransaction();
                    ft.detach(mFragment);
                    ft.commit();
                }
            }
    
            public void onTabSelected(Tab tab, FragmentTransaction ft) {
                if (mFragment == null) {
                    mFragment = Fragment.instantiate(mActivity, mClass.getName(),
                            mArgs);
                    ft.add(android.R.id.content, mFragment, mTag);
                } else {
                    ft.attach(mFragment);
                }
            }
    
            public void onTabUnselected(Tab tab, FragmentTransaction ft) {
                if (mFragment != null) {
                    ft.detach(mFragment);
                }
            }
    
            public void onTabReselected(Tab tab, FragmentTransaction ft) {
                Toast.makeText(mActivity, "Reselected!", Toast.LENGTH_SHORT)
                             .show();
            }
        }
    
    }
    

    main.xml

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical" >
    
        <fragment
            xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@+id/mapFragment"
            android:name="com.google.android.gms.maps.MapFragment"
            android:layout_width="match_parent"
            android:layout_height="match_parent" />
    </LinearLayout>
    

    relevant class ( MapFragment.java )

    package com.nfc.demo;
    
    import android.app.Fragment;
    import android.os.Bundle;
    import android.view.LayoutInflater;
    import android.view.View;
    import android.view.ViewGroup;
    
    public class MapFragment extends Fragment {
    
        @Override
        public View onCreateView(LayoutInflater inflater, ViewGroup container,
                Bundle savedInstanceState) {
            super.onCreateView(inflater, container, savedInstanceState);
            return inflater.inflate(R.layout.main, container, false);
        }
    
        public void onDestroy() {
            super.onDestroy();
        }
    }
    

    error

    android.view.InflateException: Binary XML file line #7: 
         Error inflating class fragment
       at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
       at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
       at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
       at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
       at com.nfc.demo.MapFragment.onCreateView(MapFragment.java:15)
       at android.app.Fragment.performCreateView(Fragment.java:1695)
       at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:885)
       at android.app.FragmentManagerImpl.attachFragment(FragmentManager.java:1255)
       at android.app.BackStackRecord.run(BackStackRecord.java:672)
       at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1435)
       at android.app.FragmentManagerImpl$1.run(FragmentManager.java:441)
       at android.os.Handler.handleCallback(Handler.java:725)
       at android.os.Handler.dispatchMessage(Handler.java:92)
       at android.os.Looper.loop(Looper.java:137)
       at android.app.ActivityThread.main(ActivityThread.java:5039)
       at java.lang.reflect.Method.invokeNative(Native Method)
       at java.lang.reflect.Method.invoke(Method.java:511)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
       at dalvik.system.NativeStart.main(Native Method)
    
    Caused by: java.lang.IllegalArgumentException: 
         Binary XML file line #7: Duplicate id 0x7f040005, tag null, or 
         parent id 0xffffffff with another fragment for 
         com.google.android.gms.maps.MapFragment
       at android.app.Activity.onCreateView(Activity.java:4722)
       at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:680)
       ... 19 more
    
    Shayne Misti 2022-08-14
    android - How can I make sticky headers in RecyclerView? (Without external lib)

    I want to fix my header views in the top of the screen like in the image below and without using external libraries.

    enter image description here

    In my case, I don't want to do it alphabetically. I have two different types of views (Header and normal). I only want to fix to the top, the last header.

    Justice Nafiset 2022-08-15
    java - Is it possible to use VectorDrawable in Buttons and TextViews using android:DrawableRight?

    When I use VectorDrawable assets in a textview or imageview I get a runtime crash when using "android:DrawableRight" / "android:DrawableEnd" / "android:DrawableStart" / "android:DrawableLeft".

    The app will compile fine without any warnings.

    I am using

    • Gradle 1.5
    • Support Library 23.2 ('com.android.support:appcompat-v7:23.2.0')

    What I have found though is that I can programmatically assign SVG's in Java without crashes like this.

    TextView tv = (TextView) findViewById(R.id.textView);
    tv.setCompoundDrawablesWithIntrinsicBounds(null,null, getResources().getDrawable(R.drawable.ic_accessible_white_36px),null);
    

    (I suspect this is a support library bug for 23.2.)

    But is it possible to use drawableRight etc for SVG assets ?

    Here is my layout

    <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:paddingBottom="@dimen/activity_vertical_margin"
        android:paddingLeft="@dimen/activity_horizontal_margin"
        android:paddingRight="@dimen/activity_horizontal_margin"
        android:paddingTop="@dimen/activity_vertical_margin"
        tools:context="au.com.angryitguy.testsvg.MainActivity">
    
    
    <TextView
        android:id="@+id/textView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:drawableRight="@drawable/ic_accessible_white_36px"
        android:background="@color/colorPrimary"
        android:textColor="#FFFFFF"
        android:textSize="22sp"
        android:text="Hello World!"/>
    </RelativeLayout>
    

    Here is my Activity

    package au.com.angryitguy.testsvg;
    
    import android.content.Intent;
    import android.support.v7.app.AppCompatActivity;
    import android.os.Bundle;
    import android.view.View;
    import android.widget.Button;
    
    public class MainActivity extends AppCompatActivity {
    
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
    
            }
        }
    

    Here is the unmodified VectorDrawable asset from Google's material design site.

    <vector android:height="24dp" android:viewportHeight="24.0"
        android:viewportWidth="24.0" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
        <path android:fillColor="#FFFFFF" android:pathData="M12,4m-2,0a2,2 0,1 1,4 0a2,2 0,1 1,-4 0"/>
        <path android:fillColor="#FFFFFF" android:pathData="M19,13v-2c-1.54,0.02 -3.09,-0.75 -4.07,-1.83l-1.29,-1.43c-0.17,-0.19 -0.38,-0.34 -0.61,-0.45 -0.01,0 -0.01,-0.01 -0.02,-0.01L13,7.28c-0.35,-0.2 -0.75,-0.3 -1.19,-0.26C10.76,7.11 10,8.04 10,9.09L10,15c0,1.1 0.9,2 2,2h5v5h2v-5.5c0,-1.1 -0.9,-2 -2,-2h-3v-3.45c1.29,1.07 3.25,1.94 5,1.95zM12.83,18c-0.41,1.16 -1.52,2 -2.83,2 -1.66,0 -3,-1.34 -3,-3 0,-1.31 0.84,-2.41 2,-2.83L9,12.1c-2.28,0.46 -4,2.48 -4,4.9 0,2.76 2.24,5 5,5 2.42,0 4.44,-1.72 4.9,-4h-2.07z"/>
    </vector>
    

    Here is my app build.gradle

    apply plugin: 'com.android.application'
    
    android {
        compileSdkVersion 23
        buildToolsVersion "23.0.2"
    
        defaultConfig {
            applicationId "au.com.angryitguy.testsvg"
            minSdkVersion 16
            targetSdkVersion 23
            versionCode 1
            versionName "1.0"
            // Stops the Gradle plugin’s automatic rasterization of vectors
            generatedDensities = []
        }
        // Flag to tell aapt to keep the attribute ids around
        aaptOptions {
            additionalParameters "--no-version-vectors"
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
    }
    
    dependencies {
        compile fileTree(dir: 'libs', include: ['*.jar'])
        testCompile 'junit:junit:4.12'
        compile 'com.android.support:appcompat-v7:23.2.0'
    }
    

    Here is the crash. (Note the inflate errors that reference the textview.)

    java.lang.RuntimeException: Unable to start activity ComponentInfo{
        au.com.angryitguy.testsvg/au.com.angryitguy.testsvg.MainActivity}: 
        android.view.InflateException: Binary XML file line #13: 
        Error inflating class TextView
    
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
    at android.app.ActivityThread.access$600(ActivityThread.java:130)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:137)
    at android.app.ActivityThread.main(ActivityThread.java:4745)
    ...
    
    Caused by: android.view.InflateException: 
        Binary XML file line #13: Error inflating class TextView
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
    at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:267)
    at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:129)
    at au.com.angryitguy.testsvg.MainActivity.onCreate(MainActivity.java:14)
    at android.app.Activity.performCreate(Activity.java:5008)
    ...
    
    Caused by: android.content.res.Resources$NotFoundException: 
        File res/drawable/ic_accessible_white_36px.xml from drawable resource ID #0x7f02004b
    at android.content.res.Resources.loadDrawable(Resources.java:1918)
    at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
    at android.widget.TextView.<init>(TextView.java:622)
    at android.support.v7.widget.AppCompatTextView.<init>(AppCompatTextView.java:60)
    at android.support.v7.widget.AppCompatTextView.<init>(AppCompatTextView.java:56)
    at android.support.v7.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:103)
    at android.support.v7.app.AppCompatDelegateImplV7.createView(AppCompatDelegateImplV7.java:963)
    at android.support.v7.app.AppCompatDelegateImplV7.onCreateView(AppCompatDelegateImplV7.java:1022)
    at android.support.v4.view.LayoutInflaterCompatHC$FactoryWrapperHC.onCreateView(LayoutInflaterCompatHC.java:44)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:675)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:746) 
    at android.view.LayoutInflater.inflate(LayoutInflater.java:489) 
    at android.view.LayoutInflater.inflate(LayoutInflater.java:396) 
    at android.view.LayoutInflater.inflate(LayoutInflater.java:352) 
    at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:267) 
    at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:129) 
    at au.com.angryitguy.testsvg.MainActivity.onCreate(MainActivity.java:14) 
    at android.app.Activity.performCreate(Activity.java:5008) 
    ...
    
    Caused by: org.xmlpull.v1.XmlPullParserException:
        Binary XML file line #1: invalid drawable tag vector
    at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:877)
    at android.graphics.drawable.Drawable.createFromXml(Drawable.java:818)
    at android.content.res.Resources.loadDrawable(Resources.java:1915)
    at android.content.res.TypedArray.getDrawable(TypedArray.java:601) 
    at android.widget.TextView.<init>(TextView.java:622) 
    at android.support.v7.widget.AppCompatTextView.<init>(AppCompatTextView.java:60) 
    at android.support.v7.widget.AppCompatTextView.<init>(AppCompatTextView.java:56) 
    at android.support.v7.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:103) 
    at android.support.v7.app.AppCompatDelegateImplV7.createView(AppCompatDelegateImplV7.java:963) 
    at android.support.v7.app.AppCompatDelegateImplV7.onCreateView(AppCompatDelegateImplV7.java:1022) 
    at android.support.v4.view.LayoutInflaterCompatHC$FactoryWrapperHC.onCreateView(LayoutInflaterCompatHC.java:44) 
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:675) 
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:746) 
    at android.view.LayoutInflater.inflate(LayoutInflater.java:489) 
    at android.view.LayoutInflater.inflate(LayoutInflater.java:396) 
    at android.view.LayoutInflater.inflate(LayoutInflater.java:352) 
    at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:267) 
    at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:129) 
    at au.com.angryitguy.testsvg.MainActivity.onCreate(MainActivity.java:14) 
    at android.app.Activity.performCreate(Activity.java:5008) 
    ...
    
    Pāvils Philomena 2022-08-16
    ERROR :rendering problems The following classes could not be found android.support.v7.internal.widget.ActionBarOverlayLayout

    I am just a beginner to android app development. When i created a new project on Android Studio 1.1.0, it gives up this error "rendering problems The following classes could not be found android.support.v7.internal.widget.ActionBarOverlayLayout"

    Now i have searched about this on google, and i found possibly 3 solutions given by most of the people.

    They say:

    1. Either change the api (from preview window pane) from 22 to 21, or

    2. Change the App Theme from "Project Theme" to any other theme.

    3. be sure to have imported right appcompat-v7 library in your project structure -> dependencies, Refer these steps: Add the support library feature project identifier to the dependencies section. For example, to include the appcompat project add compile "com.android.support:appcompat-v7:18.0.+" to the dependencies section, as shown in the following example:

    dependencies {
        ...
        compile "com.android.support:appcompat-v7:18.0.+" }
    

    Note: My android support lib is up-to-date (installed it using SDK Manager).

    Following first two steps, removed the error. But I feel that these are not the permanent solutions, the Second step seems just like a temporary workaround. I have doubts about the First step also, that if to remove the error, we change api from 22 to 21, then at the end, our app wont work in Android 5.1.1(API 22), it would be restricted to Android 5.0.1 and below only (API 21). Are my doubts valid? Regarding the third step, is it the permanent solution to this problem?

    P.S : Sorry for mismatching tags, wasn't allowed to add exact tags due to site reputation

    Zaxaria Geirr 2022-08-17
    Is there an example of how to use a TouchDelegate in Android to increase the size of a view's click target?

    My understanding is that when you have a view that's too small to easily touch, you're supposed to use a TouchDelegate to increase the clickable region for that view.

    However, searching for usage examples on Google turn up multiple people asking the question, but few answers.

    Does anyone know the proper way to set up a touch delegate for a view to, say, increase its clickable region by 4 pixels in every direction?

    Pétur Gulnara 2022-08-17
    android - how to change color of textview hyperlink?

    I am using this code for hyperlink:

    <TextView 
        android:layout_width="fill_parent" 
        android:layout_height="fill_parent" 
        android:id="@+id/hyperlink" 
        android:text="@string/hyperlink"
        android:autoLink="web"/>
    

    By default it is showing blue color, but how do I change color of hyperlink in Android?

    Victor Wenceslaus 2022-08-14
    android - How can I put a ListView into a ScrollView without it collapsing?

    I've searched around for solutions to this problem, and the only answer I can find seems to be "don't put a ListView into a ScrollView". I have yet to see any real explanation for why though. The only reason I can seem to find is that Google doesn't think you should want to do that. Well I do, so I did.

    So the question is, how can you place a ListView into a ScrollView without it collapsing to its minimum height?

    Edna Morgen 2022-08-14
    how can I add the aidl file to Android studio (from the in-app billing example)

    I am currently migrating an Eclipse app to Android Studio. This app was using the in app billing.

    My main problem is to compile the project and the aidl file (I guess you all use this file)

    I get this error message:

    Gradle: error: cannot find symbol class IInAppBillingService
    Gradle: error: package IInAppBillingService does not exist
    

    So, following some tutorials, I move this file from com.mypackage.billing to src/main/aidl (see this reference)

    But as soon, as I do that, I get this message:

    Gradle: Execution failed for task ':xxxxxxxxxxx:compileDebugAidl'.

    Failed to run command: (...) C:\Users\xxxx\AndroidStudioProjects\xxxxxxProject\xxxxxxx\src\main\aidl\IInAppBillingService.aidl:45 interface IInAppBillingService should be declared in a file called com\xxxxxxxx\billing\IInAppBillingService.aidl.

    The message is clearly a contradiction with the post from the Google bug page I linked above.

    Anyone suceeded to make this aidl file to work and can help me?

    enter image description here

    Just to inform, some links I followed:

    • http://tools.android.com/tech-docs/new-build-system/user-guide
    • http://developer.android.com/guide/components/aidl.html
    Margrit Simon 2022-08-15