Failure delivering result ResultInfo

前端 未结 2 1616
慢半拍i
慢半拍i 2021-01-17 08:09

There are many people who have encountered the same error on stackoverflow, but I haven\'t been able to find any relevant resolution in those posts. My MainActivity is start

相关标签:
2条回答
  • 2021-01-17 08:33

    The problem with me was that I used getIntent(), thus getting the intent of the current activity I was on.

    When I switched to data.getStringExtra() it worked. Amateur mistake...

    0 讨论(0)
  • 2021-01-17 08:52

    Try this-

    protected void onActivityResult(int requestCode, int resultCode, Intent data) 
    {
          if (requestCode == 1 && data != null) 
          {
             Log.v("TAG", data.getStringExtra("Note"));
             if(resultCode == RESULT_OK)
             {        
                 listItems.add(data.getStringExtra("Note"));
                 Log.v("TAG", data.getStringExtra("Note"));
                 adapter.notifyDataSetChanged();
                 listView.invalidateViews();
             }
             if (resultCode == RESULT_CANCELED) 
             {   
    
             }
          }
    }
    
    0 讨论(0)
提交回复
热议问题