小编Chi*_*tan的帖子

onActivityResult方法没有被称为Android

我正在尝试将子活动的数据发送到父级.但不知何故,onActivityResult(..)没有被调用.这是代码

家长活动

selectedText.setOnTouchListener(new OnTouchListener() {



    public boolean onTouch(View v, MotionEvent event) {
                    if (event.getActionMasked() == MotionEvent.ACTION_DOWN) {
                        Intent intent = new Intent(Parents.this,Child.class);
                        startActivityForResult(intent, 1);
                    }
                    return true;
                }
            });


        @Override
        protected void onActivityResult(int requestCode, int resultCode, Intent data) {
            switch (requestCode) {
            case 1:
                if (resultCode == RESULT_OK) {
                    if (data.hasExtra("selText")) {
                        selectedText.setText(data.getExtras().getString(
                                "selText"));

                    }
                    break;
                }
            }
Run Code Online (Sandbox Code Playgroud)

子活动:我可以在setResult()中看到选定的值集.但是在儿童活动完成之后,它不会回到父母活动.

textListView.setOnItemClickListener(new OnItemClickListener() {

            @Override
            public void onItemClick(AdapterView<?> arg0, View arg1, int myItemInt,
                    long arg3) {
                selectedFromList =(String) (textListView.getItemAtPosition(myItemInt));
                Intent data = …
Run Code Online (Sandbox Code Playgroud)

android android-activity

19
推荐指数
2
解决办法
2万
查看次数

每次在Android中创建新的Pending Intent

如何每次创建待处理的意图?目前,我现有的待定意图将被替换为新的意图.我尝试使用FLAG_ONE_SHOT,CANCEL_CURRENT但它没有用.

android android-pendingintent

17
推荐指数
2
解决办法
2万
查看次数

将数据从活动发送到服务

如何将数据从当前数据发送ActivityService在特定时间运行的后台类?我尝试过上课,Intent.putExtras()但我没Service上课

Activity调用中的类中的代码Service

Intent mServiceIntent = new Intent(this, SchedulerEventService.class);
        mServiceIntent.putExtra("test", "Daily");
        startService(mServiceIntent);
Run Code Online (Sandbox Code Playgroud)

Service课堂上的代码。我TREID摆在onBind()onStartCommand()。这些方法都不能打印该值。

@Override
public IBinder onBind(Intent intent) {
    //Toast.makeText(this, "service starting", Toast.LENGTH_SHORT).show();

    //String data = intent.getDataString();

    Toast.makeText(this, "Starting..", Toast.LENGTH_SHORT).show();

    Log.d(APP_TAG,intent.getExtras().getString("test"));


    return null;
}
Run Code Online (Sandbox Code Playgroud)

android android-service

5
推荐指数
1
解决办法
2万
查看次数

使用JAXB解组SOAP消息

当我在SOAP消息下面进行解组时,我会遇到异常.谁能告诉我有什么问题?

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/" xmlns:hios="http://schemas.datacontract.org/2004/07/HIOSCommonObjects">
   <soapenv:Header/>
   <soapenv:Body>
      <tem:ValidIssuersProducts>
         <!--Optional:-->
         <tem:li>
            <!--Zero or more repetitions:-->
            <hios:IssuerProductRequest>
               <!--Optional:-->
               <hios:Issuer>33104</hios:Issuer>
               <!--Optional:-->
               <hios:Product>33104VA001</hios:Product>
            </hios:IssuerProductRequest>
         </tem:li>
      </tem:ValidIssuersProducts>
   </soapenv:Body>
</soapenv:Envelope>
Run Code Online (Sandbox Code Playgroud)

解组代码如下,clazz是"ValidIssuersProducts的完全限定名称"请求.

public static <T> Object unmarshall(String xml, String clazz) throws ClassNotFoundException, JAXBException {
        JAXBContext context = JAXBContext.newInstance(Class.forName(clazz));
        ByteArrayInputStream input = new ByteArrayInputStream (xml.getBytes());     
        Unmarshaller unmarshaller = context.createUnmarshaller();   
        //JAXBElement<ValidIssuersProducts> obj = (JAXBElement<ValidIssuersProducts>) unmarshaller.unmarshal(new StreamSource(input), ValidIssuersProducts.class);

        ValidIssuersProducts value = (ValidIssuersProducts)unmarshaller.unmarshal(input);
        return  value;

    }
Run Code Online (Sandbox Code Playgroud)

我得到以下异常:

javax.xml.bind.UnmarshalException: unexpected element (uri:"http://schemas.xmlsoap.org/soap/envelope/", local:"Envelope"). Expected elements are <{http://tempuri.org/}ArrayOfIssuerProductRequest>,<{http://tempuri.org/}ArrayOfIssuerProductResponse>,<{http://tempuri.org/}IssuerProductRequest>,<{http://tempuri.org/}IssuerProductResponse>,<{http://tempuri.org/}ValidIssuersProducts>,<{http://tempuri.org/}ValidIssuersProductsResponse>
    at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleEvent(UnmarshallingContext.java:642)
    at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:254)
    at …
Run Code Online (Sandbox Code Playgroud)

jaxb unmarshalling

5
推荐指数
1
解决办法
2万
查看次数

通过SSL的IE8附件下载问题

在IE8上通过SSL下载excel文件时,我们收到错误:"无法从MyHostName.Unable下载Document.ashx以打开此Internet站点.请求的站点不可用或无法找到.请稍后再试."

我们尝试了几种解决方案,但除了regedit(这是不可行的)之外,它们都没有工作.

1)根据http://support.microsoft.com/kb/323308尝试注册表编辑,它工作正常.但是,这不是一个可行的解决方案.2)根据此链接http://support.microsoft.com/kb/815313尝试解决方案,如果您"复制快捷方式"并通过浏览器URL运行它们,他们会说下载文件.但是,这个解决方案并不一致并且有时有效,但大多数都没有用.

3)将我们的java控制器代码更新为response.setHeader("Cache-Control","must-revalidate,private"); response.setDateHeader("Expires", - 1)但是当我们查看标题时它仍显示为"cache-control:no-cache".这个解决方案也行不通

4)在IE 8浏览器上取消选中"不将加密文件保存到磁盘"选项.但那也行不通.http://blogs.msdn.com/b/ieinternals/archive/2010/04/21/internet-explorer-may-bypass-cache-for-cross-domain-https-content.aspxhttp:// support. microsoft.com/kb/2549423

还在互联网上搜索了上面提出的各种选项,但没有一个是完整的证据.

如果有人有上述以外的解决方案.请分享一下.

谢谢

ssl attachment download internet-explorer-8

4
推荐指数
1
解决办法
7113
查看次数