小编Jar*_*ows的帖子

不推荐使用espresso contrib的openDrawer

com.android.support.test.espresso:espresso-contrib:2.2.1不推荐使用Espresso contrib()openDrawer方法

那怎么我打开一个抽屉?

android automated-tests open-source android-testing android-espresso

20
推荐指数
1
解决办法
4304
查看次数

如何阻止处理程序?

我有一个疑问..我的应用程序中有一个活动的人.虽然我的活动破坏了处理程序仍在运行.它是否在应用程序进程以外的其他进程上运行?任何人都可以解释为什么它的工作方式如此?是否有可能在onDestroy活动时停止处理程序?

提前致谢.

android

19
推荐指数
2
解决办法
3万
查看次数

Android Robolectric点击RecyclerView项目

有没有办法RecyclerView用Robolectric 模拟项目上的点击?

到目前为止,我已经尝试View了第一个可见的位置RecyclerView,但这始终是null.它getChildCount()不断回归0,而且findViewHolderForPosition永远都是null.适配器返回一个非0数字getItemCount()(适配器中肯定有项目).

我正在使用Robolectric 2.4 SNAPSHOT.

android robolectric android-recyclerview

19
推荐指数
2
解决办法
4948
查看次数

如何取消特定的Kotlinc / Javac编译器警告?

如何抑制deprecationsKotlinCompileGradle类似JavaCompile

JavaCompile(有效):

tasks.withType(JavaCompile) {
    configure(options) {
        compilerArgs << '-Xlint:-deprecation'
    }
}
Run Code Online (Sandbox Code Playgroud)

KotlinCompile(无效):

tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile) {
    kotlinOptions {
        freeCompilerArgs = ["-Xjavac-arguments=-Xlint:-deprecation"]
    }
}
Run Code Online (Sandbox Code Playgroud)

参考文献:

类似问题:

java gradle kotlin

18
推荐指数
1
解决办法
660
查看次数

如何使用Gradle抑制"警告:忽略匿名内部类的InnerClasses属性"?

如何使用Gradle抑制"警告:忽略匿名内部类的InnerClasses属性"?

  • 这不是一个重复的问题
  • 这不是在Proguard期间,我也不想压制使用Proguard
  • 我想抑制正常./gradlew assembleDebug (因为这是assertj-core- ./gradlew testDebug)

相关性:

dependencies {
   testCompile "org.assertj:assertj-core:1.7.1"
}
Run Code Online (Sandbox Code Playgroud)

警告:

Dex: warning: Ignoring InnerClasses attribute for an anonymous inner class
(org.assertj.core.internal.cglib.reflect.FastClassEmitter$3) that doesn't come with an
associated EnclosingMethod attribute. This class was probably produced by a
compiler that did not target the modern .class file format. The recommended
solution is to recompile the class from source, using an up-to-date compiler
and without specifying any "-target" type options. The consequence of ignoring …
Run Code Online (Sandbox Code Playgroud)

java android javac gradle android-gradle-plugin

16
推荐指数
1
解决办法
1268
查看次数

如何检查对程序的引用是否为零?

在以下示例中,调用将AssertTestObj()导致访问冲突.

Project InvokeTest2.exe引发异常类$ C0000005,并显示消息'0x00000000访问冲突:读取地址0x00000000'.

在调试时我可以看到Assigned(NotifyProc)测试中TSafeCall<T>.Invoke()没有按预期工作 - 因此Invoke()尝试执行NotifyProc哪个nil因此导致访问冲突.

任何想法为什么失败以及如何解决它?

program InvokeTest2;

{$APPTYPE CONSOLE}

uses
  System.SysUtils;

type
  TSafeCall<T> = class
  public
    type
      TNotifyProc = reference to procedure (Item: T);
    class procedure Invoke(NotifyProc: TNotifyProc; Item: T); overload;
  end;

  TOnObj = procedure (Value: String) of object;

{ TSafeCall<T> }

class procedure TSafeCall<T>.Invoke(NotifyProc: TNotifyProc; Item: T);
begin
  if Assigned(NotifyProc) then
    NotifyProc(Item);
end;

procedure AssertTestObj(OnExceptionObj_: TOnObj; Value_: String);
begin
  TSafeCall<String>.Invoke(OnExceptionObj_, Value_);
end;

begin
  try …
Run Code Online (Sandbox Code Playgroud)

delphi delphi-xe3

15
推荐指数
1
解决办法
1388
查看次数

无法将android.support.v7.widget.CardView导入Eclipse

我使用Eclipse,我正在尝试使用support-library-v7:21.+Lollipop中的new创建一个应用程序.

  • 创建了我的新项目
  • 在日食中导入 support-library-v7
  • 改变project-properties了支持库的行:target=android-2121个目标
  • 在21日改变了我的申请目标
  • 在我的项目中导入了库
  • 干净所有

毕竟我还是得到了无效的R声明.我重新启动了Eclipse,然后在重新导入库之后,似乎已经开始了!我创造了一个Tolbar和一个NavigationDrawer没有问题 - 它的工作原理.

现在,我想CardView在我的ListView项目中加入:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:card_view="http://schemas.android.com/apk/res-auto"
   >
    <!-- A CardView that contains a TextView -->
    <android.support.v7.widget.CardView
        xmlns:card_view="http://schemas.android.com/apk/res-auto"
        android:id="@+id/card_view"
        android:layout_gravity="center"
        android:layout_width="200dp"
        android:layout_height="200dp"
        card_view:cardCornerRadius="4dp">
    <TextView
        android:id="@+id/name"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        />
    <TextView
        android:id="@+id/codename"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        />
    <TextView
        android:id="@+id/versione"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        />
    <TextView
        android:id="@+id/link"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        />
    <TextView
        android:id="@+id/timestamp"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        />

    </android.support.v7.widget.CardView>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

好吧,第一个错误:No …

java eclipse android android-support-library material-design

14
推荐指数
1
解决办法
2万
查看次数

如何使用C++在Windows中获取MAC地址?

我需要一些MAC地址的帮助.我必须通过在C++中使用一些代码来获得它,所以任何人都可以帮助我吗?我已经尝试了很多无用的代码.如果存在我应该研究以找到MAC地址的任何特定方法或库,如果有人通过我链接或其他东西来了解更多信息,我将非常高兴.

c++ windows mac-address

13
推荐指数
2
解决办法
5万
查看次数

Android getChildFragmentManager()级别API <17

我试图在api 14上使用getChildFragmentManager()方法,但当然我收到错误.无论如何,在较低的apis上使用此方法.谢谢

android

13
推荐指数
1
解决办法
7653
查看次数

如何过滤掉Android中相关的媒体文件?

我正在尝试获取手机中的所有音乐文件:

为此,我正在使用:

String[] STAR = {"*"};

Uri allExternalSongUri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI;
String selection = MediaStore.Audio.Media.IS_MUSIC + " != 0";



Cursor cursor = getContentResolver().query(allExternalSongUri, STAR, selection, null, null);
if(cursor != null){
    if(cursor.moveToFirst()){
        do {
            String songName = cursor.getString(cursor.getColumnIndex(MediaStore.Audio.Media.DISPLAY_NAME));
            Log.i("name", songName);
        } while (cursor.moveToNext());
    }
    cursor.close();
}
Run Code Online (Sandbox Code Playgroud)

但是上面的代码,除了获取音乐文件之外,还提取了一些额外的不必要的文件,如*sound_screen_on.mp3*(由其他应用程序安装和使用).

问题是我的原生Android音乐播放器没有列出和播放这些不必要的文件.

如何过滤这些文件.

android android-mediaplayer

12
推荐指数
1
解决办法
1704
查看次数