0

menuItemSelect
を使用すると、クラスに問題がありますが、この問題は android 4.1 でのみ発生し、2.1 で試してみました。これは私のクラスです

public void postLogout(String url2,String unico_id) {

           System.out.println("postLogout");
        try{
            unico_id = URLEncoder.encode("unique_id", "UTF-8") + "=" + URLEncoder.encode(unico_id, "UTF-8");
            URL url3 =new URL(url2);
              URLConnection con1 = (URLConnection) url3.openConnection();
              con1.setDoOutput(true);
              OutputStreamWriter wr1 = new OutputStreamWriter(con1.getOutputStream());
              wr1.write(unico_id);
              wr1.flush();
              System.out.println("antes buffer");
              BufferedReader recv1 = new BufferedReader(new InputStreamReader(con1.getInputStream()),800000000);
              //Los mostramos por pantalla
               s1 = recv1.readLine();
               System.out.println("el s");
              while(s1!=null){
                      System.out.println(s1);
                      s1=recv1.readLine();
                    }
           }catch (Exception e){
               System.out.println("en el catch");
               System.out.println(e.getMessage());

           }

        }

例外は私のカタログです:

10-13 21:07:19.915: W/dalvikvm(1433): threadid=1: thread exiting with uncaught exception (group=0x40a13300)
10-13 21:07:19.977: E/AndroidRuntime(1433): FATAL EXCEPTION: main
10-13 21:07:19.977: E/AndroidRuntime(1433): java.lang.NullPointerException
10-13 21:07:19.977: E/AndroidRuntime(1433):     at com.android.internal.os.LoggingPrintStream.println(LoggingPrintStream.java:298)
10-13 21:07:19.977: E/AndroidRuntime(1433):     at com.example.rubrik.PostData.postLogout(PostData.java:164)
`enter code here`10-13 21:07:19.977: E/AndroidRuntime(1433):    at com.example.rubrik.LogOut.logout(LogOut.java:18)
10-13 21:07:19.977: E/AndroidRuntime(1433):     at com.example.rubrik.rubrik.onOptionsItemSelected(rubrik.java:175)
10-13 21:07:19.977: E/AndroidRuntime(1433):     at android.app.Activity.onMenuItemSelected(Activity.java:2534)
10-13 21:07:19.977: E/AndroidRuntime(1433):     at com.android.internal.policy.impl.PhoneWindow.onMenuItemSelected(PhoneWindow.java:958)
10-13 21:07:19.977: E/AndroidRuntime(1433):     at com.android.internal.view.menu.MenuBuilder.dispatchMenuItemSelected(MenuBuilder.java:735)

前もって感謝します

4

0 に答える 0