如何在Android studio上解决A Skipped n帧

时间:2016-04-26 21:50:27

标签: java android multithreading aquery

我正在使用android studio 2.0,我想使用AQuery库创建一个Android登录应用程序,所以我看了很多关于如何使用AQuery库的教程,并且在我尝试应用我学到的东西但是我得到了这个错误

04-26 20:51:51.960 15894-15894/com.mstr.malik.shopingapps W/InputEventReceiver: Attempted to finish an input event but the input event receiver has already been disposed.
04-26 20:51:54.440 15894-15894/com.mstr.malik.shopingapps I/Choreographer: Skipped 78 frames!  The application may be doing too much work on its main thread.
04-26 20:51:57.859 15894-15894/com.mstr.malik.shopingapps I/Choreographer: Skipped 38 frames!  The application may be doing too much work on its main thread.
04-26 20:51:58.560 15894-15894/com.mstr.malik.shopingapps I/Choreographer: Skipped 40 frames!  The application may be doing too much work on its main thread.
04-26 20:51:59.229 15894-15894/com.mstr.malik.shopingapps I/Choreographer: Skipped 37 frames!  The application may be doing too much work on its main thread.
04-26 20:51:59.894 15894-15894/com.mstr.malik.shopingapps I/Choreographer: Skipped 38 frames!  The application may be doing too much work on its main thread.

我的代码源我创建了一个onClick =“connection”的按钮,这是java代码

public class Login extends AppCompatActivity {
    AQuery aq;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_login);
        aq=new  AQuery(this);
    }

    public void connection(View view) {
        EditText UserName=(EditText)findViewById(R.id.username_edtext);
        EditText Password=(EditText)findViewById(R.id.passwd_edtext);
        if((UserName.getText().length()<2 )||(Password.getText().length()<2 ) ) {

            Operations.DisplayMessage(this, getResources().getString(R.string.AddAllinfo));
            return;
        }
        String url=SaveSettings.ServerURL +"aspnet_client/Service/Uses.asmx/login?UserName="+ UserName.getText().toString() +"&Password="+ Password.getText().toString();
        aq.ajax(url, JSONObject.class, this, "jsonCallback");
    }
    public void jsonCallback(String url, JSONObject json, AjaxStatus status) throws JSONException {

        if(json != null){
            //successful ajax call
            //successful ajax call

            int UserID=json.getInt("UserID");
            if(UserID!=0){
                SaveSettings.UserID=String.valueOf(UserID);
                SaveSettings sv=new SaveSettings(this);
                sv.SaveData();

                Intent intent=new Intent(this,ControlPanel.class);
                startActivity(intent); }
            else {
                String msg=json.getString("Message");
                Toast.makeText(getApplicationContext(), msg, Toast.LENGTH_LONG).show();
            }
        }else{
            Toast.makeText(getApplicationContext(), "error", Toast.LENGTH_LONG).show();
            //ajax error
        }
    }}

0 个答案:

没有答案