package com.sinch.messagingtutorialskeleton;

/**
 * Created by Haya on 10/27/2015.
 */
import android.app.Application;
import android.util.Log;
import android.widget.Toast;

import com.TextMining.PrepareData;
import com.parse.FindCallback;
import com.parse.Parse;
import com.parse.ParseException;
import com.parse.ParseObject;
import com.parse.ParseQuery;

import java.util.List;

public class MyApplication extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
        Parse.enableLocalDatastore(this);
        Parse.initialize(this, "6zuqfy2rPtBTFIhHcrQy1TbuCwXLvhJ1mcFZEA4R", "iK6g3dGw9Am5XMZo8O7nph3Lve5bGq8XiTQ8OtD8");
        // Reading from TransDatabase
        List<ParseObject> textMSGList=null;
        ParseQuery<ParseObject> query = ParseQuery.getQuery("TransDatabase");//TransDatabase
            try {
                textMSGList = query.find();
            } catch (ParseException e) {
                e.printStackTrace();
            }

        //array to covert list to array
        try {
            String[] array = new String[textMSGList.size()];
            int g=0;
            //add the data in the list to the array
            for (ParseObject comment : textMSGList) {
                array[g]=comment.get("FilteredMsg").toString();
                // Log.i("testing ",array[g]);
                g++;
            }
            //  Apriori.main(array);

        }
        catch (Exception e)
        {
            Toast.makeText(this, "تأكد من اتصالك بالانترنت", Toast.LENGTH_LONG).show();

        }

 /*       try {
         System.out.println("start");
            ParseQuery<ParseObject> query1 = ParseQuery.getQuery("ParseMessage");
            System.out.println("start2");

        List<ParseObject> Objectslist = null;
            System.out.println("start4");

            Objectslist = query1.find();

        for (int index = 40; index < 53; ++index) {
            String str = Objectslist.get(index).getString("messageText");
            System.out.println("start5");

            PrepareData.AddaConversation(str);
        }

        } catch (ParseException e) {
            e.printStackTrace();
        }*/


/*        //array to covert list to array
        String [] array = new String[textMSGList.size()];
        int g=0;
        //add the data in the list to the array
        for (ParseObject comment : textMSGList) {
            array[g]=comment.get("FilteredMsg").toString();
         Log.i("testing ",array[g]);
            g++;
        }


String [] test ={"1 2 3 4",
        "1 5 6 7",
        "1 8 9 10",
        "1 2 3 4",
        "1 2 3 4",
        "10 11 12 13"};
        try {
            Log.i("before ","before apriori");
            Apriori.main(array);
            Log.i("after ", "after apriori");

        } catch (Exception e) {
            Log.i("try exception", "try exception");

            e.printStackTrace();
        }

*/

    }
}

@@ -72,18 +72,17 @@
  on 
-10/27
+20/3
 /201
-5
+6
 .%0D%0A 
@@ -674,24 +674,34 @@
 TQ8OtD8%22);%0D%0A
+        %0D%0A
         // R
@@ -1075,32 +1075,34 @@
 %0A        try %7B%0D%0A
+%0D%0A
             Stri
@@ -1161,32 +1161,34 @@
       int g=0;%0D%0A
+%0D%0A
             //ad
@@ -1271,32 +1271,34 @@
 textMSGList) %7B%0D%0A
+%0D%0A
                 
@@ -1366,113 +1366,27 @@
     
-// Log.i(%22testing %22,array%5Bg%5D);%0D%0A                g++;%0D%0A            %7D%0D%0A            //  Apriori.main(array);
+g++;%0D%0A            %7D
 %0D%0A%0D%0A
@@ -1544,1426 +1544,8 @@
 %0D%0A%0D%0A
- /*       try %7B%0D%0A         System.out.println(%22start%22);%0D%0A            ParseQuery%3CParseObject%3E query1 = ParseQuery.getQuery(%22ParseMessage%22);%0D%0A            System.out.println(%22start2%22);%0D%0A%0D%0A        List%3CParseObject%3E Objectslist = null;%0D%0A            System.out.println(%22start4%22);%0D%0A%0D%0A            Objectslist = query1.find();%0D%0A%0D%0A        for (int index = 40; index %3C 53; ++index) %7B%0D%0A            String str = Objectslist.get(index).getString(%22messageText%22);%0D%0A            System.out.println(%22start5%22);%0D%0A%0D%0A            PrepareData.AddaConversation(str);%0D%0A        %7D%0D%0A%0D%0A        %7D catch (ParseException e) %7B%0D%0A            e.printStackTrace();%0D%0A        %7D*/%0D%0A%0D%0A%0D%0A/*        //array to covert list to array%0D%0A        String %5B%5D array = new String%5BtextMSGList.size()%5D;%0D%0A        int g=0;%0D%0A        //add the data in the list to the array%0D%0A        for (ParseObject comment : textMSGList) %7B%0D%0A            array%5Bg%5D=comment.get(%22FilteredMsg%22).toString();%0D%0A         Log.i(%22testing %22,array%5Bg%5D);%0D%0A            g++;%0D%0A        %7D%0D%0A%0D%0A%0D%0AString %5B%5D test =%7B%221 2 3 4%22,%0D%0A        %221 5 6 7%22,%0D%0A        %221 8 9 10%22,%0D%0A        %221 2 3 4%22,%0D%0A        %221 2 3 4%22,%0D%0A        %2210 11 12 13%22%7D;%0D%0A        try %7B%0D%0A            Log.i(%22before %22,%22before apriori%22);%0D%0A            Apriori.main(array);%0D%0A            Log.i(%22after %22, %22after apriori%22);%0D%0A%0D%0A        %7D catch (Exception e) %7B%0D%0A            Log.i(%22try exception%22, %22try exception%22);%0D%0A%0D%0A            e.printStackTrace();%0D%0A        %7D%0D%0A%0D%0A*/%0D%0A%0D%0A
     

Update MyApplication.java