How to use a final variable in other activities?
How to use a final variable in other activities?
I tried to add a photo of my code but it was not uploading since it was above 2MB.
Instead of changing the size I decided to choose another picture to complete the formality. However, my question is simple, it doesn't need any additional code to be understood.
Welcome to Stack Overflow. Please see these few links about asking good questions; How do I ask a good question?, Short, Self Contained, Correct (Compilable), Example, and How to create a Minimal, Complete, and Verifiable example
– Dan
Jun 30 at 8:27
Also to show code you should not use an image, you should indent copy and paste you code into your question, formatting each line with four spaces at the start. This highlights your code and makes it easier for others to read
– Dan
Jun 30 at 8:30
@ThePythonInventor Did my answer answer your question or were you struggling with something else?
– Dan
2 days ago
1 Answer
1
You could use a public static final variable. For example
public static final int FINAL_INT = 3;
Usage
You would then call this in your other activity.
MyActivity.FINAL_INT
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Your question body doesn't seem to match your question title.
– Kling Klang
Jun 30 at 8:24