草庐IT

dialog_result

全部标签

Android开发笔记:使用Activity Result API 清爽地请求权限 和 启动Activity

Android开发笔记:使用ActivityResultAPI清爽地请求权限和启动Activity简介:ActivityResultApi是Android新版本中引入的全新API。在过去,如果我们需要启动另一个Activity或者申请权限时可能要用到startActivityForResult和requestPremissons方法。但在这套API中我们可以用一套非常清爽的方式实现以上两种操作。官网介绍:虽然所有API级别的Activity类均提供底层startActivityForResult()和onActivityResult()API,但我们强烈建议您使用AndroidXActivit

安卓 : Deny button pressed on Bluetooth enabling dialog box

如何处理蓝牙启用对话框中的“拒绝”按钮?我尝试使用OnDismissListener和OnCancelListener甚至尝试使用onActivityResult但没有用。代码是:privateBluetoothAdaptermBluetoothAdapter;privatestaticfinalintREQUEST_ENABLE_BT=1;@OverrideprotectedvoidonCreate(BundlesavedInstanceState){super.onCreate(savedInstanceState);if(isBleSupportedOnDevice()){ini

android - 从另一个类调用 Dialog

我是android的初学者,我没有在每个Activity中为对话框重复编写代码,而是创建了一个类,其中包含显示对话框的所有方法,我给出了小代码fragmentpublicclassDialoguesextendsActivityimplementsDialogueMethods{publicvoidshowAlertDialog(Contextcontext,Stringtitle,Stringmessage){AlertDialog.BuilderalertDialog=newAlertDialog.Builder(context);alertDialog.setTitle(titl

android - 在没有 Activity 或 Dialog 的情况下安装 .apk

我的应用程序下载一个.apk并使用如下Activity安装它:Android:install.apkprogrammatically但是,它会导致出现一个对话框并需要用户操作。所以我的问题是:有没有不需要用户交互的编程方式?根据评论,我必须提供额外的信息:是的,存在安全隐患。我只是想知道这是否可能。实际上,我确实拥有他们的手机。 最佳答案 不,您不能这样做,用户必须批准所有应用安装。但是,由于这是您的设备,您可以使用adb来安装它而无需对话框!;) 关于android-在没有Activi

android - 使用 android.support.v7.app.AlertDialog 自定义默认的 Theme.AppCompat.Dialog.Alert

我最近将应用中的AlertDialog实例切换为使用android.support.v7.app.AlertDialog,但在应用自定义主题时遇到了问题,并且警报对话框的样式。在我的styles.xml中,我有以下样式:@color/theme_accent_1@color/theme_component_background@color/theme_component_background在我的themes.xml中,我根据需要在我的主题中设置了以下内容:@style/AlertDialog由于某些原因,自定义样式从未应用于AlertDialog实例,它们仍然是默认的Theme.Ap

java - 安卓地理编码器 : search by zip code returns unexpected results

我想通过Android的GeoCoder类搜索用户输入的文本。这是我的代码:GeocoderiGeocoder=newGeocoder(getContext(),Locale.GERMAN);publicAddressgetAdress(StringaUserInput){ListtAddressList=iGeocoder.getFromLocationName(aUserInput,1000,47.060940,8.564278,51.526396,13.736392);if(tAddressList!=null&&tAddressList.size()>0){for(Addres

android - Dialog 的 setSoftInputMode 在键入时不隐藏 EditText?

我有一个自定义对话框,它在View底部有一个EditText。当我选择EditText时,键盘出现但在对话框中隐藏了EditText。我知道您可以将windowSoftInputMode用于Activity,引用资料说您可以使用Window.setSoftInputMode()对于非Activity..但是如何做到这一点???Reference我试过这样做GettingKeyboardToAppearWithoutHavingToClickonEditText但是之后Dialog.show();我放了getWindow().setSoftInputMode(WindowManager.

Android Wifi 扫描 - SCAN_RESULTS_AVAILABLE_ACTION 的 BroadcastReceiver 未被调用

这是我的代码:publicclassFloatWifiManagerimplementsIWifiManager{privateWifiManagerwifiManager;privateBroadcastReceiverwifiScanReceiver;publicFloatWifiManager(Contextcontext){...wifiManager=(WifiManager)context.getSystemService(Context.WIFI_SERVICE);//RegisteringWifiReceiverwifiScanReceiver=newBroadcast

Android Alert Dialog 用另一种颜色替换默认的蓝色

我正在使用单选警报对话框,我想在其中将默认的蓝色(标题行和单选按钮)替换为我在标题栏中使用的橙色。我可以使用setCustomTitle()更改为标题栏,但我无法尝试摆脱这该死的蓝色。对于标题栏构建AlertDialogAlertDialog.Builderbuilder=newAlertDialog.Builder(MainActivity.this);ViewcustomTitle=View.inflate(MainActivity.this,R.layout.custom_alert_title,null);builder.setCustomTitle(customTitle);

java - 尝试运行简单的 Android JUnit 测试。获取 : "Test run failed: No test results" What am I missing?

我以前从未使用过JUnit,现在我正在尝试在Android项目上设置它。我的测试项目相当复杂,包括一些JNI,但目前我的测试项目完全微不足道。我在网上找到了很多关于如何制作测试项目的示例(看起来完全不同),但似乎无论我遵循哪个,我得到的结果都是一样的。这是我的JUnit项目代码:packagecom.mycompany.myproject.test;importandroid.test.AndroidTestCase;publicclassSimpleTestCaseExampleextendsAndroidTestCase{publicvoidtest_testOne(){fail(