Skip to main content

Featured

Android studio “SDK tools directory is missing”

Following 2 possible solutions will resolve this problem :  Solution1 : To fix the problem, it was required that I list the path to my corporate PAC file by using  Configure -> "Appearance and Behavior" -> System Settings -> HTTP Proxy . I selected "Automatic proxy configuration url:" Delete your  ~/.Android*  folders (losing all of your settings :/). Run Android Studio. It will show you a welcome wizard where it tries to download the SDK again (and fails due to my rubbish internet). Click the X on the wizard window. That will enable you to get to the normal welcome dialog. Go to Settings->Project Defaults->Project Structure and change the Android SDK location to the correct one. Solution 2 : To fix the problem, it was required that I list the path to my corporate PAC file by using  Configure -> "Appearance and Behavior" -> System Settings -> HTTP Proxy . I selected "Automatic proxy configuration url:&quo

Best code to Tokenise a string and get values dynamically(means if String(eg:CaseType)location is changed(i.e position moved frm midle position to last position in below string),that time also u get 'CaseType' value)at run time..in Android

String str="FN:David$@$LN:Abelson$@$CaseID:59$@$CaseType:2$@$TicketNumber:1529-SC-2011-003352";     
       StringTokenizer st = new StringTokenizer(str, "$@$");
       System.out.println("Tokens Count:  " + st.countTokens());
       String arrayString[]=new String[st.countTokens()];
       String ticketNumbr=null,caseId=null,caseType=null;
       int tokenCount=st.countTokens();
       for(int i=0;i<tokenCount;i++)
       {
           arrayString[i]=st.nextToken();
           System.out.println("###"+arrayString[i]);
          
       }
       for(int i=0;i<arrayString.length;i++){
          
           StringTokenizer subStrToken = new StringTokenizer(arrayString[i], ":");
           //Here 2-reprasents two tokens in arrayString[i]="FN:David" i.e "FN,David"
           String tokenString=subStrToken.nextToken();
           switch(tokenString.length()){
            
           case 6:
               caseId=subStrToken.nextToken();
               System.out.println("++caseId"+caseId);              
               break;
              
           case 8:
               caseType=subStrToken.nextToken();
               System.out.println("++caseType"+caseType);                  
               break;
           case 12:
               ticketNumbr=subStrToken.nextToken();
               System.out.println("++ticketNumbr"+ticketNumbr);
               break;
           default:continue;          
           }         
       }

Comments