android-lint

@IntDef annotation and return value from other's code that cannot be annotated or how to temporarily disable annotation from affecting the code?

安稳与你 提交于 2019-12-22 03:51:06
问题 I am using IntDef from Android Support annotation in my code (but my question is wider in scope so please keep reading :) like this: public class UiLockMode { @IntDef({DEFAULT, NONE, VISIBLE, TRANSPARENT}) @Retention(RetentionPolicy.SOURCE) public @interface AllowedValues {} public static final int DEFAULT = 0; public static final int NONE = 1; public static final int VISIBLE = 2; public static final int TRANSPARENT = 3; } Next, I got some other methods annotated with it like this: protected

Warning: This <FrameLayout> can be replaced with a <merge> tag

青春壹個敷衍的年華 提交于 2019-12-20 17:33:18
问题 I have a FrameLayout that contains a TextView and two LinearLayout s: <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" > ... a textview and 2 linearlayouts </FrameLayout> After running Android Lint, I get this warning: This <FrameLayout> can be replaced with a <merge> tag. Why does this warning exist? What can I do to fix it (other than ignore)? 回答1: To understand this, you need to understand how

How to enable lint error in Android Studio for message “Call requires API level 21 (current min is 16)”?

放肆的年华 提交于 2019-12-19 07:49:28
问题 I have a method called setImageTintList() that requires min API to be 21. But, if I set my min API to 16 in gradle, the app still builds without any warning. Although there is a red line saying: setImageTintList() - Call requires API level 21 (current min is 16) it does not show any warning, error or compile error. How can I set the lint warning level in android studio such that it will error out and possibly prevent the build in cases like this? 回答1: It appears the Android's gradle plugin

How to solve this : 'Running android lint' issue

那年仲夏 提交于 2019-12-17 23:32:54
问题 In any activity of my project, if i do some changes and then save that activity i got the message "Running android lint has encountered a problem." This is the my error log : java.lang.NullPointerException at com.android.ide.eclipse.adt.AdtUtils.workspacePathToFile(AdtUtils.java:466) at com.android.ide.eclipse.adt.internal.lint.EclipseLintClient.getClassPath(EclipseLintClient.java:753) at com.android.tools.lint.client.api.LintClient.getJavaClassFolders(LintClient.java:198) at com.android

Meaning of “No label views point to this text field” warning message

廉价感情. 提交于 2019-12-17 18:27:33
问题 What is the meaning of this warning? No label views point to this text field with an android:labelFor="@ id/@ id/editText1" attribute Note that the double id ( @id/@id ) is a problem with the error message text and does not reflect the XML content (which is the correct syntax). 回答1: The labelFor is an attribute for accessibility options. You assign this to a label so that if, on a form , user clicks a textedit field , android can know what to read (TalkBack) to user. The id you assigned to it

What is “android:allowBackup”?

扶醉桌前 提交于 2019-12-17 06:58:06
问题 Since the new ADT preview version (version 21), they have a new lint warning that tells me the next thing on the manifest file (in the application tag): Should explicitly set android:allowBackup to true or false (it's true by default, and that can have some security implications for the application's data) In the official website, they've written: A couple of new checks: you must explicitly decide whether your app allows backups, and a label check. There's a new command line flag for setting

Explain ClickableViewAccessibility

萝らか妹 提交于 2019-12-12 11:32:40
问题 Concerning the SO swipe code, Android lint gave the warning OnSwipeTouchListener#onTouch should call View#performClick when a click is detected [ClickableViewAccessibility] In the description of the warning, it says: If a View that overrides onTouchEvent or uses an OnTouchListener does not also implement performClick and call it when clicks are detected, the View may not handle accessibility actions properly. Logic handling the click actions should ideally be placed in View#performClick as

Understanding @SuppressLint(“NewApi”) annotation

点点圈 提交于 2019-12-12 07:09:51
问题 I am an android beginner. While trying a code of managing activity life cycle, I encountered a new thing. package com.example.activitylaunch; import android.os.Build; import android.os.Bundle; import android.annotation.SuppressLint; import android.app.ActionBar; import android.app.Activity; import android.view.Menu; import android.widget.TextView; @SuppressLint("NewApi") public class MainActivity extends Activity { TextView mTextView; @Override protected void onCreate(Bundle

How does setting baselineAligned to false improve performance in LinearLayout?

余生长醉 提交于 2019-12-12 07:08:13
问题 I was just building some UI in xml, and Lint gave me a warning and said to set android:baselineAligned to false to improve performance in ListView. The docs for the Lint changes that added this warning say Layout performance: Finds LinearLayouts with weights where you should set android:baselineAligned="false" for better performance, and also finds cases where you have nested weights which can cause performance problems. Can somebody explain why this improves performance, specifically when

Android Lint Tool

前提是你 提交于 2019-12-11 07:16:09
问题 I have updated my Android SDK to Revision 16 but I can't seem to find Android Lint anywhere in my Eclipse IDE (Preferences -> Android). Are there any additional things to be done? I need some help. Thanks. 回答1: Ensure you installed it firstly, by checking pulgins installed. Then right click the project, go android tools, there is a "Run Lint" 回答2: If there is no menu point in eclipse ( Window -> Run Android Lint ), chances are that you only upgraded your Android SDK and not the eclipse plugin