我正在开发一个小程序,我需要添加一个自定义对话框,在关闭时将一些信息传递给调用活动.我扩展了对话框类,当我尝试在关闭时捕获自定义对话框时,使用onDismiss侦听器,它永远不会到达它,因为我使用了自定义对话框.
这是我活动的一部分 -
.
.
.
attributes customizeDialog = new attributes(con,position,pick.getLastVisiblePosition());
customizeDialog.show();
Run Code Online (Sandbox Code Playgroud)
(属性是扩展对话框类的类的名称).
这是我在对话框完成时设置的事件监听器 -
customizeDialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
Log.v("LOG_CAT",attributes.selectedIndexes.get(0) + " " + attributes.selectedIndexes.get(1) + " " + attributes.selectedIndexes.get(2) + " " + attributes.selectedIndexes.get(3) + " " + attributes.selectedIndexes.get(5) + " ");
}
});
Run Code Online (Sandbox Code Playgroud)
我知道我做错了,我只是不知道如何解决它.
我真的很感激这个问题的任何帮助.
谢谢!
在Unity 3D中,有一个带有Transform属性的GameObject.变换具有位置(Vector3)和旋转(四元数).我想通过protobuf-net将这些GameObjects发送到后备存储中.我目前正在使用以下代码,但GameObject.transform.position.x,y,z和transform.rotation.x,y,z,w似乎没有存储在序列化文件中?
RuntimeTypeModel model = TypeModel.Create();
model.AutoAddMissingTypes = true;
model.Add(typeof(Vector3), true).Add("x","y","z");
model.Add(typeof(Transform), true).Add("position").Add("rotation");
model.Add(typeof(Quaternion), true).Add("x","y","z","w");
model.Add(typeof(GameObject), true).Add("transform").Add("name");
model.SerializeWithLengthPrefix(fs, go, typeof(GameObject), PrefixStyle.Base128, 0);
Run Code Online (Sandbox Code Playgroud)
反序列化:
using (FileStream fs = new FileStream(path, FileMode.Open))
{
fs.Position = 0;
RuntimeTypeModel model = TypeModel.Create();
model.AutoAddMissingTypes = true;
model.Add(typeof(Vector3), true).Add("x","y","z");
model.Add(typeof(Transform), true).Add("position").Add("rotation"); ;
model.Add(typeof(Quaternion), true).Add("x","y","z","w");
model.Add(typeof(GameObject), true).Add("transform").Add("name");
do
{
len = ProtoReader.ReadLengthPrefix(fs, false, PrefixStyle.Base128, out fieldNumber, out bytesRead);
if (bytesRead <= 0) continue;
gos.Add((GameObject)model.Deserialize(fs, null, typeof(GameObject), len));
} while (bytesRead > 0);
}
Run Code Online (Sandbox Code Playgroud)
我似乎回到了正确数量的GameObjects,但反序列化唯一正确的是.name属性.我没有使用当前代码转换Transform类的子属性.任何想法都会非常有用!
谢谢-
根据我的评论,这里是堆栈跟踪: …
我正在尝试移植JXTA以在App Engine上运行.鉴于App Engine尚不支持BouncyCastle"BC"提供程序,我必须移植现有的JXTA代码以使用列入白名单的类生成X509Certificate.我对Crypto的了解很少,我不确定我想要实现的目标是否可行.以下是来自JXTA项目的PSEUtils.java的原始代码:
有一个包含java.security.cert.X509Certificate的帮助器类:
public static class IssuerInfo {
public X509Certificate cert; // subject Cert
public PrivateKey subjectPkey; // subject private key
public X509Certificate issuer; // issuer Cert
public PrivateKey issuerPkey; // issuer private key
}
Run Code Online (Sandbox Code Playgroud)
在方法中:
public static IssuerInfo genCert(X500Principal subject, KeyPair keypair, IssuerInfo issuerinfo)
Run Code Online (Sandbox Code Playgroud)
我将主题传递给:
new X500Principal("CN="+useCN)
Run Code Online (Sandbox Code Playgroud)
密钥对(来自原始代码):
KeyPairGenerator g = KeyPairGenerator.getInstance("RSA");
g.initialize(1024, UTILS.srng);
KeyPair keypair = g.generateKeyPair();
Run Code Online (Sandbox Code Playgroud)
和jxta编码的IssuerInfo.
现在因为我无法引入bouncycastle.jce包,我必须删除JXTA使用的X509Principal和X509V3CertificateGenerator代码,并尝试用符合GAE限制的实现替换它.以下是我目前使用org.bouncycastle.X509.X509v3CertificateBuilder的genCert方法.
SubjectPublicKeyInfo subPubKeyInfo = SubjectPublicKeyInfo.getInstance(keypair.getPublic().getEncoded());
X509v3CertificateBuilder v3CertGen = new X509v3CertificateBuilder(
new X500Name(issuer.getName()),
BigInteger.ONE,
today, …Run Code Online (Sandbox Code Playgroud) 我想从一个URL重定向到另一个URL:
http://female.deals.com/
http://male.deals.com/
Run Code Online (Sandbox Code Playgroud)
如何通过URL更改为浏览器中的新URL并使页面直接转到新URL而不转到旧URL并进行刷新来实现这一目标?
我在互联网上查看了一些脚本并且它们没有工作,我也不知道ASP经典.所以我正在努力使重定向工作.