2016-11-17 96 views
0

我發生了該錯誤: 錯誤:(55,13)錯誤:非法字符:'\ u0650' 錯誤:執行任務失敗':app:compileDebugJavaWithJavac'。>編譯失敗;詳細信息請參閱編譯器錯誤輸出。 而我試圖讓我的應用程序 重試按鈕,這是我的代碼錯誤非法字符' u0650'

private void CallNetwork(String baseUrl) { 
    if (NetworkUtils.isNetworkAvailable(getActivity())) { 
     new Url_cont(this, getActivity()).execute(baseUrl); 
    } else { 
     ِAlertDialog.Builder alert= new AlertDialog.Builder(getActivity()); 
     alert.setTitle("Error !!!"); 
     alert.setMessage("sorry there is no connection please check your internet and retry"); 
     AlertDialog alertDialog =alert.create(); 
     alert.setPositiveButton("Retry",new DialogInterface.OnClickListener(){ 
      @Override 
      public void onClick(DialogInterface dialog, int which){ 
       dialog.dismiss(); 
       CallNetwork(MovieUrl); 
      } 
     }); 
     alertDialog.show(); 
     Toast.makeText(getActivity(),"network unavailble!!!",Toast.LENGTH_LONG).show(); 
    } 

} 

我的設備是谷歌Nexus 7的API 23 和

  ِAlertDialog.Builder alert= new AlertDialog.Builder(getActivity()); 

錯誤,我需要解決這個問題

回答

0

我現在終於答案

{ 
     AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); 
     builder.setCancelable(false); 
     builder.setTitle("No Internet"); 
     builder.setMessage("Internet is required. Please Retry."); 
     builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { 
      @Override 
      public void onClick(DialogInterface dialog, int which) { 
       dialog.dismiss(); 
       System.exit(0); 
      } 
     }); 

     builder.setPositiveButton("Retry", new DialogInterface.OnClickListener(){ 
      @Override 
      public void onClick(DialogInterface dialog, int which) 
      { 
       dialog.dismiss(); 
       CallNetwork(MovieUrl); 
      } 
     }); 
     AlertDialog dialog = builder.create(); 
     dialog.show(); 
     Toast.makeText(getActivity(), "Network Unavailable!", Toast.LENGTH_LONG).show(); 
    } 

此代碼更好,它的工作良好,所以如果你想重試按鈕只是使用這段代碼,這個錯誤將再次顯示