我在更改应用程序的Android版本时遇到问题。我已经在项目下的“Package Explorer”中说了Android 2.2,但是我尝试了一些更高版本,比如4.2.2,它没有用,但是当我尝试使用2.2时,它没有任何问题。 我尝试通过右键单击项目来更改版本>属性> Android> Android 4.2.2,但也没有用。这是我的sdk:
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="17" />
在4.2.2我在日志中得到的东西:
09-28 02:27:13.088:W / System.err(785):at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
09-28 02:27:13.088:W / System.err(785):at dalvik.system.NativeStart.main(Native Method)
09-28 02:27:17.708:I / System.out(785):暂停loginauthactivity .......
09-28 02:27:17.718:I / System.out(785):inside homeButton().......
09-28 02:27:18.178:I / Choreographer(785):跳过121帧!应用程序可能在其主线程上做了太多工作 09-28 02:27:19.918:I / Choreographer(785):跳过39帧!应用程序可能在其主线程上做了太多工作 09-28 02:27:20.318:I / Choreographer(785):跳过62帧!应用程序可能在其主线程上做了太多工作。
09-28 02:27:22.738:I / System.out(785):在menu_login里面
我班上的代码片段:
公共类LoginAuthActivity扩展了Activity {
private Button login;
private EditText username;
private EditText password;
private String user = null;
private String pwd = null;
private String status = null;
private boolean flag = false;
Boolean isInternetPresent = false;
boolean logged;
//class variables
AppEngineDAO ackDAO;
AlertDialogManager alert = null;
SessionManager session = null;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//set the layout
setContentView(R.layout.activity_login_auth);
Toast.makeText(getApplicationContext(),
"Inside LoginAuthActivity onCreate()", Toast.LENGTH_SHORT)
.show();
//creating object of the classes
ackDAO = new AppEngineDAO();
session = new SessionManager(getApplicationContext());
alert = new AlertDialogManager();
Toast.makeText(getApplicationContext(),
"User Login Status: " + session.isLoggedIn(), Toast.LENGTH_LONG)
.show();
username = (EditText) findViewById(R.id.editusername);
password = (EditText) findViewById(R.id.editpassword);
login = (Button) findViewById(R.id.btnlogin);
login.setOnClickListener(loginButtonListener);
}
private OnClickListener loginButtonListener = new OnClickListener() {
public void onClick(View v) {
Toast.makeText(getApplicationContext(),
"Inside loginButtonListener OnClickListener()",
Toast.LENGTH_SHORT).show();
System.out.println("INSIDE login BUTTON .....");
displayError();
if (flag == false) {
user = username.getText().toString().trim();
pwd = password.getText().toString().trim();
System.out.println("inside flag false.....");
try {
status = ackDAO.login(user, pwd,"student");
System.out.println("status in login auth....." + status);
if (status.equals("ok")) {
System.out.println("inside STATUS OK.....");
session.createLoginSession(user, pwd);
Intent i = new Intent(getApplicationContext(),
HomeActivity.class);
i.putExtra("user", user);
startActivity(i);
overridePendingTransition(R.anim.push_left_in, R.anim.push_up_out);
} else if (status.equals("notok")) {
System.out.println("inside STATUS notOK.....");
alert.showAlertDialog(LoginAuthActivity.this,
"Login failed..",
"Username/Password is incorrect", false);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
};
答案 0 :(得分:0)
看到日志,你似乎在主线程中做了一些繁重的操作。将android版本更改为4.2后尝试清理项目,无需在清单或属性文件中手动更改sdk版本。