Note that there are some explanatory texts on larger screens.

plurals
  1. POException in an Object toString() command in Android
    primarykey
    data
    text
    <p>Ok, so I have searched through a massive amount of other questions about the same thing but somehow none of those solutions have worked for my problem. So here is my problem, my Android-App crashes as soon as it has to get the text from an EditText to a String. I have my "Main"-Activity here:</p> <pre><code>package ign.test.fre; import android.app.Activity; import android.os.Bundle; import android.view.KeyEvent; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.EditText; import android.widget.Spinner; import android.widget.TextView; public class testfre extends Activity { public static String cv = ""; public static String cm = ""; public static String cz = ""; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); //OTHER DEFINITIONS EditText ev = (EditText) findViewById(R.id.v); final Spinner em =(Spinner) findViewById(R.id.m); final Spinner ez = (Spinner) findViewById(R.id.z); final Button ee = (Button) findViewById(R.id.GO); //LOTS OF SPINNER STUFF ee.setOnClickListener(new AdapterView.OnClickListener() { public void onClick(View arg0) { if(initialsetup == false){ enter = true; run(); } } }); ev.setOnKeyListener(new AdapterView.OnKeyListener() { public boolean onKey(View v, int keyCode, KeyEvent event) { int key = event.getKeyCode(); if(key == KeyEvent.KEYCODE_ENTER){ enter = true; } return false; } }); initialsetup = false; } public void run(){ if(enter == true){ Calc.Test0(); Calc.Test1_se(); Calc.Test2_etre(); Calc.Test3_irr(); if(Test3_irr == false){ //MORE CODE textview6.setText("" + ausgabezeile[5]); } } } </code></pre> <p>My Calc-Class looks like this: package ign.test.fre;</p> <pre><code>public class Calc { public static void Test0(){ testfre.cv = testfre.ev.getText().toString(); testfre.cm = Data.m()[testfre.em.getSelectedItemPosition()]; testfre.cz = Data.zeiten()[testfre.ez.getSelectedItemPosition()]; testfre.cv = testfre.cv.toLowerCase(); testfre.per1.setText(Data.personen()[0]); //... } public static void Test1_se(){ //MORE CODE </code></pre> <p>and it's in the first 3 lines of the Test0() that there's a problem. It dosen't matter which of those lines is first or where in the code they are it's always them. Even moving them to the run() or onClick() didn't change anything.</p> <p>My xml-layout looks like this:</p> <pre><code>&lt;android:weightSum="1"&gt; &lt;EditText android:text="Enter Text" android:id="@+id/v" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_alignParentLeft="true" android:layout_alignParentRight="true"&gt;&lt;/EditText&gt; &lt;Spinner android:layout_width="100dp" android:id="@+id/m" android:layout_height="wrap_content" android:layout_below="@+id/v" android:layout_alignParentLeft="true"&gt;&lt;/Spinner&gt; &lt;Button android:id="@+id/GO" android:layout_width="70dp" android:layout_height="wrap_content" android:text="GO" android:layout_alignTop="@+id/z" android:layout_alignParentRight="true"&gt;&lt;/Button&gt; &lt;Spinner android:layout_width="150dp" android:id="@+id/z" android:layout_height="wrap_content" android:layout_below="@+id/v" android:layout_toRightOf="@+id/m"&gt;&lt;/Spinner&gt; </code></pre> <p>My Logcat-entry looks like this (ignian.lomoko.french is the same as ign.test.fre and so forth):</p> <pre><code>10-25 11:58:41.028: ERROR/AndroidRuntime(316): at android.app.ActivityThread.main(ActivityThread.java:3683) 10-25 11:58:41.028: ERROR/AndroidRuntime(316): at java.lang.reflect.Method.invokeNative(Native Method) 10-25 11:58:41.028: ERROR/AndroidRuntime(316): at java.lang.reflect.Method.invoke(Method.java:507) 10-25 11:58:41.028: ERROR/AndroidRuntime(316): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839) 10-25 11:58:41.028: ERROR/AndroidRuntime(316): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) 10-25 11:58:41.028: ERROR/AndroidRuntime(316): at dalvik.system.NativeStart.main(Native Method) 10-25 11:58:41.038: WARN/ActivityManager(61): Force finishing activity ignian.lomoko.french/.lomokofrench 10-25 11:58:41.558: WARN/ActivityManager(61): Activity pause timeout for HistoryRecord{405c6018 ignian.lomoko.french/.lomokofrench} 10-25 11:58:43.698: INFO/Process(316): Sending signal. PID: 316 SIG: 9 10-25 11:58:43.708: INFO/ActivityManager(61): Process ignian.lomoko.french (pid 316) has died. 10-25 11:58:43.708: INFO/WindowManager(61): WIN DEATH: Window{40691bd8 ignian.lomoko.french/ignian.lomoko.french.lomokofrench paused=false} 10-25 11:58:43.809: WARN/InputManagerService(61): Got RemoteException sending setActive(false) notification to pid 316 uid 10034 10-25 11:58:52.691: WARN/ActivityManager(61): Activity destroy timeout for HistoryRecord{405c6018 ignian.lomoko.french/.lomokofrench} </code></pre> <p>Thanks for any help upfront as I can seriously not find any kind of solution anywhere else. The problem as I understand it upto now with the help of others is that I can't access my variables from my "Calc"-Class. What I'm looking for I guess is a way to make the Spinners and EditText public. </p> <p>Well I followed the solution from dten and now it works!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload