0

When i am running my application in emulator it gives a logcat message as ..

05-29 13:45:06.941: W/ActivityManager(59): Launch timeout has expired, giving up wake lock!
05-29 13:45:07.152: W/ActivityManager(59): Activity idle timeout for HistoryRecord{45163410 com.integrated.mpr/.Progress}
05-29 13:45:07.241: D/dalvikvm(5422): GC_FOR_MALLOC freed 43964 objects / 1967584 bytes in 138ms
05-29 13:45:08.401: D/dalvikvm(5422): GC_FOR_MALLOC freed 73 objects / 536016 bytes in 65ms
05-29 13:45:09.631: W/ActivityManager(59): Activity idle timeout for HistoryRecord{450e8e38 com.integrated.mpr/.SensitiveList}

the function that is being called package com.integrated.mpr;

import org.apache.commons.math.linear.RealMatrix;
import org.apache.commons.math.stat.correlation.Covariance;
import org.apache.commons.math.stat.correlation.PearsonsCorrelation;
import org.apache.commons.math.util.FastMath;

import android.util.Log;

public class Logic {

    int n = Choose.n;
    double final_matrix[][] = new double[n][5];
    double swap =0;

    double weightage_matrix[] = {0,0,0,0,0,0,0,0,0,0,0};
    double sorted_weightage[] = {0,0,0,0,0,0,0,0,0,0};
    String  display[] = new String[n]; 

    double input_matrix[][] = new double[22050][n];
    double[] peak_matrix = new double[n];
    double[] sd_matrix = new double[n];
    double[] rms_matrix = new double[n];
    double[] cf_matrix = new double[n];
    double[] mean_matrix = new double[n];
    int[] sensitive_positions = new int[n];
    double[] new_sensitive = new double[n];
    int[] sortsensi = new int[n];


    public String[] finaldata(){



        for(int i=0;i<n;i++){
            peak_matrix[i] = Choose.timedata[i*5+0];
            sd_matrix[i] = Choose.timedata[i*5+1];
            rms_matrix[i] = Choose.timedata[i*5+2];
            cf_matrix[i] = Choose.timedata[i*5+3];
            mean_matrix[i] = Choose.timedata[i*5+4];
        }

        // Arrays sorted in asecnding order
        java.util.Arrays.sort(peak_matrix);
        java.util.Arrays.sort(sd_matrix);
        java.util.Arrays.sort(rms_matrix);
        java.util.Arrays.sort(mean_matrix);
        java.util.Arrays.sort(cf_matrix);



    for(int i = 0;i<n;i++){
        final_matrix[i][0]= peak_matrix[i];
        final_matrix[i][1]= sd_matrix[i];
        final_matrix[i][2]= rms_matrix[i];
        final_matrix[i][3]= cf_matrix[i];
        final_matrix[i][4]= mean_matrix[i];
    }
    Log.d("final matrix", "final matrix 0 0" +final_matrix[0][0]);
    Log.d("final matrix", "final matrix 1 0" +final_matrix[1][0]);
    Log.d("final matrix", "final matrix 2 0" +final_matrix[2][0]);

    Log.d("final matrix", "final matrix 3 0" +final_matrix[3][0]);
    Log.d("final matrix", "final matrix 4 0" +final_matrix[4][0]);

    //final sorted matrix obtained
    for(int i =0;i<n;i++){
            for(int j=0;j<5;j++){
                if(final_matrix[i][j]== Page1.timedata1[j]){
                    weightage_matrix[0] = weightage_matrix[0]+i+1;
                }
                else if (final_matrix[i][j]== Page2.timedata2[j]){
                    weightage_matrix[1] = weightage_matrix[1]+i+1;
                }
                else if (final_matrix[i][j]== Page3.timedata3[j]){
                    weightage_matrix[2] = weightage_matrix[2]+i+1;
                }
                else if (final_matrix[i][j]== Page4.timedata4[j]){
                    weightage_matrix[3] = weightage_matrix[3]+i+1;
                }

                else{
                    weightage_matrix[4] = weightage_matrix[4]+i+1;
                }
        }
    }
    //copying the values into sorted matrix;


    for(int i=0;i<n;i++){
        sorted_weightage[i] = weightage_matrix[i];
    }

    //sorting weighatge matrix in descending order

        for (int i = 0;i<n; i++ )
           {
              for ( int j = 0 ; j < n-i-1 ; j++ )
              {
                  if ( sorted_weightage[j] <sorted_weightage[j+1] ) {
                        swap = sorted_weightage[j];
                        sorted_weightage[j] = sorted_weightage[j+1];
                        sorted_weightage[j+1] = swap;
                  }
              }

           }

    //  String[] display= new String [n];
        /*
        Log.d("", "weightage matrix0 " +weightage_matrix[0]);
        Log.d("", "weightage matrix0 " +weightage_matrix[1]);
        Log.d("", "weightage matrix0 " +weightage_matrix[2]);
        Log.d("", "weightage matrix0 " +weightage_matrix[3]);
        Log.d("", "weightage matrix0 " +weightage_matrix[4]);

        for(int i =0;i<n;i++){
            Log.d("posnames", new Choose().posnames[i]);
        }
        */
    for(int i =0;i<n;i++){
        double temp = sorted_weightage[i];
        for(int j =0;j<n;j++){
            if(temp==weightage_matrix[j]){
                sensitive_positions[i]=j+1;
            }
        }
    }
    //IT IS RUNNING UPTO THIS POINT AND NOW IT GIVES THE LOGCAT MESSAGE OF LAUNCHTIME



    //now for correaltion


    // genearting the input matrix for correaltion


    for(int i=0;i<n;i++){
        for(int j=0;j<22050;j++){
            input_matrix[j][i] =  new Choose().rawdata[i*22050+j];
        }
    }

    // now generating correlation matrix of N x n by using pearson correaltion


    RealMatrix pcorrdata = new PearsonsCorrelation().computeCorrelationMatrix(input_matrix);


    Log.d("checkng correlation mtrix", "yup");

    for(int i =0;i<n;i++){
        for(int j =0;j<n;j++){

            if(pcorrdata.getEntry(i, j)<0){
                pcorrdata.setEntry(i, j, pcorrdata.getEntry(i, j)*-1);
            }
            Log.d(" value", ""+pcorrdata.getEntry(i, j));
        }
    }

    for(int i =0;i<n;i++){
        Log.d("sensitive osition before correlation", ""+sensitive_positions[i]);
    }



    int[] perm_sensitive = sensitive_positions;


    if((pcorrdata.getEntry(perm_sensitive[0]-1, perm_sensitive[1]-1))>0.5){
        sensitive_positions = append(perm_sensitive[1],sensitive_positions);
    }


    for(int i = 0;i<n;i++){
        for(int j =0;j<n;j++){
            if(i==sensitive_positions[0]-1){
                if((j==sensitive_positions[1]-1)){
                    if(pcorrdata.getEntry(i, j)>0.5){
                        sensitive_positions = append(j,sensitive_positions);
                        }
                    }
                }
            }
        }




    if((pcorrdata.getEntry(perm_sensitive[0]-1, perm_sensitive[2]-1))>0.5){
        sensitive_positions = append(perm_sensitive[2],sensitive_positions);
    }





    if((pcorrdata.getEntry(perm_sensitive[0]-1, perm_sensitive[3]-1))>0.5){
        sensitive_positions = append(perm_sensitive[3],sensitive_positions);
    }




    perm_sensitive = sensitive_positions;

    if((pcorrdata.getEntry(perm_sensitive[1]-1, perm_sensitive[2]-1))>0.5){
        sensitive_positions = append(perm_sensitive[2],sensitive_positions);
    }



    if((pcorrdata.getEntry(perm_sensitive[1]-1, perm_sensitive[3]-1))>0.5){
        sensitive_positions = append(perm_sensitive[3],sensitive_positions);
    }




    perm_sensitive = sensitive_positions;


    if((pcorrdata.getEntry(perm_sensitive[2]-1, perm_sensitive[3]-1))>0.5){
        sensitive_positions = append(perm_sensitive[3],sensitive_positions);
    }

    for(int i =0;i<n;i++){
        Log.d("values aft 6th exchange","" +sensitive_positions[i]);
    }

    perm_sensitive = sensitive_positions;

    Log.d("checkng vales", "after correlation");

    for(int i =0;i<n;i++){
        Log.d("values",""+perm_sensitive[i]);
    }


    for(int i =0;i<n;i++){
        display[i] = new Choose().posnames[perm_sensitive[i]-1];
    }

    return display;

    }


    private int[] append(int j, int[] sensitive_positions) {
        // TODO Auto-generated method stub

        int[] sort_sensitive = new int[n];
        int z = 0;
        for(int i =0;i<n;i++){
            if(sensitive_positions[i]!=j){
                sort_sensitive[z]=sensitive_positions[i];
                z = z+1;
            }
        }
        sort_sensitive[n-1] = j;
        return sort_sensitive;
    }







}

actually in the oncreate method of the next activity i am calling a function of another class which has some calculations. Is that the reason .., if yes, how can i remove it?

but still after a blank screen , the next activity opens ..

but wen i try to run it in the phone , it force closes. How can i remove this .. please help?

Kumar
  • 169
  • 2
  • 5
  • 12
  • i think your background task running so long time... – Samir Mangroliya May 29 '12 at 08:22
  • actually in the oncreate method of the next activity i am calling a function of another class which has some calculations. Is that the reason .., if yes, how can i remove it? – Kumar May 29 '12 at 08:24

2 Answers2

0

This error means your Activity is taking to long to start. If you are doing a lot of processing on the UI thread, Android kills your application. You should use AsyncTask for any processing intensive stuff.

If you could post your code and your SDK version, I can provide more help. There is also another thread on stackoverflow about this. Activity idle timeout for HistoryRecord?

Community
  • 1
  • 1
MobileEvangelist
  • 2,583
  • 1
  • 25
  • 36
  • Should i provide the function of the class that i am calling in the oncreate of next activity?? – Kumar May 29 '12 at 08:38
  • OK.. I am providing the code and but its a logical and big code .. i have edited the question – Kumar May 29 '12 at 08:47
0

This means that your main thread is continually running, pumping message through its message queue without ever going idle. If that is what you want, there is nothing to fix. This is why the log message is a warning, not an error.(More) and and other from google groups.

watch more info.

Community
  • 1
  • 1