是否有与之完全相反的XML属性android:dependency?
我希望在检查另一个未选中时禁用其他依赖首选项并禁用它.
编辑:也许问题不在于android:dependency可能有一个xml属性,我可以添加,以使该偏好设置的默认值被禁用,然后android:dependency将按照我想要的相反方式切换它.
再次编辑:我尝试android:enabled="false"在首选项中进行设置,它会像我想要的那样禁用它,但即使它依赖于其他首选项它也没有像我希望的那样启用它
我在这里有一个简单的webview活动,加载后它会自动显示正在进行的通知.我们的想法是,人们可以远离此活动,并通过下拉菜单并选择它,从他们想要的任何屏幕再次快速访问它.然后,当他们想要时,他们可以通过点击菜单按钮并点击退出来关闭通知,然后清除通知.一切正常.但是,当按下通知时,它会启动活动的新实例.我需要更改什么才能看到活动是否尚未被销毁,我可以回调用该实例(恢复它),因此不需要再次加载它,也不需要在我的堆栈中添加其他活动.有任何想法吗?任何帮助将不胜感激.
package com.my.app;
import com.flurry.android.FlurryAgent;
import android.app.Activity;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.webkit.CookieSyncManager;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Toast;
public class Chat extends Activity {
private ProgressDialog progressBar;
public WebView webview;
private static final String TAG = "Main";
private NotificationManager mNotificationManager;
private int SIMPLE_NOTFICATION_ID;
@Override
public void onStart() {
super.onStart();
CookieSyncManager.getInstance().sync();
FlurryAgent.onStartSession(this, "H9QGMRC46IPXB43GYWU1");
}
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); …Run Code Online (Sandbox Code Playgroud) resume notifications android android-intent android-activity
因为当你使用sql lite时,如果你尝试在同一时刻执行一个函数它会抛出一个错误,我只是试图创建一个函数来检查它是否正在执行,如果它是在10毫秒再试一次,这个确切的函数工作正常如果我不必将任何参数传递给函数,但我很困惑如何将vars传递回它将执行的函数.
我想要做:
timer.addEventListener(TimerEvent.TIMER, saveChat(username, chatBoxText));
Run Code Online (Sandbox Code Playgroud)
但它只允许我这样做:
timer.addEventListener(TimerEvent.TIMER, saveChat);
Run Code Online (Sandbox Code Playgroud)
它给了我这个编译错误:
1067:将void类型的值隐式强制转换为不相关的类型函数
我怎样才能通过这个限制?
这是我得到的:
public function saveChat(username:String, chatBoxText:String, e:TimerEvent=null):void
{
var timer:Timer = new Timer(10, 1);
timer.addEventListener(TimerEvent.TIMER, saveChat);
if(!saveChatSql.executing)
{
saveChatSql.text = "UPDATE active_chats SET convo = '"+chatBoxText+"' WHERE username = '"+username+"';";
saveChatSql.execute();
}
else timer.start();
}
Run Code Online (Sandbox Code Playgroud) 我看了整个互联网,似乎无法找到我正在寻找...
我只是想找到一个网站,上面有一些关于如何使用OFFICIAL facebook android SDK的例子http://github.com/facebook/facebook-android-sdk
具体来说,我想看一些关于通知使用和简单照片上传的例子.但我会采取任何措施来帮助您了解使用SDK.
如果有人知道任何例子,请分享非常感谢!
我使用http://sharethis.com/按钮为网站上的用户提供了一种分享内容的简单方法.
他们在这里有关于"自定义按钮"的信息:http://help.sharethis.com/customization/custom-buttons
看起来像指定URL,在示例中他们只有像这样的html:
<span class="st_sharethis" st_url="http://mycustomurl.com" st_title="Sharing Rocks!"
displayText="ShareThis"></span>
Run Code Online (Sandbox Code Playgroud)
但我需要能够在不重新加载页面的情况下动态创建按钮.
所以,在一个flash应用程序我正在构建我有一个"分享按钮",触发网页上的javascript功能,使"弹出"div淡入屏幕中心,我想显示共享按钮.根据用户点击的共享按钮,它需要具有动态创建的URL.
重要的是,如果他们关闭对话框,然后再次单击共享按钮,我希望代码将使用新的按钮覆盖旧代码,使用新的url/titles.
所以,我创建了这个我从flash调用的javascript函数,同时从flash传递url.我将脚本和所有内容放在我的"弹出"div中,希望按钮将在该div内部呈现.
function shareChannel(theurl)
{
//I cant seem to find an example of what to put here to load the buttons, and give them a custom URL and title
//finally display the popup after the buttons are made and setup.
displaypopup();
}
Run Code Online (Sandbox Code Playgroud)
有没有人可能发布一个例子,说明如何在不重新加载页面的情况下做到这一点?
编辑:@Cubed
<script type="text/javascript">
function shareChannel(chaan)
{
document.getElementById('spID1').setAttribute('st_url', 'http://mycustomurl?chan='+chaan);
document.getElementById('spID1').setAttribute('st_title', 'Custom Title is ['+chann+'] it works!');
stButtons.locateElements();
centerPopupThree();
loadPopupThree();
}
</script>
Run Code Online (Sandbox Code Playgroud)
基本上没有任何反应.我讨厌使用javascript,因为我真的不知道如何获取错误消息或调试.当我使用flex时,我有一个很好的调试器/控制台来解决问题.所以,抱歉我无法提供更多信息.当我删除时,我注意到了 …
我正在使用Flex Hero预发布4.5,这是一款适用于Android的Flex Mobile应用程序.
我有一种情况,原始相机正在屏幕上显示,并在网络中传输.显然现在在AIR for android如果你只是在肖像中使用原始相机,它实际上并没有以肖像方式拍摄相机......它在错误的方向上是90度.所以,这是一个代码片段,我旋转了视频,它在手机上看起来很棒.但是,我需要将凸轮连接到网络流并发送它...但它发送侧面视频,我真的不想在远端调整它.我无法将视频附加到网络流...任何人都有任何想法我能做什么而不仅仅是等待AIR更新?
//i know i have width and height mixed up, its because im rotating it in a second and i dont want it to be stretched
nearVideo = new Video(near_video.height,near_video.width);
var m:Matrix = new Matrix();
//rotate here
m.rotate(Math.PI/2);
this.nearVideo.transform.matrix = m;
//repositioning it so it looks like its fitting in the container correctly
nearVideo.x=near_video.width;
nearVideo.y=(near_video.height-near_video.height);
if (Camera.isSupported)
{
nearCam = Camera.getCamera();
}
nearCam.setMode(near_video.height,near_video.width,10);
nearVideo.attachCamera(nearCam);
near_video.addChild(nearVideo);
//now its all great on screen...but when this comes up …Run Code Online (Sandbox Code Playgroud) 我想在一个简单的游戏中想出最好的方法来做一些随机比赛.
在使用Adobe Cirrus试验netStream时,我可以使用Cirrus轻松设置直接连接,发送数据,文本,视频和声音.我发现很容易得到一个简单的P2P连接,它就像我需要它一样工作.
但我真的想用ONLY卷云来实现随机配对功能,所以一切都是p2p ......
我怎样才能抓住同一组中的随机同伴...那与其他人没有直接联系?
一些想法:
- 我想也许我可以使用对象复制...当有人连接到GroupSpecifier时,我可以将另一个对象推入这个具有本地peerID及其状态的共享数组中.然后我可以在游戏中改变阵列.但后来我担心,如果这个人只是关闭网页窗口,就不能保证他们的输入会被删除.
- 我还想到只对包含nearID的组进行"发布",其他同伴可以获得帖子......那些不在游戏中的人会尝试直接连接回来.然后那边将连接到他们.那么他们都会彼此直接联系.但后来我觉得如果有可能100多人"可用"...得到帖子......然后他们都试图连接到一个人,那么它可能会导致问题.
- 而且,我想过刚做sendToNearest ......但是这不是最适合人们的方式......因为你认为只有这么多邻居......如果团里有1000人.你只能连接到实际上认为你的邻居的几个同行吗?那么基本上你最终只能与同样的5-10人匹配,或者在技术上被认为是邻居.
是否有一行简单的代码只允许在OS版本满足要求时加载代码?
让我说我的目标操作系统为2.2,但是对于Android 1.5,min sdk为3,所以即使我的项目中有一些与1.5不兼容的代码,它仍然会编译,因为目标操作系统是2.2.无论如何,我想要广告一项功能,该功能需要不在1.5 SDK中的代码,并且如果它在1.5手机上加载会导致崩溃.有这么简单的事情,我可以做吗?所以我不必让1.5用户无法使用整个应用程序?
if (Android OS == >2.1){
//Insert code here that requires 2.1 and up}
else{
//insert code that would appear is OS is <2.1}
Run Code Online (Sandbox Code Playgroud) dismiss()在加载webview后,我需要对代码进行对话才能生成什么内容?
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
CookieSyncManager.createInstance(this);
CookieSyncManager.getInstance().startSync();
webview = (WebView) findViewById(R.id.webview);
webview.setWebViewClient(new homeClient());
webview.getSettings().setJavaScriptEnabled(true);
webview.getSettings().setPluginsEnabled(true);
webview.loadUrl("http://google.com");
ProgressDialog pd = ProgressDialog.show(Home.this, "",
"Loading. Please wait...", true);
}
Run Code Online (Sandbox Code Playgroud)
我试过了
public void onPageFinshed(WebView view, String url){
pd.dismiss();
}
Run Code Online (Sandbox Code Playgroud)
没工作.
基本上我需要显示到指定时间的时间或者它是否通过了多长时间,它过了多长时间.
原始字符串看起来像这样: 07/20/2011 01:13 am
编辑:从在javascript转换到PHP切换:
//get local time in UTC format
echo gmdate("Y/m/d\TH:i:s\Z");
echo '<br />';
//convert time to UTC
$the_date = strtotime("07/20/2011 01:13 am");
echo date("Y/m/d\TH:i:s\Z",$the_date);
Run Code Online (Sandbox Code Playgroud)
执行上述操作后,我可以使用以下内容:
//local time
2011/07/20T19:49:39Z
//specified time
2011/07/20T01:13:00Z
Run Code Online (Sandbox Code Playgroud)
如何获取指定的时间和当地时间并使其显示如下示例:
Started 36 mins ago
Will start in 33 mins
Will start in 6 hrs 21 mins
Will start in 4 days 4 hrs 33 mins
Run Code Online (Sandbox Code Playgroud)