我收到ANR,当我点击Edittext for texting和My logcat给msg时: - 原因:输入调度超时(等待发送键事件,因为聚焦窗口尚未完成处理之前的所有输入事件传出队列长度:0等待队列长度:1。)
edit_personal_details.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
edit_personal_details.setVisibility(View.INVISIBLE);
edit_personal_details_save.setVisibility(View.VISIBLE);
email_et.setFocusable(true);
website_et.setFocusable(true);
twitter_id_et.setFocusable(true);
email_et.setFocusableInTouchMode(true);
website_et.setFocusableInTouchMode(true);
twitter_id_et.setFocusableInTouchMode(true);
email_et.setEnabled(true);
website_et.setEnabled(true);
twitter_id_et.setEnabled(true);
}
});
edit_personal_details_save.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
edit_personal_details_save.setVisibility(View.INVISIBLE);
edit_personal_details.setVisibility(View.VISIBLE);
dob_et.setFocusableInTouchMode(false);
email_et.setFocusableInTouchMode(false);
website_et.setFocusableInTouchMode(false);
twitter_id_et.setFocusableInTouchMode(false);
email_et.setEnabled(false);
website_et.setEnabled(false);
twitter_id_et.setEnabled(false);
email_et.setFocusable(false);
website_et.setFocusable(false);
twitter_id_et.setFocusable(false);
dob_et_str = dob_et.getText().toString();
email_et_str = email_et.getText().toString();
website_et_str = website_et.getText().toString();
twitter_id_et_str = twitter_id_et.getText().toString();
AddPersonalDetails addPersonalDetails = new AddPersonalDetails();
addPersonalDetails.execute();
}
});
...................... AddPersonalDetails Class ....................... ...........
private class AddPersonalDetails extends AsyncTask<String, Void, Void> {
ProgressDialog progressDialog;
String ResponseFromAddPersonalDetails;
@Override
protected Void doInBackground(String... params) {
//Invoke webservice
profile_sharedPreferences = getActivity().getSharedPreferences(SHARED_PREF, MODE_PRIVATE);
String Userid = profile_sharedPreferences.getString("userId", null);
WebService wsc = new WebService();
ResponseFromAddPersonalDetails = wsc.AddPersonalDetails(Userid, dob_et_str, email_et_str, website_et_str, "skype", twitter_id_et_str, serviceToken, "AddPersonalDetails");
return null;
}
@Override
protected void onPostExecute(Void result) {
//Set response
try {
} catch (Exception e) {
e.printStackTrace();
}
progressDialog.dismiss();
}
@Override
protected void onPreExecute() {
//Make ProgressBar invisible
progressDialog = new ProgressDialog(getActivity());
progressDialog.setMessage("Loading, please wait.......");
progressDialog.show();
}
@Override
protected void onProgressUpdate(Void... values) {
}
}
........................... Xml代码.................. ..........................
<LinearLayout
android:id="@+id/mLinearPersonalDetails"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/linearLayout"
android:layout_marginTop="7dp"
android:background="@drawable/rounded_layout"
android:fitsSystemWindows="true"
android:orientation="vertical">
<RelativeLayout
android:id="@+id/relativeLayout6"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingRight="10dp">
<TextView
android:id="@+id/social_heading"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:layout_marginLeft="5dp"
android:text="Personal Details"
android:textColor="@color/profile_name_txt"
android:textSize="15sp"
android:textStyle="bold" />
<Button
android:id="@+id/edit_personal_details_save"
android:layout_width="70dp"
android:layout_height="20dp"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:background="@drawable/buttonshape"
android:text="save"
android:textColor="@color/layout_profile"
android:visibility="invisible" />
<ImageButton
android:id="@+id/edit_personal_details"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginBottom="7dp"
android:background="@color/layout_profile"
android:scaleType="centerCrop"
android:src="@mipmap/edit_user_name"
android:windowSoftInputMode="stateHidden|adjustResize|adjustPan" />
<View
android:id="@+id/viewbreaker9"
android:layout_width="wrap_content"
android:layout_height="2dp"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_marginBottom="35dp"
android:background="#e4e4e4" />
</RelativeLayout>
<LinearLayout
android:id="@+id/linearlayout13"
android:layout_width="match_parent"
android:layout_height="55dp"
android:layout_gravity="center_horizontal"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="5dp"
android:orientation="horizontal">
<ImageView
android:layout_width="35dp"
android:layout_height="35dp"
android:src="@mipmap/birthday" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Birthday"
android:textSize="12sp"
android:textStyle="bold" />
<TextView
android:id="@+id/dob_et"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:backgroundTint="@color/layout_profile"
android:focusable="false"
android:text="September 13"
android:textColor="@color/profile_name_txt"
android:textSize="12sp" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginTop="5dp"
android:background="#e4e4e4" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/linearlayout14"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:orientation="horizontal">
<ImageView
android:layout_width="35dp"
android:layout_height="35dp"
android:src="@mipmap/email" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="3dp"
android:text="Email"
android:textSize="12sp"
android:textStyle="bold" />
<EditText
android:id="@+id/email_et"
android:layout_width="fill_parent"
android:layout_height="35dp"
android:backgroundTint="@color/layout_profile"
android:inputType="text|textNoSuggestions"
android:maxLines="1"
android:paddingBottom="1dp"
android:paddingTop="1dp"
android:text="myemail@email.com"
android:textColor="@color/profile_name_txt"
android:textSize="12sp" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#e4e4e4" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/linearlayout_website"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:orientation="horizontal">
<ImageView
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginTop="5dp"
android:src="@mipmap/website" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:paddingLeft="3dp"
android:text="Website"
android:textSize="12sp"
android:textStyle="bold" />
<EditText
android:id="@+id/website_et"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:backgroundTint="@color/layout_profile"
android:focusable="false"
android:inputType="text|textNoSuggestions"
android:maxLines="1"
android:paddingBottom="1dp"
android:paddingTop="1dp"
android:text="www.Iparun.com"
android:textColor="@color/profile_name_txt"
android:textSize="12sp"
android:windowSoftInputMode="adjustResize" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#e4e4e4" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/linearlayout_twitter"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:orientation="horizontal">
<ImageView
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginTop="5dp"
android:src="@mipmap/twitter" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:paddingLeft="3dp"
android:text="TWITTER"
android:textSize="12sp"
android:textStyle="bold" />
<EditText
android:id="@+id/twitter_id_et"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:backgroundTint="@color/layout_profile"
android:focusable="false"
android:inputType="text|textNoSuggestions"
android:maxLines="1"
android:paddingBottom="1dp"
android:paddingTop="1dp"
android:text="ip_arun"
android:textColor="@color/profile_name_txt"
android:textSize="12sp"
android:windowSoftInputMode="adjustResize" />
</LinearLayout>
</LinearLayout>
</LinearLayout>