Skip to content Skip to sidebar Skip to footer

Error:error: Try Is Not A Valid Resource Name (reserved Java Keyword)

I want to display a pdf file in my app . Where i was stored pdf file in raw folder . Where pdf name is 'try.pdf' my code is this : File file = new File(R.raw.try); Uri path = Uri.f

Solution 1:

Here is the error

Filefile=newFile(R.raw.try);

Rename your file try.pdf to anything else (except whats mentioned here https://docs.oracle.com/javase/tutorial/java/nutsandbolts/_keywords.html). You can't use a Java-reserved keyword, which try is.

Solution 2:

Important point: You can not use a reserved keywords.

Post a Comment for "Error:error: Try Is Not A Valid Resource Name (reserved Java Keyword)"