小编a_s*_*ber的帖子

Emacs:是否可以折叠(折叠/展开)json 对象/集合?

Windows 10(64 位)、Emacs 25.1。

假设我有一个大的 json 文件。如果我可以折叠(折叠/展开)这个 json 的任何节点,那就非常舒服了。我用 Notepad++ 来做这个。

这里的例子:

在此输入图像描述

在此输入图像描述

在 Emacs 中可以做同样的事情吗?谢谢。

emacs json folding

5
推荐指数
0
解决办法
2150
查看次数

Android Studio。如何更改模板以生成“ toString()”方法?

Android Studio 2.3。

在此屏幕上生成方法toString()。

在此处输入图片说明

如何更改此模板?

android-studio

5
推荐指数
1
解决办法
476
查看次数

如何将内容数据从属性文件读取到 Properties 对象?

在文件夹资源中的Kotlin 项目中,我有属性文件。如何从这个文件读取内容数据到 Properties 对象?

我试试这个:

 val fis = FileInputStream("resources/pairs_ids.txt")
    prop.load(fis);
    logger.info("ETH_BTC_id = " + prop.get("ETH_BTC"))
Run Code Online (Sandbox Code Playgroud)

但我得到错误:

Exception in thread "main" java.io.FileNotFoundException: resources\pairs_ids.txt (The system cannot find the path specified)
Run Code Online (Sandbox Code Playgroud)

kotlin

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

未找到任何活动。您是否忘记通过调用 getActivity() 或 startActivitySync 或类似方法启动活动

当我的 android 应用程序第一次启动时FirstActivity。当我点击按钮而FirstActivity不是 start AddTraderActivity。如果我按下按钮“ START REQUESTAddTraderActivity然后我打电话:

setResult(RESULT_OK);
finish();
Run Code Online (Sandbox Code Playgroud)

结果AddTraderActivity是破坏和展示FirstActivity。好的。

现在我想为AddTraderActivityTest. 这里测试:

@RunWith(AndroidJUnit4::class)
@SmallTest
class AddTraderActivityTest {

    @get:Rule
    var addTraderActivity: IntentsTestRule<AddTraderActivity> =
        IntentsTestRule(AddTraderActivity::class.java)

    @Test
    fun toolBarHeight() {
        onView(withId(R.id.toolBar))
            .check(matches(withHeightResId(R.dimen.tool_bar_height)))
    }

    @Test
    fun buttonStartTextUppercase() {
        onView(withId(R.id.startButton))
            .check(matches(withTextUppercaseResId(R.string.start)))
    }
}
Run Code Online (Sandbox Code Playgroud)

结果当我开始这个测试时,然后只开始AddTraderActivity并测试成功通过。好的。

现在我想为单击按钮“ START REQUEST ”编写测试

这里测试:

setResult(RESULT_OK);
finish();
Run Code Online (Sandbox Code Playgroud)

结果,当测试运行并按下按钮“ START REQUEST ”时,我收到下一个错误:

测试开始于 16:05 ...

$ adb shell am instrument -w -r   -e debug false -e …
Run Code Online (Sandbox Code Playgroud)

android android-espresso

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

Android:Espresso:WireMock java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/common/io/Resources;

安卓工作室 3.2。我想在我的 Espresso 测试中使用WireMock

在 build.gradle

buildscript {
    ext.KOTLIN_VERSION = '1.3.21'
    ext.ESPRESSO_VERSION = '3.2.0-alpha02'

    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.2'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$KOTLIN_VERSION"

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}
Run Code Online (Sandbox Code Playgroud)

在 app/build.gradle 中

android {
    dataBinding {
        enabled = true
    }
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.myproject"
        minSdkVersion 18
        targetSdkVersion 28
        versionCode 6
        versionName "0.0.7"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    sourceSets {
        main.java.srcDirs += …
Run Code Online (Sandbox Code Playgroud)

android android-espresso wiremock

5
推荐指数
1
解决办法
541
查看次数

类“org.apache.http.conn.ssl.SSLSocketFactory”未实现接口

在我的 Android 应用程序中:app/build.gradle

  android {
        compileSdkVersion 28
        defaultConfig {
            minSdkVersion 18
            targetSdkVersion 28
            versionCode 427
            versionName "2.1.427"
            testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

dependencies {
    annotationProcessor "org.androidannotations:androidannotations:$AAVersion"
    annotationProcessor "org.androidannotations:ormlite:$AAVersion"

    implementation fileTree(dir: 'libs', include: ['*.jar'])

    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.android.support:animated-vector-drawable:28.0.0'
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support:cardview-v7:28.0.0'
    implementation 'com.android.support:customtabs:28.0.0'
    implementation 'com.android.support:exifinterface:28.0.0'
    implementation 'com.android.support:support-media-compat:28.0.0'
    implementation 'com.android.support:support-v4:28.0.0'

    implementation 'com.crashlytics.sdk.android:crashlytics:2.9.7'
    implementation 'com.google.android.gms:play-services-gcm:16.0.0'
    implementation 'com.google.code.gson:gson:2.8.2'
    implementation 'com.j256.ormlite:ormlite-android:5.1'
    implementation 'commons-codec:commons-codec:1.11'
    implementation 'commons-io:commons-io:2.6'
    implementation 'org.apache.commons:commons-lang3:3.8.1'
    implementation 'org.apache.httpcomponents:httpclient:4.3.6'
    implementation "org.androidannotations:androidannotations-api:$AAVersion"
    implementation "org.androidannotations:ormlite-api:$AAVersion"

    implementation project(':fab')
    implementation project(':fointeraction')
    implementation project(':scanlib')

    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
}
Run Code Online (Sandbox Code Playgroud)

我使用“ …

apache android

5
推荐指数
1
解决办法
3319
查看次数

埃马克。2 种语言的“即时”拼写检查

Windows 7,Emacs 25.1

我需要对我的自定义文本进行“即时”拼写检查(例如,强调不正确的单词)。但我用两种语言写文本:英语和俄语。我想在两种语言的拼写检查之间轻松切换。

什么是最好的 emacs 包?谢谢。

emacs

4
推荐指数
1
解决办法
933
查看次数

AndroidStudio 3.0:Java 8流无法编译(调用需要API级别24)

Java 8,我安装了新的Android Studio 3.0.

添加代码:

 List<String> myList =   Arrays.asList("a1", "a2", "b1", "c2", "c1");

        myList
                .stream()
                .filter(s -> s.startsWith("c"))
                .map(String::toUpperCase)
                .sorted()
                .forEach(System.out::println);
Run Code Online (Sandbox Code Playgroud)

但我得到编译错误:

Call requires API level 24 (current min is 15) java.util.stream.Collection
Run Code Online (Sandbox Code Playgroud)

android-studio-3.0

4
推荐指数
2
解决办法
1997
查看次数

安卓。Espresso:android.content.res.Resources$NotFoundException:字符串资源 ID

Android Studio 3.1。,Java 1.8。,摇篮4.4。

这是我的浓缩咖啡测试:

@RunWith(AndroidJUnit4.class)
public class SignInActivityTest {
    private Context context;

    @Rule
    public ActivityTestRule<SignInActivity> mActivityRule = new ActivityTestRule<>(SignInActivity.class, true, false);
    private MockWebServer server;

    @Before
    public void init() throws IOException {
        context = getInstrumentation().getContext();
        Intent intent = new Intent();
        mActivityRule.launchActivity(intent);    
    }

    @Test
    public void loginTextViewText() {
        String loginString = context.getResources().getString(R.string.login).toUpperCase();
        onView(withId(R.id.loginTextView)).check(matches(withText(loginString)));
    }


}
Run Code Online (Sandbox Code Playgroud)

但是当我尝试开始测试时loginTextViewText()出现错误:

android.content.res.Resources$NotFoundException:字符串资源 ID

0x7f0e004f

在 android.content.res.Resources.getText(Resources.java:312) 在 android.content.res.Resources.getString(Resources.java:400) 在 com.myproject.android.activity.SignInActivityTest.loginTextViewText(SignInActivityTest.java :106)在java.lang.reflect.Method.invoke(本机方法)在org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)在org.junit.internal.runners.model.ReflectiveCallable。运行(ReflectiveCallable.java:12)

我该如何解决这个问题?谢谢。

android-espresso

4
推荐指数
1
解决办法
786
查看次数

为什么 FragmentStateAdapter 在 ViewPager2 中不起作用?

安卓工作室 3.6

我希望在我的活动中在 ViewPager2 中使用 2 个片段。

这是我的活动:

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.viewpager2.widget.ViewPager2;
public class QRBluetoothSwipeActivity extends AppCompatActivity {
    private ViewPager2 myViewPager2;
    private ViewPagerFragmentAdapter myAdapter;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        // Make sure this is before calling super.onCreate
        setTheme(R.style.AppTheme); // show splash screen
        super.onCreate(savedInstanceState);
        setContentView(R.layout.qr_bluetooth_swipe_activity);
        init();
    }

    private void init() {
        myAdapter = new ViewPagerFragmentAdapter(getSupportFragmentManager());
        myAdapter.addFragment(new BluetoothPageFragment());
        myAdapter.addFragment(new QrPageFragment());
        myViewPager2.setOrientation(ViewPager2.ORIENTATION_VERTICAL);
        myViewPager2.setAdapter(myAdapter);
    }

}
Run Code Online (Sandbox Code Playgroud)

这里 ViewPagerFragmentAdapter

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.viewpager2.adapter.FragmentStateAdapter;

import java.util.ArrayList;

public class …
Run Code Online (Sandbox Code Playgroud)

android android-viewpager2

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