草庐IT

android - 如何更改android默认警报对话框的背景颜色

我有一个带有文本和单选按钮ListView的默认警报对话框。我需要替换图片而不是文本(替换图片而不是下面显示的Facebookcredit、paypal、信用卡)并且还需要更改警报对话框的背景颜色。我也将style.xml文件放在values文件夹中。我如何在下面的代码中实现该文件以更改背景颜色?我的代码:finalCharSequence[]items={"Facebookcredit","Paypal","CreditCard"};//ContextThemeWrapperctw=newContextThemeWrapper(this,R.style.AboutDialog);Al

android - API < 11 上的 NotificationCompat.Builder 不工作

publicstaticfinalStringNOTIFICATION_TITLE="Title";publicstaticfinalintNOTIFICATION_ID=1;privateNotificationManagermNotificationManager;NotificationCompat.Builderbuilder;privatevoidsendNotification(Stringmsg){mNotificationManager=(NotificationManager)this.getSystemService(Context.NOTIFICATION_SER

android - SIP 配置文件构建 :Android

我可以使用SipProfile.Builder类构建一个sip配置文件。我使用了以下代码fragment来做到这一点:if(SipManager.isApiSupported(MyActivity.this)&&SipManager.isVoipSupported(MyActivity.this)){SipManagermanager=SipManager.newInstance(this);SipProfile.Builderbuilder;try{builder=newBuilder(userName,domainName);}catch(ParseExceptione){//TO

android - 在 ListPreference 摘要中显示图像

我正在尝试在ListPreference上添加图像,我实现了这一点,但在AndroidAPI级别15或更高级别上它不起作用。我做错了什么?我已经在2.2和2.3.3上测试了这段代码,一切正常!这是我的代码。privatevoidaddSummary(Drawabled,Spannablesp){d.setBounds(0,0,d.getIntrinsicWidth(),d.getIntrinsicHeight());SpannableStringBuilderbuilder=newSpannableStringBuilder();builder.append(Const.IMAGE_A

android - 更新通知栏上现有通知的通知内容,如 Android 中的 Whatspp、Gmail 等

当我观察whatsapp和gmail通知时,它们会自动更新现有应用程序的通知,而无需创建新通知。那么我该如何实现呢?我已经创建了一个通知,如上图所示。所以当Notification创建时,有4条消息。所以当我收到第五条消息时,它应该附加现有通知的内容,如图像中红色所示。请告诉我在类似Gmail的应用程序中使用了哪些方法?我怎样才能做到这一点? 最佳答案 我的问题通过以下链接解决Updatetextofnotification,notentirenotification这是我的代码:-PendingIntentpendingInten

Android VpnService.Builder.establish() 偶尔为空

当我尝试为我的VpnService创建隧道接口(interface)时,出现以下错误:Attempttoinvokevirtualmethod'java.lang.Stringandroid.os.ParcelFileDescriptor.toString()'onanullobjectreference我目前唯一的解决办法是在发生这种情况时重启设备。否则,我根本无法创建隧道。我创建隧道的代码://ThisisinsidemyVpnServiceimplementationprivateParcelFileDescriptorconfigureTunnelWithPushOpts(Pu

android - 在 android 中安排一个作业在特定时间运行

我有一个Android应用程序,它需要在每个午夜向我的云服务器发送备份数据。为此,我需要安排作业每24小时发生一次而不会失败。我读过AlarmManager和JobScheduler可以有效安排您的工作的类(class)。在我的例子中,我使用的是JobScheduler类,这里是我的scheduleJob()方法,它设置了每86400000毫秒(即一天)后安排的作业。@RequiresApi(api=Build.VERSION_CODES.LOLLIPOP)publicvoidscheduleJob(Viewv){JobInfo.Builderbuilder=newJobInfo.Bu

android - 为什么 Eclipse 无法识别 Notification.Builder 类中的 build() 方法来返回 Notification 对象?

这是我的代码:NotificationManagermNotificationManager=(NotificationManager)c.getSystemService(ns);//InstantiatethenotificationCharSequencetickerText="Hello";longwhen=System.currentTimeMillis();Notification.Builderbuilder=newNotification.Builder(c).setTicker(tickerText).setWhen(when).setContentTitle("Te

android - 注入(inject) GoogleApiClient

我想在我的项目的不同部分注入(inject)Googleapi客户端的实例,但是我没能成功。@Provides@Named("geodata_api")@SingletonGoogleApiClientprovidesGoogleApiClient(Contextcontext){returnnewGoogleApiClient.Builder(context).addApi(Places.GEO_DATA_API).build();}@Provides@Named("location_api")@SingletonGoogleApiClientprovidesGoogleApiCli

android - Adobe AIR/Flash Builder 4.6 : Create reminder in Android App

我正在使用FlashBuilder4.6和Adob​​eAIR创建一个Android应用程序。我希望创建某种提醒/约会,它会在指定时间在屏幕上或应用栏中显示通知。到目前为止,我还没有找到一种方法来做到这一点。我想我可能会在ANE[ActionscriptNativeExtension]中找到此功能,但我还没有遇到过。这可能吗?提前谢谢! 最佳答案 有可用的开源native扩展,可让您在Android上发送通知。ThisDanielKoeSTLer的示例包括ane文件,以及示例项目和教程。要在特定时间发送通知,您需要一个适用于Andr