在其他3个设备上,我可以使用我的程序并在EditText字段中长按文本而不会出现任何问题,但是在我的Galaxy S3上,每当我尝试执行此程序时程序崩溃。这是一个非常基本的活动页面,我做的不仅仅是显示EditText和一个按钮。但它发生在其他地方,我的程序中有一个EditText。
关于崩溃的Logcat信息:
01-15 10:56:47.169: E/AndroidRuntime(3516): FATAL EXCEPTION: main
01-15 10:56:47.169: E/AndroidRuntime(3516): android.content.res.Resources$NotFoundException: Resource ID #0x0
01-15 10:56:47.169: E/AndroidRuntime(3516): at android.content.res.Resources.getValue(Resources.java:1981)
01-15 10:56:47.169: E/AndroidRuntime(3516): at android.content.res.Resources.getDrawable(Resources.java:1556)
01-15 10:56:47.169: E/AndroidRuntime(3516): at android.widget.Editor$SelectionModifierCursorController.initDrawables(Editor.java:5506)
01-15 10:56:47.169: E/AndroidRuntime(3516): at android.widget.Editor$SelectionModifierCursorController.show(Editor.java:5490)
01-15 10:56:47.169: E/AndroidRuntime(3516): at android.widget.Editor$SelectionActionModeCallback.onCreateActionMode(Editor.java:3459)
01-15 10:56:47.169: E/AndroidRuntime(3516): at com.android.internal.policy.impl.PhoneWindow$DecorView.startActionMode(PhoneWindow.java:2768)
01-15 10:56:47.169: E/AndroidRuntime(3516): at com.android.internal.policy.impl.PhoneWindow$DecorView.startActionModeForChild(PhoneWindow.java:2654)
01-15 10:56:47.169: E/AndroidRuntime(3516): at android.view.ViewGroup.startActionModeForChild(ViewGroup.java:696)
01-15 10:56:47.169: E/AndroidRuntime(3516): at android.view.ViewGroup.startActionModeForChild(ViewGroup.java:696)
01-15 10:56:47.169: E/AndroidRuntime(3516): at android.view.ViewGroup.startActionModeForChild(ViewGroup.java:696)
01-15 10:56:47.169: E/AndroidRuntime(3516): at android.view.ViewGroup.startActionModeForChild(ViewGroup.java:696)
01-15 10:56:47.169: E/AndroidRuntime(3516): at android.view.ViewGroup.startActionModeForChild(ViewGroup.java:696)
01-15 10:56:47.169: E/AndroidRuntime(3516): at android.view.ViewGroup.startActionModeForChild(ViewGroup.java:696)
01-15 10:56:47.169: E/AndroidRuntime(3516): at android.view.View.startActionMode(View.java:4587)
01-15 10:56:47.169: E/AndroidRuntime(3516): at android.widget.Editor.startSelectionActionMode(Editor.java:1814)
01-15 10:56:47.169: E/AndroidRuntime(3516): at android.widget.Editor.performLongClick(Editor.java:1042)
01-15 10:56:47.169: E/AndroidRuntime(3516): at android.widget.TextView.performLongClick(TextView.java:9589)
01-15 10:56:47.169: E/AndroidRuntime(3516): at android.view.View$CheckForLongPress.run(View.java:18775)
01-15 10:56:47.169: E/AndroidRuntime(3516): at android.os.Handler.handleCallback(Handler.java:730)
01-15 10:56:47.169: E/AndroidRuntime(3516): at android.os.Handler.dispatchMessage(Handler.java:92)
01-15 10:56:47.169: E/AndroidRuntime(3516): at android.os.Looper.loop(Looper.java:137)
01-15 10:56:47.169: E/AndroidRuntime(3516): at android.app.ActivityThread.main(ActivityThread.java:5455)
01-15 10:56:47.169: E/AndroidRuntime(3516): at java.lang.reflect.Method.invokeNative(Native Method)
01-15 10:56:47.169: E/AndroidRuntime(3516): at java.lang.reflect.Method.invoke(Method.java:525)
01-15 10:56:47.169: E/AndroidRuntime(3516): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1187)
01-15 10:56:47.169: E/AndroidRuntime(3516): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
01-15 10:56:47.169: E/AndroidRuntime(3516): at dalvik.system.NativeStart.main(Native Method)
有谁知道如何解决这个问题?
清理项目不起作用,所以这里是活动页面的源代码:
package com.BretonSmarTek.FireQueue;
import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.text.Editable;
import android.text.InputFilter;
import android.text.TextWatcher;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.TextView;
import com.BretonSmarTek.FireQueue.R;
public class miscPage extends Activity {
private TextView tv;
private EditText mTextInfo;
private CheckBox mSendToAll;
private Button mDoAction;
private int defChoice;
private static final String TAG = "miscPage";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.misc_page);
setupInterface();
}
public void setupInterface(){
mDoAction = (Button) findViewById(R.id.btnDoAction);
tv = (TextView)findViewById(R.id.charCountLabel);
mTextInfo = (EditText) findViewById(R.id.miscText);
SharedPreferences settings = getSharedPreferences("GeneralPrefs", 2);
final String name = settings.getString("FName", "") + " " + settings.getString("LName", "");
final String maxChars = Integer.toString(319 - name.length());//319 beacuse of the space before name
mTextInfo.setFilters(new InputFilter[] { new InputFilter.LengthFilter(Integer.parseInt(maxChars)) });
mTextInfo.addTextChangedListener(new TextWatcher(){
public void afterTextChanged(Editable s) {
tv.setText(" - " + name + " " + String.valueOf(mTextInfo.length() + " / " + maxChars));
}
public void beforeTextChanged(CharSequence s, int start, int count, int after){
}
public void onTextChanged(CharSequence s, int start, int before, int count){
}
});
mSendToAll = (CheckBox) findViewById(R.id.chk_sendToAll);
mDoAction.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
//sendMessage
}
});
}
}