小编Jul*_*rez的帖子

如何在Native Android Application上使用"Font Awesome"中的图标和符号

我正在尝试在我的应用程序上使用Font Awesome,我能够使用该字体集成Typeface.createFromAsset(),但我也想使用这种字体提供的图标,但到目前为止我还没能做到这一点.

此特定字体包含Unicode专用区(PUA)内的图标,用于媒体播放器控件,文件系统访问,箭头等内容.

有没有人在Android上使用包含图标和符号的字体,这有可能吗?

android font-awesome

152
推荐指数
5
解决办法
11万
查看次数

如何在AlertDialog中设置单选项?

我无法在AlertDialog中设置Single Choice列表或Multiple Choice List.

我试着按照这些例子,但我只得到一个带有标题的对话框,确认和取消按钮,没有列表,没有消息(我设置了!).

这是代码:

    protected Dialog onCreateDialog(int id) {
    switch (id) {
    case DIALOG_DELETE_CITY:
        CharSequence[] array = {"Red", "Blue", "Yellow"}; 
        return new AlertDialog.Builder(ShowPypData.this)
            .setTitle(R.string.city_actions_delete_label)
            .setMessage(R.string.city_actions_delete_select_label)
            .setSingleChoiceItems(array, -1, new DialogInterface.OnClickListener() {

                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        // TODO Auto-generated method stub

                    }
                })
            .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {

                @Override
                public void onClick(DialogInterface dialog, int which) {
                    // TODO Auto-generated method stub

                }

            })
            .setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {

                @Override
                public void onClick(DialogInterface dialog, int which) {
                    dialog.dismiss();

                } …
Run Code Online (Sandbox Code Playgroud)

android android-alertdialog

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

Android:单元测试服务

我目前正在尝试使用TDD编写Android应用程序.我已经完成了编写一项在应用程序中非常重要的服务的任务.

至于这个原因,我正在尝试为服务编写适当的测试.Android指南声明如下:

"测试内容"主题列出了测试Android组件的一般注意事项.以下是测试服务的一些具体指导原则:

  • 确保调用onCreate()以响应Context.startService()或Context.bindService().同样的,你应该确保的onDestroy()被调用响应Context.stopService(),Context.unbindService(),stopSelf(),或stopSelfResult().测试您的服务是否正确处理来自Context.startService()的多个调用.只有第一个调用触发Service.onCreate(),但所有调用都会触发对Service.onStartCommand()的调用.

  • 另外,请记住,startService()调用不能嵌套,所以Context.stopService()或Service.stopSelf(单次调用)(但不stopSelf(INT))将停止服务.您应该测试您的服务在正确的位置停止.

  • 测试您的服务实现的任何业务逻辑.业务逻辑包括检查无效值,财务和算术计算等.

来源:服务测试| Android开发者

我还没有看到对这些生命周期方法的适当测试,对Context.startService()等的多次调用.我试图解决这个问题,但我现在处于亏损状态.

我正在尝试使用ServiceTestCase类测试服务:

import java.util.List;

import CoreManagerService;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Before;
import org.junit.Test;

import android.app.ActivityManager;
import android.app.ActivityManager.RunningServiceInfo;
import android.content.Context;
import android.content.Intent;
import android.test.ServiceTestCase;
import android.test.suitebuilder.annotation.SmallTest;
import android.util.Log;

/**
 * 
 * This test should be executed on an actual device as recommended in the testing fundamentals.
 * http://developer.android.com/tools/testing/testing_android.html#WhatToTest
 * 
 * The following page describes tests that should be written for a service.
 * http://developer.android.com/tools/testing/service_testing.html
 * TODO: Write tests that check …
Run Code Online (Sandbox Code Playgroud)

service android unit-testing junit4

11
推荐指数
1
解决办法
9682
查看次数

使用Dagger2时创建测试依赖项

在阅读dagger 2的文档时,我无法找到一种简单的方法来在构建应用程序进行测试时提供依赖关系.我发现的唯一线索是:

Dagger 2不支持覆盖.覆盖简单测试假货的模块可以创建模块的子类来模拟该行为.应该分解使用覆盖并依赖依赖注入的模块,以便将被覆盖的模块表示为两个模块之间的选择.

我不明白我将如何在Android上设置这样的配置,任何人都可以解释一下?

android dagger dagger-2

10
推荐指数
1
解决办法
3334
查看次数

如何找到用户的Google Play国家/地区?

在我的应用程序中,我有应用程序计费支持,因为在实际向用户显示购买UI之前没有API来获取项目的价格,我目前正在考虑对应用程序内的应用内结算项目的硬编码.

但是,根据国家/地区的定价会有所不同,因此我需要找到一种方法来了解用户所在的国家/地区,以便在应用中显示正确的价格.

我发现用户显示的价格取决于用户在创建Google Play帐户时选择的国家/地区,因此我需要一种方法来了解与用户的Google Play帐户相关联的国家/地区.有谁知道如何做到这一点?

谢谢

android in-app-billing google-play

6
推荐指数
1
解决办法
1621
查看次数

使用 RoboSpice 和 RxJava

我想知道将 RoboSpice 和 RxJava 一起使用时的最佳实践是什么。到目前为止,我唯一发现的是RoboSpice Google Group 中“RoboSpice 和 RxJava”线程。我想知道在集成这两个库时是否有推荐的方法

android robospice rx-java

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

ExpandableListView中的EditTexts

嗨,我正在尝试创建一个显示ExpandableListView的活动,如图所示.

当您单击该组时,它会展开并显示带有textview和editext的LinearLayout.

右键知道我的问题是,当在一个的EditText点击它并不会关注我必须以使其获得焦点,并显示键盘上两次挖掘,然后当我输入文字我最初看到什么当我正在键入时,然后当我隐藏键盘时,EditText会更新我输入的文本

我已经尝试添加机器人:descendantFocusability ="afterDescendants"到expandableListVie布局,但行为是一样的.

任何的想法??或任何其他方式我可以实现这种布局??

带EditText的可扩展ListView

layout android expandablelistview android-edittext

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