草庐IT

add_listener

全部标签

android - add() & replace() 与 Fragment 生命周期的区别

我的程序有6个fragment:Fragment1、Fragment2、....->Fragment6。我使用add()和replace()语句在fragment之间切换并跟踪它们的生命周期。Fragment1添加Fragment2添加Fragment3添加Fragment4添加Fragment5替换Fragment6显示其生命周期的日志猫(我在onCreate、onCreateView、onDestroyView、onDestroy中有一些printf点用于跟踪)标签______________文字Fragment1_________onCreateFragment1________

安卓工作室 : Fail to parse SDK may be missing the directory add-ons

我是安卓软件开发的新手。当我尝试编写第一个android程序时,在选择完所有基本设置后会弹出一个窗口,说它无法解析SDK,并且可能缺少“附加组件”目录。我检查了我刚刚安装的SDK文件夹,SDK文件夹存在,里面也有很多东西。谁能告诉我如何解决这个问题? 最佳答案 SDK与AndroidStudiobundle在一起,您无需单独下载。我在安装了AndroidStudio的两台机器上都看到了这个问题-安装时没有创建“附加组件”目录。假设您使用的是64位Windows并安装到默认位置,请看这里:*C:\ProgramFiles(x86)\A

android - 运行时找不到兼容的Android SDK进行编译 `tns platform add android`

我正在关注官方的NativeScripttutorial并且在配置我的OSX环境以进行Android开发时遇到问题。当运行tnsplatformaddandroid我收到以下错误:CannotfindacompatibleAndroidSDKforcompilation.TobeabletobuildforAndroid,installAndroidSDK21orlater.tnsdoctor命令还会返回有关android-sdk问题的警告:CannotfindacompatibleAndroidSDKforcompilation.TobeabletobuildforAndroid,i

android - 毕加索图书馆,Android : Using Error Listener

我正在使用Picasso库来加载图像,但遇到了问题。当图像无法加载时,我想隐藏View而不是加载默认图像。我从源代码中注意到,添加监听器的唯一方法似乎是来自构建器,但是当图像加载失败时,永远不会调用错误方法。有人有这方面的经验吗?iv=(ImageView)findViewById(R.id.imageView);Picasso.Builderbuilder=newPicasso.Builder(getApplicationContext());builder.listener(newPicasso.Listener(){@OverridepublicvoidonImageLoadFa

android - 未为 Listen 类型定义方法 getSystemService(String)

我正在尝试检查com.android.music是否正在运行,我在这一行收到以下错误this.getSystemService(Context.ACTIVITY_SERVICE);错误:ThemethodgetSystemService(String)isundefinedforthetypeListen代码:publicbooleanisMusicRunning(){ActivityManageractivityManager=(ActivityManager)this.getSystemService(Context.ACTIVITY_SERVICE);ListprocInfos=

安卓错误 : Unable to add window -- token null is not for an application

喂。我试图创建一个警报对话框,但是当我运行我的应用程序时,抛出异常09-2612:43:21.949:E/AndroidRuntime(14618):FATALEXCEPTION:main09-2612:43:21.949:E/AndroidRuntime(14618):android.view.WindowManager$BadTokenException:Unabletoaddwindow--tokennullisnotforanapplication09-2612:43:21.949:E/AndroidRuntime(14618):atandroid.view.ViewRootI

android - 它是如何工作的 - requestLocationUpdates() + LocationRequest/Listener

我是新的Android编码员,我在请求本地化更新时遇到问题。我正在使用来自http://developer.android.com/training/location/receive-location-updates.html的教程.我的应用程序可以处理异常,正确获取纬度和经度,地理编码器可以处理显示地址。但我只要求位置一次-或者当位置发生变化时。我想做时间间隔。现在我开始实现教程中的代码,它看起来像这样:publicclassMainActivityextendsActivityimplementsGooglePlayServicesClient.ConnectionCallback

android - 如何在 android 中启动 'Add Contact' Activity

您能告诉我如何在android中启动“添加联系人”Activity吗?谢谢。 最佳答案 APILevel5及以上解决方案//Addlistenersoyouractivitygetscalledbackuponcompletionofaction,//inthiscasewithabilitytogethandletonewlyaddedcontactmyActivity.addActivityListener(someActivityListener);Intentintent=newIntent(Intent.ACTION_IN

android - 创建产品 SDK : How do I add a native lib (. so) 和我正在创建的 SDK 的 jar?

我正在创建一个我们将提供给开发人员最终用户的小部件,它由一个.jar和一个使用NDK构建的native库(.so)组成。JAR有一个到动态库的JNI接口(interface)。关于如何在项目中包含外部.jar非常清楚,但不知道如何包含依赖的动态库。如何打包和构建.jar和.so?这里有哪些最佳实践?我可以使用JDK的jar命令创建JAR文件。我是否需要在jar上运行dx.bat才能转换为Dalvik字节码?我需要创建一个示例项目来展示小部件的运行情况。如何在演示如何使用小部件的示例项目中包含此.jar和.so? 最佳答案 我花了一些

android - 使用 ListView : How to add a header view?

我看theListViewAPI我看到了方法:addHeaderView(Viewv)我想做的是在列表上方有一个布局,这可能吗?我尝试做类似的事情:EditTextet=newEditText(this);et.setLayoutParams(newGallery.LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT));et.setInputType(InputType.TYPE_CLASS_TEXT);addHeaderView(et);//makesappcrash我也试过了setContentView(R