How to get getIntent() to return null after Activity called with an Intent set

前端 未结 1 1885
迷失自我
迷失自我 2021-01-04 09:53

This question was similar to my original question, but I think there is a better way to approach a solution.

getIntent returns wrong intent when setIntent is followe

相关标签:
1条回答
  • 2021-01-04 10:09

    I found a solution that appears to work, but I expect there is a better way to do it.

        if (getIntent() != null && getIntent().getData() != null) {
            String data = getIntent().getDataString();
            getIntent().setData(null);
            setIntent(null);
    

    I think the setIntent isn't of any use, but the setData(null) seems to do the trick.

    0 讨论(0)
提交回复
热议问题