It is not obvious why you need this array or exactly what you are trying to do with it. You also need to instantiate a Global object somewhere, rather than trying to call getApplicationContext and trying to cast it to a Global.
However your reference code needs to look like:
Global myGlobal = new Global();
// this will not work as you have coded it// final Global globalVariable = (Global) getApplicationContext();//set the value for myarray// but first you need to get the reference to the array:
string myArray = myGlobal.getMyarray(); // returns the array reference
myArray = "me"; // set the value of a single array element// get the value of myarray finalString name = myArray;
Although the above code will (sort of) work it is still lacking context so you need to provide more information on what you are trying to do.
I was to build a simple e-retail android application for our shop. It should have basic features like add to cart, payment and search features. I am comfortable with the basics of android. However, i am still not aquatinted with back-end and server-side development. Please can anyone suggest suitable sites or links to guide me for this project?
(PS: I want to develop the app myself rather than taking help from any external app development company etc.)
Learn how to consume REST APIs in Android applications. Then, create a RESTful API to communicate with the cloud. Other frameworks may have other confusion in them and that is one of the reasons why I don't use those frameworks.
Create a simple web applications, Node.js, PHP, ASP.NET, doesn't matter. Allow users to connect using native HTTP protocol, to RESTful APIs, where the communication input and outputs are natively in JSON (no overhead). Then, program the rest of the parts of the application to use that JSON content, and upload the JSON content. For bulk or blob publishing, accept the files and set the enctype to multipart/form-data.
07-26 19:48:22.594 2618-2618/com.example.example E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.example, PID: 2618
java.lang.NullPointerException: storage == null
at com.example.example.CustomList.<init>(CustomList.java )
at java.lang.reflect.Method.invoke(Native Method)
It is difficult to see exactly which variable is null, but it looks like you are sending a null value from the CustomList constructor, to create the new ArrayAdapter. You should look at your ParseJSON class to see what values it is returning.
As the exception shows, the problem is a null pointer being referenced with the CustomList class. The line number has been replaced by a blushing emoticon, but as Richard has indicated, the problem may have originated a bit further upstream. Have you stepped through the code using the debugger? What about some strategically placed try/catch blocks?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
As with most such questions there is only one answer:
1. Start with some (a lot of) research.
2. Study the documentation and sample code.
3. Write your application.
4. Build and test, correcting any and all bugs.
5. Repeat 4 until everything works.