我从服务器下载图像作为位图并将其转换为drawable现在我想使用这个drawable作为通知图标.但我无法做到这一点.这是我的代码:
Notification notification = new NotificationCompat.Builder(context)
.setContentTitle(title)
.setContentText(message)
.setContentIntent(intent)
.setSmallIcon(bitmap)
.setWhen(when)
.build();
Run Code Online (Sandbox Code Playgroud)
但是icon是一个Resources int值,所以当我使用它时会出错.任何帮助
编辑:
现在我更新我的代码,现在我这样做:
Notification notification = new NotificationCompat.Builder(context)
.setContentTitle(title)
.setContentText(message)
.setContentIntent(intent)
.setSmallIcon(icon)
.setLargeIcon(bitmap)
.setWhen(when)
.build();
Run Code Online (Sandbox Code Playgroud)
但它左侧有大图标,右侧有小图标.我不希望这样,为此我删除setSmallIcon行并运行我的代码,但它没有显示通知
我正在开发谷歌nexus 7和10的应用程序.但是有一个问题.我不知道7和10应该使用哪个布局文件夹.
我正试图在Twitter上发布推文.现在,我已经在dev.twitter上创建了一个应用程序,并从此链接下载了示例代码,并使用我的应用程序密钥更新了这两个密钥.
现在我运行代码验证帐户,然后我发推文,这条推文包括图像和文本,两个图像都在URL上,如示例代码中所定义.现在我第一次向我显示图像和文本已成功上传,但当我再次尝试推文时,它给出了403状态更新错误.
为此,我更改了文本消息"状态文本"和图像URL,但它仍然给我"403状态"更新错误.我有与示例代码中编写的相同的代码,只更改了密钥.
这是我的Logcat:
10-04 11:26:25.015: W/System.err(22822): 403:The request is understood, but it has been refused. An accompanying error message will explain why. This code is used when requests are being denied due to update limits (https://support.twitter.com/articles/15364-about-twitter-limits-update-api-dm-and-following).
10-04 11:26:25.015: W/System.err(22822): message - Error creating status.
10-04 11:26:25.015: W/System.err(22822): code - 189
10-04 11:26:25.025: W/System.err(22822): Relevant discussions can be found on the Internet at:
10-04 11:26:25.025: W/System.err(22822): http://www.google.co.jp/search?q=b2b52c28 or
10-04 11:26:25.025: W/System.err(22822): http://www.google.co.jp/search?q=11331d43
10-04 11:26:25.025: W/System.err(22822): TwitterException{exceptionCode=[b2b52c28-11331d43], statusCode=403, …Run Code Online (Sandbox Code Playgroud) 我在改变黑莓游戏书的数量时遇到了问题.首先,我将我的Android应用程序重新打包到Palybook App.我需要使用seekbar更改黑莓手册的音量,并在seeklistener中设置音频管理器音量.这是代码:
audioManager = (AudioManager)getSystemService(Context.AUDIO_SERVICE);
seekbar.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {
public void onStopTrackingTouch(SeekBar seekBar)
{
// TODO Auto-generated method stub
}
public void onStartTrackingTouch(SeekBar seekBar) {
// TODO Auto-generated method stub
}
public void onProgressChanged(SeekBar seekBar, int progress,boolean fromUser)
{
// TODO Auto-generated method stub
audioManager.setStreamVolume(AudioManager.STREAM_MUSIC, progress, 0);
}
Run Code Online (Sandbox Code Playgroud)
但当我运行我的应用程序并更改搜索栏时,系统的音量(Blackberry playbook)不会改变.这是由于黑莓palybook安全性
我正在处理Calender Events提醒.Android中没有原生日历活动提醒,因此用户可以安装不同的日历应用.
现在,这些应用程序在提醒事件时可能会有所不同,例如可以显示提醒通知.现在我希望我在这些事件日历应用程序中以编程方式设置事件,并且按时到达时不显示任何通知,而是弹出消息将显示警报声音.那时我使用该网站的代码.它的工作,但它以通知的形式显示提醒.
这是代码:
的onReceive
void doReminderWork(Intent intent) {
Long rowId = intent.getExtras().getLong(RemindersDbAdapter.KEY_ROWID);
NotificationManager mgr = (NotificationManager)getSystemService(NOTIFICATION_SERVICE);
Intent notificationIntent = new Intent(this, ReminderEditActivity.class);
notificationIntent.putExtra(RemindersDbAdapter.KEY_ROWID, rowId);
PendingIntent pi = PendingIntent.getActivity(this, 0, notificationIntent, PendingIntent.FLAG_ONE_SHOT);
Notification note=new Notification(android.R.drawable.stat_sys_warning, getString(R.string.notify_new_task_message), System.currentTimeMillis());
note.setLatestEventInfo(this, getString(R.string.notify_new_task_title), getString(R.string.notify_new_task_message), pi);
note.defaults |= Notification.DEFAULT_SOUND;
note.flags |= Notification.FLAG_AUTO_CANCEL;
int id = (int)((long)rowId);
mgr.notify(id, note);
}
Run Code Online (Sandbox Code Playgroud)
现在我想显示一个对话框而不是通知,以便如何使用这些代码行在对话框中使用这个待处理的意图.
Intent notificationIntent = new Intent(this, ReminderEditActivity.class);
notificationIntent.putExtra(RemindersDbAdapter.KEY_ROWID, rowId);
PendingIntent pi = PendingIntent.getActivity(this, 0, notificationIntent, PendingIntent.FLAG_ONE_SHOT);
Run Code Online (Sandbox Code Playgroud) 我正在尝试在Android中开发Amazon In-app.为此,我从这个网站下载示例代码https://developer.amazon.com/sdk/in-app-purchasing/sample-code/button-clicker.html.本文建议我们必须将文件amazon.sdktester.json放在设备的mnt/sdkcard文件夹中.为此我从这个网站https://developer.amazon.com/sdk/fire/connect-adb.html#InstallApp阅读文章,并做同样的事情.但当我试图在SD卡上推送文件时,eclipse会给我以下错误:
[2012-11-19 13:39:39 - ddms] transfer error: Permission denied
[2012-11-19 13:39:39] Failed to push selection: Permission denied
Run Code Online (Sandbox Code Playgroud)

有没有办法改变Kindle Fire的根文件夹的权限.
最近我开发了一款适用于Galaxy 10.1的应用程序,7英寸,1024x600,480x800,注意800高度,高度为S3,高度为720.他们都完全按照这些决议运行.但是当我们谈论注释2和galaxy 7 plus等时,我们遇到了几个问题.这些设备上的布局是不正确的.在那个面临布局问题的iam我使用layouts文件夹作为layouts-normal-xhdpi-1280x800和S3 layouts-normal-xhdpi-1280x720并将所有布局放在一个文件夹中,这使得一个apk支持所有这些布局.
但是当客户下载apk时,他们处理的问题是Galaxy笔记选择布局 - 正常 - xhpi-1280x720布局并且它是正确的但是S3和Galaxy Note 2具有不同的密度.
由于这个问题,我无法弄清楚如何为S3和Note 2声明布局文件夹.有没有办法我只使用默认的四个文件夹
布局Xlarge
布局Xhdpi正常
布局mdpi
布局hdpi正常
并支持所有屏幕的所有布局,如S3,注1,注2,7英寸以及其他.当我尝试启动我的项目时,我总是想到着名的游戏,比如其中一个是"Temple Run",它运行在所有手机和标签上.
制作一堆布局文件夹使我的应用程序变得像是超过80MB限制而且谷歌市场只接受少于50MB的应用程序.
从语法上来说,我们只使用一个布局文件夹并在所有屏幕上支持此布局.我阅读了一些文章和Android开发人员门户网站,但他们并不满足我.他们都说你必须为不同的屏幕制作不同的布局文件夹,甚至在stackoverflow上我看到了相同的情况,以节省我在第一个项目中的时间我使用这些技术,但我的工作现在日益增加,我希望我从那些使我的应用程序不重的技术开始,因为这些布局加上不浪费我的时间来制作应用程序数量的布局数量.
帮助的数量将被赞赏,我想要答案和建议,因为这些问题是新的和其他的开发人员面临的.
我的应用程序已经增长到超过50mb,所以我现在需要使用扩展文件.在搜索时我发现有不同的文件可以用作扩展文件,如zip,pdf等.我试图将我的数据放在.obb文件中,但我不知道如何创建这些文件并放入这些文件中的数据.
先更新
:
我发现该jobb工具用于创建obb文件.但我很困惑这个$ jobb -d /temp/assets/ -o my-app-assets.obb -k secret-key -pn com.my.app.package -pv 11命令是如何运行的.
我试图($ jobb -d /temp/assets/ -o my-app-assets.obb -k secret-key -pn com.my.app.package -pv 11在cmd 上运行它,但我的cmd说jobb无法识别为内部或外部命令.
第二: 我可以在这些obb文件中放入哪种类型的文件?我在考虑布局,可绘制的文件?
我想为不同的Android设备设置不同的视口.为此,我使用这段代码.
<head>
<meta name="viewport" content="width=device-width; initial-scale=0.91; maximum-scale=0.91; user-scalable=0;target-densityDpi=device-dpi" />
<script>
if (window.devicePixelRatio == 1)
{
document.querySelector("meta[name=viewport]").setAttribute('content', 'width=device-width, initial-scale=0.51, maximum-scale=0.51, user-scalable=0,target-densityDpi=device-dpi');
} else if (window.devicePixelRatio == 2) {
document.querySelector("meta[name=viewport]").setAttribute('content', 'width=device-width, initial-scale=0.51, maximum-scale=0.51, user-scalable=0');
} else if (window.devicePixelRatio == .78) {
document.querySelector("meta[name=viewport]").setAttribute('content', 'width=device-width, initial-scale=0.51, maximum-scale=0.51, user-scalable=0, target-densityDpi=device-dpi');
} else if (window.devicePixelRatio == 1.5) {
document.querySelector("meta[name=viewport]").setAttribute('content', 'width=device-width, initial-scale=0.51, maximum-scale=0.51, user-scalable=0, target-densityDpi=device-dpi');
}
</script>
</head>
Run Code Online (Sandbox Code Playgroud)
现在的问题是它没有设置适当的内容值.并在Logcat中给出此错误
视口参数值"device-width;" 关键字"宽度"无法识别.内容被忽略了
视口参数值"device-width;" 关键字"宽度"无法识别.内容被忽略了
视口参数键";初始缩放"未被识别和忽略.
视口参数值"no;" 用于关键的"用户可扩展"无法识别.内容被忽略了
视口参数键"device-dpi"无法识别和忽略.
有什么建议.抱歉编辑不好我无法编辑它.
编辑:
在那,我的视频仍然没有在Android设备上工作.我希望我应该只使用一个css和tat css应该根据设备缩放图像.
为此,我使用了具有target-dpidensity的Viewport,并在第一次使用初始和最大比例时它正在工作但是现在当我在android上运行这种方法时它会忽略Viewport.
实际上问题是,当我在html的背景中设置图像并在任何Android设备上运行此应用程序时,它会以缩放的方式呈现图像.为此,我改变我的皮肤html和app.java文件并禁用缩放情绪,并使用target-dpidensity但所有方法都不起作用这里是html代码:

这是css文件:
body {
background-repeat: …Run Code Online (Sandbox Code Playgroud) 所以我在上传 apk 时收到以下消息。现在为此,我在这个问题上进行了大量搜索,发现我的项目包含来自第三方 lib 的一些本机代码,在 apk 构建后,我分析了 apk 并知道有 lib 文件夹,而在 lib 文件夹中只有 arc 32 位文件正在生成。
因此,为此我删除了那些使用本机开发代码的第三方库,并添加了那些兼容的第三方库,这些库是本机无代码库。现在在此之后我构建了一个发布 apk 并通过 apk 分析器对其进行分析 现在通过分析器没有生成 lib 文件夹。然后再次分别在 32 位和 64 位架构上安装 apk 并且 apk 成功运行。
现在我在 google play 商店上传了应用程序,但仍然收到相同的警告。我已经三次检查了 apk,没有 lib 文件夹和 32 位 arch 的 .so 文件。任何帮助将不胜感激。
Warning
This release is not compliant with the Google Play 64-bit requirement
The following APKs or App Bundles are available to 64-bit devices, but they only have 32-bit native code: 5.
From August 1, 2019 …Run Code Online (Sandbox Code Playgroud) android ×9
amazon ×1
apk ×1
google-play ×1
html ×1
in-app ×1
java ×1
javascript ×1
kindle-fire ×1
volume ×1