我遇到了这个错误的问题。我不知道为什么,但它突然停止工作。单击“保存”按钮后,将显示此消息。我开始绝望了。我将不胜感激任何帮助!
06-23 17:18:02.918 5102-5102/jansoldat.formularkomunikace E/Trace: error opening trace file: No such file or directory (2)
06-23 17:18:03.088 5102-5102/jansoldat.formularkomunikace W/dalvikvm: VFY: unable to find class referenced in signature (Landroid/view/SearchEvent;)
06-23 17:18:03.088 5102-5102/jansoldat.formularkomunikace W/dalvikvm: VFY: unable to resolve interface method 15053: Landroid/view/Window$Callback;.onSearchRequested (Landroid/view/SearchEvent;)Z
06-23 17:18:03.088 5102-5102/jansoldat.formularkomunikace W/dalvikvm: VFY: unable to resolve interface method 15057: Landroid/view/Window$Callback;.onWindowStartingActionMode (Landroid/view/ActionMode$Callback;I)Landroid/view/ActionMode;
06-23 17:18:03.199 5102-5102/jansoldat.formularkomunikace W/dalvikvm: VFY: unable to resolve virtual method 14952: Landroid/view/ViewGroup;.onRtlPropertiesChanged (I)V
06-23 17:18:03.199 5102-5102/jansoldat.formularkomunikace W/dalvikvm: VFY: unable to resolve virtual method 410: Landroid/content/res/TypedArray;.getChangingConfigurations ()I
06-23 17:18:03.199 5102-5102/jansoldat.formularkomunikace W/dalvikvm: VFY: unable to resolve virtual method 432: Landroid/content/res/TypedArray;.getType (I)I
06-23 17:18:04.320 5102-5102/jansoldat.formularkomunikace D/skia: FontHost open localized file: /system/etc/fallback_fonts.xml
06-23 17:18:04.680 5102-5102/jansoldat.formularkomunikace I/Adreno200-EGL: <qeglDrvAPI_eglInitialize:269>: EGL 1.4 QUALCOMM build: AU_LINUX_ANDROID_JB_REL_RB4.04.01.02.16.028_msm8960_JB_REL_RB4.2_Merge_release_AU (Merge)
Build Date: 12/06/12 Thu
Local Branch:
Remote Branch: m/jb_rel_rb4.2
Local Patches: NONE
Reconstruct Branch: NOTHING
06-23 17:18:04.750 5102-5102/jansoldat.formularkomunikace D/libc: pt_debug : pthread_create->start_routine=0x51029e31, tls=0x53eddf00, arg=0x4005f1a8
06-23 17:18:04.750 5102-5159/jansoldat.formularkomunikace D/libc: pt_debug : __thread_entry->func=0x51029e31
, tls=0x53eddf00, arg=0x4005f1a8
06-23 17:18:04.770 5102-5102/jansoldat.formularkomunikace D/memalloc: ion: Mapped buffer base:0x53ede000 size:2088960 offset:0 fd:61
06-23 17:18:04.770 5102-5102/jansoldat.formularkomunikace D/memalloc: ion: Mapped buffer base:0x50263000 size:4096 offset:0 fd:63
06-23 17:18:04.810 5102-5102/jansoldat.formularkomunikace I/Choreographer: Skipped 30 frames! The application may be doing too much work on its main thread.
06-23 17:18:05.031 5102-5102/jansoldat.formularkomunikace D/memalloc: ion: Mapped buffer base:0x545b7000 size:2088960 offset:0 fd:66
06-23 17:18:05.031 5102-5102/jansoldat.formularkomunikace D/memalloc: ion: Mapped buffer base:0x5029a000 size:4096 offset:0 fd:68
06-23 17:18:05.141 5102-5102/jansoldat.formularkomunikace D/memalloc: ion: Mapped buffer base:0x548b5000 size:2088960 offset:0 fd:70
06-23 17:18:05.141 5102-5102/jansoldat.formularkomunikace D/memalloc: ion: Mapped buffer base:0x502af000 size:4096 offset:0 fd:72
06-23 17:18:05.311 5102-5115/jansoldat.formularkomunikace D/libc: pt_debug : pthread_create->start_routine=0x40311509, tls=0x54bb2f00, arg=0x5176b400
06-23 17:18:05.311 5102-5187/jansoldat.formularkomunikace D/libc: pt_debug : __thread_entry->func=0x40311509
, tls=0x54bb2f00, arg=0x5176b400
06-23 17:18:10.737 5102-5102/jansoldat.formularkomunikace W/dalvikvm: threadid=1: thread exiting with uncaught exception (group=0x41ca3468)
06-23 17:18:10.777 5102-5102/jansoldat.formularkomunikace E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.IllegalStateException: Could not execute method for android:onClick
at android.support.v7.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:293)
at android.view.View.performClick(View.java:4102)
at android.view.View$PerformClick.run(View.java:17085)
at android.os.Handler.handleCallback(Handler.java:615)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:155)
at android.app.ActivityThread.main(ActivityThread.java:5454)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1029)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:796)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at android.support.v7.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:288)
at android.view.View.performClick(View.java:4102)
at android.view.View$PerformClick.run(View.java:17085)
at android.os.Handler.handleCallback(Handler.java:615)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:155)
at android.app.ActivityThread.main(ActivityThread.java:5454)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1029)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:796)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at jansoldat.formularkomunikace.MainActivity.SaveData(MainActivity.java:253)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at android.support.v7.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:288)
at android.view.View.performClick(View.java:4102)
at android.view.View$PerformClick.run(View.java:17085)
at android.os.Handler.handleCallback(Handler.java:615)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:155)
at android.app.ActivityThread.main(ActivityThread.java:5454)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1029)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:796)
at dalvik.system.NativeStart.main(Native Method)
06-23 17:18:12.739 5102-5102/jansoldat.formularkomunikace D/Process: killProcess, pid=5102
06-23 17:18:12.749 5102-5102/jansoldat.formularkomunikace D/Process: dalvik.system.VMStack.getThreadStackTrace(Native Method)
06-23 17:18:12.769 5102-5102/jansoldat.formularkomunikace D/Process: java.lang.Thread.getStackTrace(Thread.java:599)
06-23 17:18:12.769 5102-5102/jansoldat.formularkomunikace D/Process: android.os.Process.killProcess(Process.java:944)
06-23 17:18:12.769 5102-5102/jansoldat.formularkomunikace D/Process: com.android.internal.os.RuntimeInit$UncaughtHandler.uncaughtException(RuntimeInit.java:108)
06-23 17:18:12.769 5102-5102/jansoldat.formularkomunikace D/Process: java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:693)
06-23 17:18:12.769 5102-5102/jansoldat.formularkomunikace D/Process: java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:690)
06-23 17:18:12.779 5102-5102/jansoldat.formularkomunikace D/Process: dalvik.system.NativeStart.main(Native Method)
这是我的主要活动
package jansoldat.formularkomunikace;
import android.app.AlertDialog;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.net.Uri;
import android.provider.MediaStore;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TableRow;
import android.widget.TextView;
import android.widget.Toast;
import java.util.ArrayList;
public class MainActivity extends AppCompatActivity {
public static final int REQUEST_CAPTURE = 1;
Button buttonPridejStaniceni,button_Vyber_Fotku, button_Fotak;
TableRow Radek_2, Radek_3, Radek_4,Radek_5,Radek_6;
ImageView imageView_VyberFotku, imageView_Fotak;
private static final int PICK_IMAGE = 100;
Uri imageUri_vybrana;
/*===========Databáze Prvky====================*/
/*==========Staničení====================*/
EditText editText1__0m,editText2__0m,editText3__0m/*,editText1__2m,editText2__2m,editText3__2m,editText1__4m,editText2__4m,editText3__4m,
editText1__6m,editText2__6m,editText3__6m,editText1__8m,editText2__8m,editText3__8m,editText1__10m,editText2__10m,editText3__10m*/;
/*==========Staničení Stringy============*/
String sirka_0m,podelny_sklon_0m,pricny_sklon_0m/*,sirka_2m,podelny_sklon_2m,pricny_sklon_2m,sirka_4m,podelny_sklon_4m,pricny_sklon_4m,
sirka_6m,podelny_sklon_6m,pricny_sklon_6m,sirka_8m,podelny_sklon_8m,pricny_sklon_8m,sirka_10m,podelny_sklon_10m,pricny_sklon_10m*/
,velikost_poruch,cetnost_poruch,nerovnosti_povrchu,obrazek_galerie;
/*ChechBoxy*/
CheckBox checkBox_povrch_bez_poruch, checkBox_mensi_poruchy_povrchu, checkBox_vetsi_poruchy_povrchu, checkBox_mala_cetnost_poruch, checkBox_velka_cetnost_poruch;
/*RADIoBUTTONY*/
RadioButton radioButton_bez_nerovnosti, radioButton_mirne_zvlneny, radio_button_velke_nerovnosti;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
buttonPridejStaniceni = (Button) findViewById(R.id.buttonPridejStaniceni);
Radek_2 = (TableRow) findViewById(R.id.Radek_2);
Radek_3 = (TableRow) findViewById(R.id.Radek_3);
Radek_4 = (TableRow) findViewById(R.id.Radek_4);
Radek_5 = (TableRow) findViewById(R.id.Radek_5);
Radek_6 = (TableRow) findViewById(R.id.Radek_6);
imageView_VyberFotku = (ImageView) findViewById(R.id.imageView_VyberFotku);
button_Vyber_Fotku = (Button) findViewById(R.id.button_Vyber_Fotku);
imageView_Fotak = (ImageView) findViewById(R.id.imageView_Fotak);
button_Fotak = (Button) findViewById(R.id.button_fotak);
checkBox_povrch_bez_poruch = (CheckBox) findViewById(R.id.checkBox_povrch_bez_poruch);
checkBox_mensi_poruchy_povrchu = (CheckBox) findViewById(R.id.checkBox_mensi_poruchy_povrchu);
checkBox_vetsi_poruchy_povrchu = (CheckBox) findViewById(R.id.checkBox_vetsi_poruchy_povrchu);
checkBox_mala_cetnost_poruch = (CheckBox) findViewById(R.id.checkBox_mala_cetnost_poruch);
checkBox_velka_cetnost_poruch = (CheckBox) findViewById(R.id.checkBox_velka_cetnost_poruch);
radioButton_bez_nerovnosti = (RadioButton) findViewById(R.id.radioButton_rovny_bez_nerov);
radioButton_mirne_zvlneny = (RadioButton) findViewById(R.id.radioButton_mirne_zvlneny_s_malymi_nerovnost);
radio_button_velke_nerovnosti = (RadioButton) findViewById(R.id.radioButton_zvlneny_s_velkymi_nerovnostmi);
if (!hasCamera())
{
button_Fotak.setEnabled(true);
}
/*==============Databáze prvky=============*/
/*=================Staničení=============*/
editText1__0m = (EditText) findViewById(R.id.editText1_0m);/*******/ editText2__0m = (EditText) findViewById(R.id.editText2_0m);/****/ editText3__0m = (EditText) findViewById(R.id.editText3_0m);
/* editText1__2m = (EditText) findViewById(R.id.editText1_2m); editText2__2m = (EditText) findViewById(R.id.editText2_2m); editText3__2m = (EditText) findViewById(R.id.editText3_2m);
editText1__4m = (EditText) findViewById(R.id.editText1_4m); editText2__4m = (EditText) findViewById(R.id.editText2_4m);editText3__4m = (EditText) findViewById(R.id.editText3_4m);
editText1__6m = (EditText) findViewById(R.id.editText1_6m); editText2__6m = (EditText) findViewById(R.id.editText2_6m); editText3__6m = (EditText) findViewById(R.id.editText3_6m);
editText1__8m = (EditText) findViewById(R.id.editText1_8m); editText2__8m = (EditText) findViewById(R.id.editText2_8m); editText3__8m = (EditText) findViewById(R.id.editText3_8m);
editText1__10m = (EditText) findViewById(R.id.editText1__10m); editText2__10m = (EditText) findViewById(R.id.editText2_10m); editText3__10m = (EditText) findViewById(R.id.editText3_10m);*/
Button button =(Button)findViewById(R.id.yourbuttonid);
button.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Intent dbmanager = new Intent(MainActivity.this,AndroidDatabaseManager.class);
startActivity(dbmanager);
}
});
}
int[] views = new int[]{R.id.Radek_2,R.id.Radek_3,R.id.Radek_4,R.id.Radek_5,R.id.Radek_6};//...
int counter = 0;
public void PridejDalsiStaniceniClicked(View v)
{
findViewById(views[counter]).setVisibility(View.VISIBLE);
if(counter<views.length){
counter++;
}
if(counter==views.length)
{
findViewById(R.id.buttonPridejStaniceni).setVisibility(View.INVISIBLE);
Toast.makeText(MainActivity.this, "Vyčepal jsi maximální možnou velikost staničení!!", Toast.LENGTH_SHORT).show();
}
}
public void BezPoruchClick(View v)
{
if (checkBox_povrch_bez_poruch.isChecked()) {
findViewById(R.id.checkBox_mensi_poruchy_povrchu).setClickable(false);
findViewById(R.id.checkBox_vetsi_poruchy_povrchu).setClickable(false);
findViewById(R.id.checkBox_mala_cetnost_poruch).setClickable(false);
findViewById(R.id.checkBox_velka_cetnost_poruch).setClickable(false);
} else {
findViewById(R.id.checkBox_mensi_poruchy_povrchu).setClickable(true);
findViewById(R.id.checkBox_vetsi_poruchy_povrchu).setClickable(true);
findViewById(R.id.checkBox_mala_cetnost_poruch).setClickable(true);
findViewById(R.id.checkBox_velka_cetnost_poruch).setClickable(true);
}
}
public void MensiPoruchyClick(View v)
{
if (checkBox_mensi_poruchy_povrchu.isChecked()) {
findViewById(R.id.checkBox_povrch_bez_poruch).setClickable(false);
findViewById(R.id.checkBox_vetsi_poruchy_povrchu).setClickable(false);
}else {
findViewById(R.id.checkBox_povrch_bez_poruch).setClickable(true);
findViewById(R.id.checkBox_vetsi_poruchy_povrchu).setClickable(true);
}
}
public void VetsiPoruchyClick(View v)
{
if (checkBox_vetsi_poruchy_povrchu.isChecked()) {
findViewById(R.id.checkBox_povrch_bez_poruch).setClickable(false);
findViewById(R.id.checkBox_mensi_poruchy_povrchu).setClickable(false);
}else {
findViewById(R.id.checkBox_povrch_bez_poruch).setClickable(true);
findViewById(R.id.checkBox_mensi_poruchy_povrchu).setClickable(true);
}
}
public void MalaCetnostClick(View v)
{
if (checkBox_mala_cetnost_poruch.isChecked()) {
findViewById(R.id.checkBox_povrch_bez_poruch).setClickable(false);
findViewById(R.id.checkBox_velka_cetnost_poruch).setClickable(false);
}else {
findViewById(R.id.checkBox_povrch_bez_poruch).setClickable(true);
findViewById(R.id.checkBox_velka_cetnost_poruch).setClickable(true);
}
}
public void VelkaCetnostClick(View v)
{
if (checkBox_velka_cetnost_poruch.isChecked()) {
findViewById(R.id.checkBox_povrch_bez_poruch).setClickable(false);
findViewById(R.id.checkBox_mala_cetnost_poruch).setClickable(false);
}else {
findViewById(R.id.checkBox_povrch_bez_poruch).setClickable(true);
findViewById(R.id.checkBox_mala_cetnost_poruch).setClickable(true);
}
}
public void SaveData(View view)
{
sirka_0m = editText1__0m.getText().toString();
podelny_sklon_0m = editText2__0m.getText().toString();
pricny_sklon_0m = editText3__0m.getText().toString();
/*===========Velikost poruch povrchu==============*/
if (checkBox_povrch_bez_poruch.isChecked())
{
velikost_poruch = "Povrch bez poruch";
cetnost_poruch = null;
}
if (checkBox_mensi_poruchy_povrchu.isChecked())
{
velikost_poruch = "Menší poruchy povrchu";
}
if (checkBox_vetsi_poruchy_povrchu.isChecked())
{
velikost_poruch = "Větší poruchy povrchu";
}
/*==================================================*/
if (checkBox_mala_cetnost_poruch.isChecked()){
cetnost_poruch = "Malá četnost poruch";
}
if (checkBox_velka_cetnost_poruch.isChecked()){
cetnost_poruch="Velká četnost poruch";
}
/*============RadioButton=======================*/
if (radioButton_bez_nerovnosti.isChecked())
{
nerovnosti_povrchu = "Rovný povrch bez nerovností";
}
if (radioButton_mirne_zvlneny.isChecked())
{
nerovnosti_povrchu = "Mírně zvlněný povrch s malými nerovnostmi";
}
if (radio_button_velke_nerovnosti.isChecked())
{
nerovnosti_povrchu = "Zvlněný povrch s velkými nerovnostmi";
}
/*=============IMAGE======================*/
obrazek_galerie = imageUri_vybrana.getEncodedPath();
BackgroundTask backgroundTask = new BackgroundTask(this);
backgroundTask.execute("add_info", sirka_0m, podelny_sklon_0m, pricny_sklon_0m,velikost_poruch,cetnost_poruch,nerovnosti_povrchu,obrazek_galerie);
}
public void Vyber_fotku_clicked(View v)
{
openGallery();
}
private void openGallery()
{
Intent gallery = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.INTERNAL_CONTENT_URI);
startActivityForResult(gallery, PICK_IMAGE);
}
public boolean hasCamera()
{
return getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA_ANY);
}
public void PouzijFotakClicked(View v)
{
Intent vyfot = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(vyfot , REQUEST_CAPTURE);
}
/* Výběr obrázku a vyfocení*/
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data){
if (requestCode == REQUEST_CAPTURE && resultCode == RESULT_OK){
Bundle extras = data.getExtras();
Bitmap photo = (Bitmap) extras.get("data");
imageView_Fotak.setImageBitmap(photo);
}
else if (resultCode == RESULT_OK && requestCode == PICK_IMAGE){
imageUri_vybrana = data.getData();
imageView_VyberFotku.setImageURI(imageUri_vybrana);
}
}
}