problem with memory with array size

Put your problem here if it does not fit any of the other categories.

problem with memory with array size

Postby gpolis » Wed Feb 15, 2012 6:35 pm

Hello,i have in one activity:

Code: Select all
public void onCreate(Bundle savedInstanceState) {

time=(EditText) findViewById(R.id.time);
...
public void mass_func(){
        ...
       double ttime=Double.parseDouble(time.getText().toString().trim());
       double res=mass*(Math.pow(0.5,ttime/half_time));
       ....
       //filling the array
       int temp=(int) ttime;

       ArrayList <MyDouble> final_mass=new ArrayList <MyDouble>(temp);//i want the size to be maximum as the ttime

           for (int i=0;i<=temp;i++){
          MyDouble m1=new MyDouble(mass*(Math.pow(0.5,i/half_time)));
          final_mass.add(m1);           
                        }

      Intent i=new Intent(this,mass_calcs.class);
        ...
       i.putExtra("time",ttime);
       i.putParcelableArrayListExtra("final_mass",final_mass);
       startActivity(i); 

     }


From the mass_calcs activity i just pass the values to the LineGraph activity. The LineGraph activity is:

Code: Select all
public class LineGraph_mass extends Activity {

    ...
    private Double ttime;
    ArrayList <MyDouble> final_mass=new ArrayList <MyDouble>(ttime.intValue());
   


The problem is that when the user inputs a value for time about '4000-5000' the application crashes. I am getting error "GC_FOR_MALLOC freed..." which implies memory leakage.

From what i have read until now, one way to deal is giving the arraylist a size.

I am defining "ArrayList final_mass=new ArrayList (temp);" at the first activity and tried sth like "...==new ArrayList (ttime.intValue());" at the LineGraph ,but it won't work.

(I also tried sth like "...==new ArrayList (10000)" but it doesn't work either.

Is sth that i can do for this?
Thank you!
gpolis
Developer
Developer
 
Posts: 38
Joined: Wed Feb 15, 2012 6:28 pm

Top

Re: problem with memory with array size

Postby Phyll » Wed Feb 15, 2012 9:58 pm

Hi gpolis,

I can think of a couple things right off. The array of 10000 doubles is pretty big. Is there any way to cut this down? For instance calculate the final integer values that the line graph will show and send them to the routine or put the calculations into a file and send the filename to the routine. When you pass those values over to the next activity, they are actually using twice as much room maybe since the array is copied I think for the pass. Perhaps if the app is living with just one copy, you could make it an application wide variable and just use it in both activities.

Hope this helps.

Phyll
Phyll
Master Developer
Master Developer
 
Posts: 648
Joined: Fri Oct 14, 2011 11:19 am

Re: problem with memory with array size

Postby gpolis » Thu Feb 16, 2012 4:11 pm

Hello , (i am new to java and android ,so take it easy)

I try this : ArrayList <MyDouble> final_mass=new ArrayList <MyDouble>(temp)

It supposes to make 'final_mass' size equal to temp (which is the ttime where i have the problem)

I pass this arraylist using parcelable.

You say to store this array to a file?And then retrieve it?So,don't use parcelable?
And if yes, can you point me to some kind of tutorial on how to save arraylist to a file?

Also , i didn't understand the thing you said "calculate the final integer values that the line graph will show "

Thanks!
gpolis
Developer
Developer
 
Posts: 38
Joined: Wed Feb 15, 2012 6:28 pm

Re: problem with memory with array size

Postby Phyll » Thu Feb 16, 2012 6:22 pm

Hi gpolis,

Yes I think your parcelable is making yet another big array of doubles and using too much memory. I'm not sure exactly what you are doing so the solutions I put forth in my last post were kind of general.

One of them assumes that you are going to draw a line graph. The display has a finite resolution, so calculate the screen coordinates which are at least float. But I think you could take them all the way to ints before you try to pass them to the other activity. They will take up very much less memory that way.

If you really want to keep all the resolution it has up until you draw it, you could write the values to a file as you make them and then pass that filename on to the drawing activity. I can show you how to do that.

Another way would be to not pass them at all but use an application global variable that would just be visible to both of the activities in question. You make it with one and read it with the other. I'll see if I have an example.

I think the file is the way to go myself. I hope this explains things a little better.

Phyll

EDIT

Here is an example of a way to store an arraylist of doubles. If it works for you, you can work on improving it.

Code: Select all
        //make some double values       
        int i = 0;
        while (i<100) {
           
           //This is how they are stored
           //ArrayList<Double> values = new ArrayList<Double>();
           
           values.add((double) i*1.00d);
           i++;
            }//make some values
       
        //the filename and a temporary string
        //saving to private file in data/data/package folder
        String fs = "/data/data/com.your.package/binarytest";
        String s;
       
        //the IO files
        FileOutputStream fos;
        FileInputStream fis;
       
        //saving them
      try {
         fos = new FileOutputStream(fs);
            BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(fos));
            i = 0;
            while (i<values.size()) {
             bw.write(values.get(i)+"\n");
               i++;
                }//writing values
         bw.flush();
         bw.close();
          } catch (IOException e2) {
             e2.printStackTrace();
              }//catch

        //loading them back somewhere else
        values.clear();

      try {
         fis = new FileInputStream(fs);
            BufferedReader br = new BufferedReader(new InputStreamReader(fis));
            do {
            s = br.readLine();
                if (s != null) values.add(Double.parseDouble(s));
                } while (s != null);
          } catch (IOException e) {
             e.printStackTrace();
              }
      
      //test it (should equal 50.0)
      Log.i("DOUBLE",values.get(50)+"");
Phyll
Master Developer
Master Developer
 
Posts: 648
Joined: Fri Oct 14, 2011 11:19 am

Re: problem with memory with array size

Postby gpolis » Fri Feb 17, 2012 12:37 pm

Thanks for the help.I don't understand how to load the values. I did this :

Code: Select all
public void mass_func(){
        double mass=Double.parseDouble(num_mass.getText().toString().trim());
        double half_time=Double.parseDouble(halftime.getText().toString().trim());
        double ttime=Double.parseDouble(time.getText().toString().trim());
        double res=mass*(Math.pow(0.5,ttime/half_time));
        
        int temp=(int)ttime;

        ArrayList <MyDouble> final_mass=new  ArrayList <MyDouble>(temp);
        
       for (int i=0;i<=temp;i++){
         MyDouble m1=new MyDouble(mass*(Math.pow(0.5,i/half_time)));
         final_mass.add(m1);             
                   }
       
       //saving to private file in data/data/package folder
       String fs = "/data/data/com.wordpress.androiddevgeo/results";
       String s;
       //the IO files
       FileOutputStream fos;
       FileInputStream fis;
       
       //saving them
       try {
          fos = new FileOutputStream(fs);
             BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(fos));
             int k = 0;
             while (k<final_mass.size()) {
              bw.write(final_mass.get(k)+"\n");
                k++;
                 }//writing values
          bw.flush();
          bw.close();
           } catch (IOException e2) {
              e2.printStackTrace();
               }//catch
       
       
        Intent i=new Intent(this,mass_calcs.class);
        i.putExtra("result",res);
        i.putExtra("mass",mass);
        i.putExtra("time",ttime);
        i.putParcelableArrayListExtra("final_mass",final_mass);
       startActivity(i); 
        finish();
     }


(Note that i am using parcelable to pass "final_mass" to other activity.If i store the arraylist to a file , i musn't use the putParcelableArrayListExtra right?)

Now, in the mass_calcs activity :

Code: Select all
public void onClick(View v) {
       switch (v.getId()){
       case R.id.show_mass_graph:
          double res=getIntent().getExtras().getDouble("result");
            double mass=getIntent().getExtras().getDouble("mass");
            double ttime=getIntent().getExtras().getDouble("time");
            ArrayList<MyDouble> final_mass=getIntent().getExtras().getParcelableArrayList("final_mass");
           
          //loading them back somewhere else
            final_mass.clear();
          //saving to private file in data/data/package folder
            String fs = "/data/data/com.wordpress.androiddevgeo/results";
            String s;
            //the IO files
            FileOutputStream fos;
            FileInputStream fis;
           
          try {
             fis = new FileInputStream(fs);
                BufferedReader br = new BufferedReader(new InputStreamReader(fis));
                do {
                s = br.readLine();
                    if (s != null) final_mass.add(Double.parseDouble(s));
                    } while (s != null);
              } catch (IOException e) {
                 e.printStackTrace();
                  }
           
          Intent i = new Intent();       
          i.setClassName("com.wordpress.androiddevgeo.Radiation",LineGraph_mass.class.getName());                 
          i.putExtra("result",res);
            i.putExtra("mass",mass);
            i.putExtra("time",ttime);
            i.putParcelableArrayListExtra("final_mass",final_mass);
          this.startActivity(i); 
            break;
}     
    }


(Note that the "if (s != null) final_mass.add(Double.parseDouble(s)); " doesn't work (because final_mass is parcelable)

I don't get how to load the values?
gpolis
Developer
Developer
 
Posts: 38
Joined: Wed Feb 15, 2012 6:28 pm

Re: problem with memory with array size

Postby Phyll » Fri Feb 17, 2012 3:43 pm

Hi gpolis,

Wow, ok. Lets start with what I thought you were doing. This is how I understand it.

1. Calculate an array of double data. Looks like it has temp elements and store it into a file.

2. Start another activity to work on the data.

3. Retrieve the data from the file into an array and then graph or graph on the fly.

Here's how you can do the saving part:

Code: Select all
public void mass_func() {
        double mass=Double.parseDouble(num_mass.getText().toString().trim());
        double half_time=Double.parseDouble(halftime.getText().toString().trim());
        double ttime=Double.parseDouble(time.getText().toString().trim());
        double res=mass*(Math.pow(0.5,ttime/half_time));
       
        int temp=(int)ttime;
       
       //saving to a file and calculating at the same time
       String fs = "/data/data/com.wordpress.androiddevgeo/results";

       FileOutputStream fos;
       
       //saving them
       try {
          fos = new FileOutputStream(fs);
             BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(fos));
             int k = 0;
             Double m1;
             while (k<temp) {
                 m1=mass*(Math.pow(0.5,k/half_time));
                 bw.write(m1+"\n");
                 k++;
                 }//writing values
          bw.flush();
          bw.close();
           } catch (IOException e2) {
              e2.printStackTrace();
               }//catch
     
        Intent i=new Intent(this,mass_calcs.class);
        i.putExtra("result",res);
        i.putExtra("mass",mass);
        i.putExtra("time",ttime);
        startActivity(i);                         //never coming back?
        finish();                                    //Don't call finish here if you want to return
     }


Here's how you do the other activity:

Code: Select all

//Make this in this one
ArrayList<Double> final_mass = new ArrayList<Double>();  //no size because we don't know yet

public void onClick(View v) {
       switch (v.getId()){
       case R.id.show_mass_graph:
          Intent i = getIntent();
          double res=i.getExtras().getDouble("result");
          double mass=i.getExtras().getDouble("mass");
          double ttime=i.getExtras().getDouble("time");
           
          //loading them back somewhere else
            final_mass.clear();

          //saving to private file in data/data/package folder
            String fs = "/data/data/com.wordpress.androiddevgeo/results";
            String s;

           FileInputStream fis;
           
          try {
             fis = new FileInputStream(fs);
                BufferedReader br = new BufferedReader(new InputStreamReader(fis));
                do {
                    s = br.readLine();
                    if (s != null) final_mass.add(Double.parseDouble(s));
                    //could graph it here maybe as they come in
                    //guess you might need the total number first
                    //could send that with the others in the intent
                    } while (s != null);
              } catch (IOException e) {
                 e.printStackTrace();
                  }
           
            int temp = final_mass.size();

            //This activity should show the graph not call any more.
            //Notice there is no longer any need for a parcelable double.
            //Nor this switch or click from what I can tell

            break;
}     
    }


I just kind of tinkered with your code here in this editor so I don't know if there any errors. Shouldn't be. Anyway,
it looked like you were going to go on and call yet another activity after this one. I think you should do whatever it is you were going to do, right here in this one or move this to the next one. Either way you are not causing multiple copies of the data to be created everytime you change activites. Just call this loader routine when you need it and null those other instances when you are finished with them.

If shouldn't be such a foreign concept because everything on these things is stored in memory one way or another. Its just a matter of how we refer to them as an array or a file isn't it.

Hope this helps.

Phyll
Phyll
Master Developer
Master Developer
 
Posts: 648
Joined: Fri Oct 14, 2011 11:19 am

Top

Re: problem with memory with array size

Postby gpolis » Fri Feb 17, 2012 5:40 pm

It helped me a lot!
I pass the results (final_mass) and it calculates them.
Now,the only problem that i have is that in the linegraph activity it throws me index out of bounds and runtime exceptions (you said to do it in one activity ,but i want to pass again the final_mass to the linegraph activity).


So,

Code: Select all
public class LineGraph_mass extends Activity {
   
   ...
   ArrayList<Double> final_mass = new ArrayList<Double>();
   ...
   
   public void onCreate(Bundle savedInstanceState){
      
      super.onCreate(savedInstanceState);
      
      Bundle extras=getIntent().getExtras();
      ...
                            startActivity(getIntent(this));
   }
   
   public Intent getIntent(Context context){
   ...
       
            //loading them back somewhere else
            final_mass.clear();

         //saving to private file in data/data/package folder
          String fs = "/data/data/com.wordpress.androiddevgeo/results";
           String s;

       FileInputStream fis;
       
      try {
         fis = new FileInputStream(fs);
            BufferedReader br = new BufferedReader(new InputStreamReader(fis));
            do {
                s = br.readLine();
                if (s != null) final_mass.add(Double.parseDouble(s));
                //could graph it here maybe as they come in
                //guess you might need the total number first
                //could send that with the others in the intent
                } while (s != null);
          } catch (IOException e) {
             e.printStackTrace();
              }       
       
         ArrayList<Double> x =new ArrayList<Double>();
         ArrayList<Double> y =new ArrayList<Double>();
                 
         //fill x,y values
         int temp=ttime.intValue();
         for (int i=0;i<=temp;i++){
            x.add((double)(temp/temp)*i);   
         }
       
       for (int i=0;i<=temp;i++){
         y.add(final_mass.get(i));           
       }
       
      TimeSeries series = new TimeSeries("Remaining mass");
      for (int i=0;i<x.size();i++){         
         series.add(x.get(i),y.get(i));   
         
      }
...


What am i don't doing right here?
Thanks!
gpolis
Developer
Developer
 
Posts: 38
Joined: Wed Feb 15, 2012 6:28 pm

Re: problem with memory with array size

Postby Phyll » Fri Feb 17, 2012 8:16 pm

Hi gpolis,

The easiest thing to do would just be to do it all again. That of course is making it all slower but it will work. You
would do it by making the on click look like this.

Code: Select all
//Make this in this one
ArrayList<Double> final_mass = new ArrayList<Double>();  //no size because we don't know yet

public void onClick(View v) {
       switch (v.getId()){
       case R.id.show_mass_graph:
          Intent i = getIntent();
          double res=i.getExtras().getDouble("result");
          double mass=i.getExtras().getDouble("mass");
          double ttime=i.getExtras().getDouble("time");
           
          //loading them back somewhere else
            final_mass.clear();

          //saving to private file in data/data/package folder
            String fs = "/data/data/com.wordpress.androiddevgeo/results";
            String s;

           FileInputStream fis;
           
          try {
             fis = new FileInputStream(fs);
                BufferedReader br = new BufferedReader(new InputStreamReader(fis));
                do {
                    s = br.readLine();
                    if (s != null) final_mass.add(Double.parseDouble(s));
                    } while (s != null);
              } catch (IOException e) {
                 e.printStackTrace();
                  }
           
            int temp = final_mass.size();

       FileOutputStream fos;
       
       //saving them
       try {
          fos = new FileOutputStream(fs);
             BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(fos));
             int k = 0;
             while (k<temp) {
                 bw.write(final_mass.get(k)+"\n");
                 k++;
                 }//writing values
          bw.flush();
          bw.close();
           } catch (IOException e2) {
              e2.printStackTrace();
               }//catch
     
        Intent i=new Intent(this,linegraph_mass.class);
        i.putExtra("result",res);
        i.putExtra("mass",mass);
        i.putExtra("time",ttime);
        startActivity(i);                         
        finish();                     

            //You should be able to see that this activity just becomes a big time
            //wasting "pass thru" but it would work

            break;
}     
    }


Then linegraph_mass would have to do the same things as the first half of this to get the array back. Then calculate your x and y values. I see in your for loops that i can range from 0 to temp. If temp is the number of elements in the array it will always throw that index out of range error because temp-1 is the last valid index. Should be i<temp.

Hope this helps.

Phyll
Phyll
Master Developer
Master Developer
 
Posts: 648
Joined: Fri Oct 14, 2011 11:19 am

Re: problem with memory with array size

Postby gpolis » Sat Feb 18, 2012 3:56 pm

Ok, we are a step away from the solution!

It gives me again index out of bounds.The problem is with variable 'temp'.

In the 1 activity ,we do :

Code: Select all
public void mass_func(){
     ...
        double ttime=Double.parseDouble(time.getText().toString().trim());
        double res=mass*(Math.pow(0.5,ttime/half_time));
        
        int temp=(int)ttime;
                 ...
                  Double m1;
             while (k<temp) {
                 m1=mass*(Math.pow(0.5,k/half_time));
......


In the 2 activity ,as you said above.

Then in the 3 activity:

Code: Select all
public Intent getIntent(Context context){
      
      Double res= getResult();
        Double mass= getMass();
        Double ttime=getTime();
       
      //loading them back somewhere else
        final_mass.clear();

      //saving to private file in data/data/package folder
        String fs = "/data/data/com.wordpress.androiddevgeo/results";
        String s;

       FileInputStream fis;
       
      try {
         fis = new FileInputStream(fs);
            BufferedReader br = new BufferedReader(new InputStreamReader(fis));
            do {
                s = br.readLine();
                if (s != null) final_mass.add(Double.parseDouble(s));
                //could graph it here maybe as they come in
                //guess you might need the total number first
                //could send that with the others in the intent
                } while (s != null);
          } catch (IOException e) {
             e.printStackTrace();
              }       

        [b]// int temp = final_mass.size();[/b]
     
         ArrayList<Double> x =new ArrayList<Double>();
         ArrayList<Double> y =new ArrayList<Double>();
                 
         //fill x,y values
       [b]  int temp=ttime.intValue();[/b]
         for (int i=0;i<temp;i++){
            x.add((double)(temp/temp)*i);
           
         }
       
       for (int i=0;i<temp;i++){
         y.add(final_mass.get(i));        
                 
       }


I fill the points but with temp=ttime.intValue() . If i use temp = final_mass.size() ,it goes to graph but the plot is empty.
(i corrected the <=temp as you said)
I can't figure how to do it know!

I appreciate your precious help!Thanks!
gpolis
Developer
Developer
 
Posts: 38
Joined: Wed Feb 15, 2012 6:28 pm

Re: problem with memory with array size

Postby Phyll » Sat Feb 18, 2012 11:47 pm

Hi gpolis,

I guess I would make the final part something like this.

Code: Select all
          // This has entire class scope
          ArrayList<Double> x =new ArrayList<Double>();
          ArrayList<Double> y =new ArrayList<Double>();

          // Part of startup code (oncreate, onstart, onresume, etc.)
          Intent i = getIntent();
          double res=i.getExtras().getDouble("result");
          double mass=i.getExtras().getDouble("mass");
          double ttime=i.getExtras().getDouble("time");
          int temp=ttime.intValue();
       
          final_mass.clear();

          // Get the calculation data from the file and fill x,y arrays
          String fs = "/data/data/com.wordpress.androiddevgeo/results";
          String s;
          int i = 0;

          FileInputStream fis;
           
          try {
             fis = new FileInputStream(fs);
                BufferedReader br = new BufferedReader(new InputStreamReader(fis));
                do {
                    s = br.readLine();
                    if (s != null) {
                        x.add((double)(temp/temp)*i); // I don't know why this isn't just a double of i
                        y.add(Double.parseDouble(s));
                        i++;
                        }//keeper
                    } while (s != null);
              } catch (IOException e) {
                 e.printStackTrace();
                  }
           
          int plotPoints = x.size();                         // If you need that count for graph counter=0; counter<plotPoints


I'm not sure exactly what you are calculating, it appears that the x axis would have a regularly spaced period of time represented by the i counter. I'm not sure what dividing temp by itself does except to be 1*i cast to a double. I'm sorry if I'm bungling the math but you can see how it should work. You don't really need the final_mass array at all I don't believe unless you plan on plotting it too. If you do you can add it back in the loop but if you don't...

Hope this helps.

Phyll
Phyll
Master Developer
Master Developer
 
Posts: 648
Joined: Fri Oct 14, 2011 11:19 am

Re: problem with memory with array size

Postby gpolis » Sun Feb 19, 2012 6:41 pm

Hello Phyll ,

I am calculating the remaining mass of a radioactive source and i use achartengine for the plot.
In x axis i have the values from 0 to ttime (where ttime is the time the user enters).
In y axis i have the values of final_mass (which are for time 0-ttime).So,i need the final_mass.

So,i did as you said :

Code: Select all
...
s = br.readLine();
                 if (s != null) {
                    x.add((double)i);
                    y.add(final_mass.get(i)); 
                    i++;
                 }


but the plot is still empty.
gpolis
Developer
Developer
 
Posts: 38
Joined: Wed Feb 15, 2012 6:28 pm

Re: problem with memory with array size

Postby Phyll » Sun Feb 19, 2012 11:53 pm

Hi gpolis,

Well, we need to have a look at what we are getting back in that final readline. If the values are still coming out there then they should be calculating the y for you. You could add a log statement like this:

s = br.readLine();
Log.i("VALUE",s);

in the reader and see what comes out in the logcat. That might be kind of a big list but at least you would know. If these are all zeros or something then you need to trace further back and see where the missing link is.

Wait a minute, I just re-read what you said and I think I see the problem. You don't need a variable called final_mass to make it work. I skipped calling it final_mass in that last piece of code and directly put it into y. You have tried to put final_mass into y before it is initialized by the reader. It is all zero before we read in the values from the file. If you make it like I did, it should work. I just didn't call it final_mass, just y.

y.add(Double.parseDouble(s));

I'm sorry, I did leave that final_mass.clear in there. I should have taken it out. I did not show it being instantiated however.

Hope that helps.

Phyll
Phyll
Master Developer
Master Developer
 
Posts: 648
Joined: Fri Oct 14, 2011 11:19 am

Re: problem with memory with array size

Postby gpolis » Mon Feb 20, 2012 12:04 pm

Hello,

You were right about y.add(Double.parseDouble(s));.

The problem continues though,the plot is empty.
I did Log.i("VALUE",s); but it doesn't appear anywhere!
Also, i did debug ,i put toggle point on s = br.readLine(); but it doesn't appear!

I run the app and i had the logcat opened.I saw this:

In the 1 actrivity , i enter the data.In the 2 activity it show me the result.At logcat it shows me "Filenot found exception".But the result is ok.I don't understand.
Also, the same message is showed when i press to do the plot.
I use linux,eclipse.

Thank you !

-------------UPDATED-------------------------

I figured this!
1) The folder that we had, was wrong, i did "String fs = "/data/data/com.wordpress.androiddevgeo.Radiation/files/results";" which now exists.

2) When i run the app ,i see from the file explorer the size of the file.
When i go from 1 to 2 activity (where i see the result) the files grows to 80000 size (it's in bytes ,right?) .

3) When i go from 2 to 3 activity in order to do the plot,it crashes :
Code: Select all
...
02-20 13:30:03.018: I/global(2184): Default buffer size used in BufferedReader constructor. It would be better to be explicit if an 8k-char buffer is required.
02-20 13:30:08.377: D/dalvikvm(2184): GC_FOR_MALLOC freed 14261 objects / 604088 bytes in 218ms
02-20 13:30:13.727: D/dalvikvm(2184): GC_FOR_MALLOC freed 10743 objects / 447248 bytes in 247ms
02-20 13:30:20.381: D/dalvikvm(2184): GC_FOR_MALLOC freed 10919 objects / 437816 bytes in 211ms
02-20 13:30:22.757: D/AndroidRuntime(2184): Shutting down VM
02-20 13:30:22.779: E/AndroidRuntime(2184): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.wordpress.androiddevgeo.Radiation/com.wordpress.androiddevgeo.Radiation.LineGraph_mass}: java.lang.NullPointerException: println needs a message
02-20 13:30:22.779: E/AndroidRuntime(2184):    at android.app.ActivityThread.access$2300(ActivityThread.java:125)
02-20 13:30:22.779: E/AndroidRuntime(2184):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
02-20 13:30:22.779: E/AndroidRuntime(2184):    at android.os.Handler.dispatchMessage(Handler.java:99)
02-20 13:30:22.779: E/AndroidRuntime(2184):    at android.os.Looper.loop(Looper.java:123)
02-20 13:30:22.779: E/AndroidRuntime(2184):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
02-20 13:30:22.779: E/AndroidRuntime(2184):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
02-20 13:30:22.779: E/AndroidRuntime(2184):    at dalvik.system.NativeStart.main(Native Method)
02-20 13:30:22.779: E/AndroidRuntime(2184): Caused by: java.lang.NullPointerException: println needs a message
02-20 13:30:22.779: E/AndroidRuntime(2184):    at com.wordpress.androiddevgeo.Radiation.LineGraph_mass.getIntent(LineGraph_mass.java:83)
02-20 13:30:22.779: E/AndroidRuntime(2184):    at com.wordpress.androiddevgeo.Radiation.LineGraph_mass.onCreate(LineGraph_mass.java:57)
02-20 13:30:22.779: E/AndroidRuntime(2184):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)


I tested it with small numbers and it fives me the same results (of course the file size is a lot smaller).
gpolis
Developer
Developer
 
Posts: 38
Joined: Wed Feb 15, 2012 6:28 pm

Re: problem with memory with array size

Postby Phyll » Mon Feb 20, 2012 1:01 pm

Hi gpolis,

Well, I'm pretty sure this is just a problem of writing the files out and getting them back. It should be a very simple thing to do. The fact that you desire to keep the middle step complicates and slows things down but should still work. Its difficult without seeing the whole thing to tell you exactly what to do.

I would guess that the file not found exception is probably correct. It should show you a Java line number around there in the logcat to suggest where the error is at. Also, unless you make those folders first, you will get errors like that. I guess they are there now though. Is that correct?

Is there any way you can zip it up and send it to me, maybe in a PM so I can see what's going on. I'm sure it wouldn't take much to fix, its just hard to do it this way.

Hope this helps.

Phyll
Phyll
Master Developer
Master Developer
 
Posts: 648
Joined: Fri Oct 14, 2011 11:19 am

Re: problem with memory with array size

Postby gpolis » Mon Feb 20, 2012 1:11 pm

Ok, what do you want me to send you?The whole app?(it has other things too) or the files that we are talking about?
gpolis
Developer
Developer
 
Posts: 38
Joined: Wed Feb 15, 2012 6:28 pm

Top
Next

Return to Other Coding-Problems

Who is online

Users browsing this forum: TurnitinBot [Bot] and 20 guests