我有一个主要活动(用于注册和登录),其中有一个标有(忘记密码)的按钮,用于打开新的忘记密码活动,而调试我发现:
的setContentView(R.layout.forgetpassword);
抛出runtimeexception
有什么问题?
ForgetParsePassword.java
package com.parse.starter;
import com.parse.ParseException;
import com.parse.ParseUser;
import com.parse.RequestPasswordResetCallback;
import android.app.Activity;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
public class ForgetParsePassword extends Activity{
EditText et_forgetpassword = null;
Button btn_submitforgetpassword = null;
String password = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.forgetpassword);
et_forgetpassword = (EditText) findViewById(R.id.et_forget);
btn_submitforgetpassword = (Button) findViewById(R.id.btn_submitforgetpassword);
btn_submitforgetpassword.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
password = et_forgetpassword.getText().toString();
checkEmailID();
}
});
}
protected void checkEmailID() {
// TODO Auto-generated method stub
if (TextUtils.isEmpty(password)) {
et_forgetpassword.setError(getString(R.string.error_field_required));
} else if (!password.contains("@")) {
et_forgetpassword.setError(getString(R.string.error_invalid_email));
}
else
forgotPassword(password);
}
public void forgotPassword(String email) {
//postEvent(new UserForgotPasswordStartEvent());
ParseUser.requestPasswordResetInBackground(email, new UserForgotPasswordCallback());
}
private class UserForgotPasswordCallback extends RequestPasswordResetCallback{
public UserForgotPasswordCallback(){
super();
}
@Override
public void done(ParseException e) {
if (e == null) {
Toast.makeText(getApplicationContext(), "Successfully sent link to your email for reset Password", Toast.LENGTH_LONG).show();
} else {
Toast.makeText(getApplicationContext(), "Failed to sent link to your email for reset Password", Toast.LENGTH_LONG).show();
}
}
}
}
logcat的:
03-08 13:54:40.513: D/dalvikvm(1317): GC_FOR_ALLOC freed 302K, 12% free 2983K/3360K, paused 47ms, total 50ms
03-08 13:54:41.473: D/gralloc_goldfish(1317): Emulator without GPU emulation detected.
03-08 13:54:42.933: D/dalvikvm(1317): GC_FOR_ALLOC freed 248K, 10% free 3249K/3572K, paused 38ms, total 47ms
03-08 13:54:44.783: W/Resources(1317): Converting to int: TypedValue{t=0x3/d=0x11 "textEmailAddress" a=2 r=0x7f04000a}
03-08 13:54:44.783: D/AndroidRuntime(1317): Shutting down VM
03-08 13:54:44.783: W/dalvikvm(1317): threadid=1: thread exiting with uncaught exception (group=0xb3ad0ba8)
03-08 13:54:45.063: E/AndroidRuntime(1317): FATAL EXCEPTION: main
03-08 13:54:45.063: E/AndroidRuntime(1317): Process: com.parse.starter, PID: 1317
03-08 13:54:45.063: E/AndroidRuntime(1317): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.parse.starter/com.parse.starter.ForgetParsePassword}: android.view.InflateException: Binary XML file line #19: Error inflating class <unknown>
03-08 13:54:45.063: E/AndroidRuntime(1317): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)
03-08 13:54:45.063: E/AndroidRuntime(1317): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
03-08 13:54:45.063: E/AndroidRuntime(1317): at android.app.ActivityThread.access$800(ActivityThread.java:135)
03-08 13:54:45.063: E/AndroidRuntime(1317): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
03-08 13:54:45.063: E/AndroidRuntime(1317): at android.os.Handler.dispatchMessage(Handler.java:102)
03-08 13:54:45.063: E/AndroidRuntime(1317): at android.os.Looper.loop(Looper.java:136)
03-08 13:54:45.063: E/AndroidRuntime(1317): at android.app.ActivityThread.main(ActivityThread.java:5017)
03-08 13:54:45.063: E/AndroidRuntime(1317): at java.lang.reflect.Method.invokeNative(Native Method)
03-08 13:54:45.063: E/AndroidRuntime(1317): at java.lang.reflect.Method.invoke(Method.java:515)
03-08 13:54:45.063: E/AndroidRuntime(1317): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
03-08 13:54:45.063: E/AndroidRuntime(1317): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
03-08 13:54:45.063: E/AndroidRuntime(1317): at dalvik.system.NativeStart.main(Native Method)
03-08 13:54:45.063: E/AndroidRuntime(1317): Caused by: android.view.InflateException: Binary XML file line #19: Error inflating class <unknown>
03-08 13:54:45.063: E/AndroidRuntime(1317): at android.view.LayoutInflater.createView(LayoutInflater.java:620)
03-08 13:54:45.063: E/AndroidRuntime(1317): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
03-08 13:54:45.063: E/AndroidRuntime(1317): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:669)
03-08 13:54:45.063: E/AndroidRuntime(1317): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:694)
03-08 13:54:45.063: E/AndroidRuntime(1317): at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
03-08 13:54:45.063: E/AndroidRuntime(1317): at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
03-08 13:54:45.063: E/AndroidRuntime(1317): at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
03-08 13:54:45.063: E/AndroidRuntime(1317): at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
03-08 13:54:45.063: E/AndroidRuntime(1317): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:290)
03-08 13:54:45.063: E/AndroidRuntime(1317): at android.app.Activity.setContentView(Activity.java:1929)
03-08 13:54:45.063: E/AndroidRuntime(1317): at com.parse.starter.ForgetParsePassword.onCreate(ForgetParsePassword.java:25)
03-08 13:54:45.063: E/AndroidRuntime(1317): at android.app.Activity.performCreate(Activity.java:5231)
03-08 13:54:45.063: E/AndroidRuntime(1317): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
03-08 13:54:45.063: E/AndroidRuntime(1317): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
03-08 13:54:45.063: E/AndroidRuntime(1317): ... 11 more
03-08 13:54:45.063: E/AndroidRuntime(1317): Caused by: java.lang.reflect.InvocationTargetException
03-08 13:54:45.063: E/AndroidRuntime(1317): at java.lang.reflect.Constructor.constructNative(Native Method)
03-08 13:54:45.063: E/AndroidRuntime(1317): at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
03-08 13:54:45.063: E/AndroidRuntime(1317): at android.view.LayoutInflater.createView(LayoutInflater.java:594)
03-08 13:54:45.063: E/AndroidRuntime(1317): ... 24 more
03-08 13:54:45.063: E/AndroidRuntime(1317): Caused by: java.lang.NumberFormatException: Invalid int: "textEmailAddress"
03-08 13:54:45.063: E/AndroidRuntime(1317): at java.lang.Integer.invalidInt(Integer.java:137)
03-08 13:54:45.063: E/AndroidRuntime(1317): at java.lang.Integer.parse(Integer.java:374)
03-08 13:54:45.063: E/AndroidRuntime(1317): at java.lang.Integer.parseInt(Integer.java:365)
03-08 13:54:45.063: E/AndroidRuntime(1317): at com.android.internal.util.XmlUtils.convertValueToInt(XmlUtils.java:122)
03-08 13:54:45.063: E/AndroidRuntime(1317): at android.content.res.TypedArray.getInt(TypedArray.java:255)
03-08 13:54:45.063: E/AndroidRuntime(1317): at android.widget.TextView.<init>(TextView.java:1000)
03-08 13:54:45.063: E/AndroidRuntime(1317): at android.widget.EditText.<init>(EditText.java:60)
03-08 13:54:45.063: E/AndroidRuntime(1317): at android.widget.EditText.<init>(EditText.java:56)
03-08 13:54:45.063: E/AndroidRuntime(1317): ... 27 more
03-08 13:54:49.793: I/Process(1317): Sending signal. PID: 1317 SIG: 9
forgetpassword.xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginTop="60dp"
android:text="@string/email"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="@+id/et_forget"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_below="@+id/textView1"
android:layout_marginTop="22dp"
android:singleLine="true"
android:imeOptions="actionDone"
android:hint="@string/e"
android:inputType="@string/textemail" >
<requestFocus />
</EditText>
<Button
android:id="@+id/btn_submitforgetpassword"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_below="@+id/et_forget"
android:layout_marginTop="32dp"
android:text="@string/submit" />
</RelativeLayout>