小编app*_*ano的帖子

如何更改每个Gradle构建类型的应用程序名称

我试图找出一种方法,可以在gradle中更改每个构建类型的应用程序的应用程序名称.

例如,我想调试版本<APP_NAME>-debug和qa版本<APP-NAME>-QA.

我熟悉:

debug {
        applicationIdSuffix '.debug'
        versionNameSuffix '-DEBUG'
}
Run Code Online (Sandbox Code Playgroud)

但是,我似乎无法在启动器中找到应用更改应用程序的gradle命令.

android android-gradle-plugin

122
推荐指数
8
解决办法
5万
查看次数

无法使字段 private Final java.lang.String java.io.File.path 可访问

无法使字段 private Final java.lang.String java.io.File.path 可访问:模块 java.base 不会向未命名模块“打开 java.io”@​​786f3609 在此输入图像描述

android-studio

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

如何从Android键盘中为EditText排除特殊字符

嗨,我想在Android的EditText键盘上只显示数字和字符,我确实尝试添加属性,android:inputType = text|number但它不起作用.

请帮助我提出任何其他更好的建议.提前致谢.

android keypad android-edittext

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

如何更改Android模拟器中的移动国家/地区代码(MCC)?

我的Android应用程序需要对不同的移动国家代码做出不同的反应

它似乎是硬编码到mcc310(美国).我可以TelephonyManager.getSimCountryIso()通过使用资源文件夹来读取此值,res/values-mcc123/但是如何在模拟器中设置此值?

android mcc mobile-country-code android-emulator

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

PreferenceFragment中的上下文

取自http://developer.android.com/guide/topics/ui/settings.html:

注意:PreferenceFragment没有自己的Context对象.如果需要Context对象,可以调用getActivity().但是,只有在片段附加到活动时才要小心调用getActivity().当片段尚未附加或在其生命周期结束时被分离时,getActivity()将返回null.

如果我从PreferenceFragment的OnCreate()方法中调用getActivity(),那么我可以确定该片段是附加到它的活动 - 还是有其他方法你应该在这个实例中获取Context?

我需要Context的原因是我正在尝试使用PreferenceFragment中的Toast通知

android android-preferences android-fragments

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

在android中使用lambdaj

有没有人试图在android开发中使用lambdaj库?

当我创建一个简单的小型Java应用程序时,它对我来说很好,但我无法在Android应用程序中使用它.

更新:

我正在添加lambdaj(lambdaj-2.3.2-with-dependencies.jar,从http://code.google.com/p/lambdaj下载),然后在构建我的应用程序时出现以下错误:

Dx warning: Ignoring InnerClasses attribute for an anonymous inner class
(org.hamcrest.generator.qdox.directorywalker.DirectoryScanner$1) 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
this warning is that reflective operations on this class will incorrectly
indicate that …
Run Code Online (Sandbox Code Playgroud)

java dependencies android lambdaj

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

使用智能位置库的问题

我正在尝试使用智能位置库来获取定期位置更新.但是当启动进程时它会触发侦听器,然后就没有进一步的更新.这是我使用的代码

public void startTracking(View v)    {
    provider = new LocationGooglePlayServicesWithFallbackProvider(this);


    Log.i("Tag","Start Tracking");
    SmartLocation smartLocation = new SmartLocation.Builder(this)
            .logging(true)
            .build();

    smartLocation.location(provider)
            .config(LocationParams.BEST_EFFORT)
            .start(this);
    smartLocation.activity().start(this);
}

public void stopTracking(View v) {
    Log.i("Tag","Stop Tracking");
    SmartLocation.with(this).location().stop();
    SmartLocation.with(this).activity().stop();

}

@Override
public void onActivityUpdated(DetectedActivity detectedActivity)
{
    Log.i("Tag","ActivityUpdate : "+detectedActivity.toString());
}

@Override
public void onLocationUpdated(Location location)
{
    Log.i("Tag","LocationUpdate : "+location.getLatitude()+","+location.getLongitude());
}
Run Code Online (Sandbox Code Playgroud)

这是我得到的Logcat输出

 01-27 14:09:01.791 3038-3038/com.angulusits.smartlocationtest I/Tag:
 Start Tracking 

 01-27 14:09:01.879 3038-3038/com.angulusits.smartlocationtest I/Tag:
 ActivityUpdate : DetectedActivity [type=STILL, confidence=100] 

 01-27 14:09:02.017 3038-3038/com.angulusits.smartlocationtest I/Tag:
 LocationUpdate : <some-value>,<some-value>
Run Code Online (Sandbox Code Playgroud)

按下startButton,然后没有更多的值,就会给出这个. …

android location

9
推荐指数
2
解决办法
8128
查看次数

如何在每一行显示logcat标题?

我刚刚将Android Studio更新到最后一个稳定版本3.1

我注意到logcat选项卡中发生了一些变化:在之前的版本中,logcat的每一行都以标题开头; 现在标题只打印在logcat messagges的"每一组"的开头.

Android 3.0

例3.0

Android 3.1.看看OkHttp的调试行!

例3.1

如何在Android 3.0中恢复logcat?

android android-studio android-studio-3.0

9
推荐指数
0
解决办法
722
查看次数

允许在RecyclerView上使用多个AdMob广告吗?替代广告网络?

许多应用程序(如facebook,twitter)都有内容流,每n次放置广告(称为赞助帖子).

我有一个显示项目列表的应用程序,我每6个元素添加一个admob广告.元素列表不固定,我可以有0到250个项目.

通过实际实现,我有一个唯一的广告ID,所以所有横幅都有(显然)相同的内容.

所以我会在AdMob网站上手动创建+40个广告...并在回收商上以编程方式分配.

在AdMob上我读到:

如果广告固定在屏幕顶部或屏幕底部,则单个屏幕上的广告数量不应超过1.如果页面滚动,则一次只能在屏幕上显示一个广告,并且根据AdSense计划政策,发布商可能会在整个页面上放置不超过3个广告单元.

Facebook或其他应用程序如何在滚动页面上显示多个广告?是否存在允许此操作的广告网络?

android ads admob

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

在Android中你的意思是对接状态

在Intent中,有一个常量命名 ACTION_DOCK_EVENT

API level 5
广播操作中添加:粘贴广播,用于更改设备的物理对接状态.

对接状态是什么意思?

android dock android-intent

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