How to handle the ActivityNotFoundException?

后端 未结 4 1672
别跟我提以往
别跟我提以往 2021-01-18 07:31

In my app , I need to use startActivity to see the content of the file , or use the default application to open the certain file , but sometimes the android system may not i

4条回答
  •  梦谈多话
    2021-01-18 08:06

    If you want to display error as toast then

    try {
        startActivity(intent);
    
    } catch (ActivityNotFoundException e) {
        // TODO: handle exception
        //Show Toast...
    }
    

    The error occurs because the activity not mentioned in the manifest file.

    
    
    

提交回复
热议问题