Note that there are some explanatory texts on larger screens.

plurals
  1. POError when I run my app on eclipse emulator
    primarykey
    data
    text
    <p>I made an android app and every time i run it on Eclipse in Emulator it stops. even i have no error!It is avery simple app... but in the emulator it crashes.Ihave no ideea why is this happening. In emulator appears "the process has stopped unexpectedly" or something like this ...</p> <p>Here is the LogCat:</p> <pre><code>05-05 09:26:58.699: D/AndroidRuntime(1222): Shutting down VM 05-05 09:26:58.749: W/dalvikvm(1222): threadid=1: thread exiting with uncaught exception (group=0x40a71930) 05-05 09:26:58.819: E/AndroidRuntime(1222): FATAL EXCEPTION: main 05-05 09:26:58.819: E/AndroidRuntime(1222): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.create.namestrings/com.create.namestrings.MainActivity}: java.lang.NullPointerException 05-05 09:26:58.819: E/AndroidRuntime(1222): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2106) 05-05 09:26:58.819: E/AndroidRuntime(1222): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230) 05-05 09:26:58.819: E/AndroidRuntime(1222): at android.app.ActivityThread.access$600(ActivityThread.java:141) 05-05 09:26:58.819: E/AndroidRuntime(1222): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234) 05-05 09:26:58.819: E/AndroidRuntime(1222): at android.os.Handler.dispatchMessage(Handler.java:99) 05-05 09:26:58.819: E/AndroidRuntime(1222): at android.os.Looper.loop(Looper.java:137) 05-05 09:26:58.819: E/AndroidRuntime(1222): at android.app.ActivityThread.main(ActivityThread.java:5041) 05-05 09:26:58.819: E/AndroidRuntime(1222): at java.lang.reflect.Method.invokeNative(Native Method) 05-05 09:26:58.819: E/AndroidRuntime(1222): at java.lang.reflect.Method.invoke(Method.java:511) 05-05 09:26:58.819: E/AndroidRuntime(1222): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) 05-05 09:26:58.819: E/AndroidRuntime(1222): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) 05-05 09:26:58.819: E/AndroidRuntime(1222): at dalvik.system.NativeStart.main(Native Method) 05-05 09:26:58.819: E/AndroidRuntime(1222): Caused by: java.lang.NullPointerException 05-05 09:26:58.819: E/AndroidRuntime(1222): at android.app.Activity.findViewById(Activity.java:1839) 05-05 09:26:58.819: E/AndroidRuntime(1222): at com.create.namestrings.MainActivity.&lt;init&gt;(MainActivity.java:16) 05-05 09:26:58.819: E/AndroidRuntime(1222): at java.lang.Class.newInstanceImpl(Native Method) 05-05 09:26:58.819: E/AndroidRuntime(1222): at java.lang.Class.newInstance(Class.java:1319) 05-05 09:26:58.819: E/AndroidRuntime(1222): at android.app.Instrumentation.newActivity(Instrumentation.java:1054) 05-05 09:26:58.819: E/AndroidRuntime(1222): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097) 05-05 09:26:58.819: E/AndroidRuntime(1222): ... 11 more 05-05 09:27:51.169: E/Trace(1263): error opening trace file: No such file or directory (2) </code></pre> <p>And here is the java file:</p> <pre><code>package com.create.namestrings; import java.util.Random; import android.os.Bundle; import android.app.Activity; import android.graphics.Color; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.RadioButton; import android.widget.TextView; public class MainActivity extends Activity { EditText etName = (EditText) findViewById (R.id.editText1); RadioButton RbtnGirl = (RadioButton) findViewById (R.id.radioButton1); RadioButton RbtnBoy = (RadioButton) findViewById (R.id.radioButton2); Button btn = (Button) findViewById (R.id.button1); TextView txt = (TextView) findViewById (R.id.textView2); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub String name = etName.getText().toString(); Random r = new Random(); if (RbtnGirl.isChecked()){ switch (r.nextInt(6)){ case 0 : txt.setText("Esti frumoasa, "+ name); txt.setTextColor(Color.CYAN); break; case 1 : txt.setText("Mi-e greata cand te vad, "+ name); txt.setTextColor(Color.GREEN); break; case 2 : txt.setText("Esti grasa, "+ name); txt.setTextColor(Color.BLUE); break; case 3 : txt.setText("Esti puturoasa, "+ name); txt.setTextColor(Color.YELLOW); break; case 4 : txt.setText("Esti minunata "+ name); txt.setTextColor(Color.DKGRAY); break; case 5 : txt.setText("Esti la moda, "+ name); txt.setTextColor(Color.MAGENTA); break; } }else if (RbtnBoy.isChecked()){ switch (r.nextInt(6)){ case 0 : txt.setText("Esti frumos, "+ name); txt.setTextColor(Color.CYAN); break; case 1 : txt.setText("Mai,"+name+"!Esti inalt ca bradu' da' prost ca gardu'!"); txt.setTextColor(Color.RED); break; case 2 : txt.setText("Esti gras, "+ name); txt.setTextColor(Color.GREEN); break; case 3 : txt.setText("Esti puturos, "+ name); txt.setTextColor(Color.GRAY); break; case 4 : txt.setText("Esti destept "+ name); txt.setTextColor(Color.WHITE); break; case 5 : txt.setText("Esti la moda, "+ name); txt.setTextColor(Color.LTGRAY); break; } }else { txt.setText("Te rog, alege baiat sau fata!"); } } }); } } </code></pre> <p>and the manifest:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.create.namestrings" android:versionCode="1" android:versionName="1.0" &gt; &lt;uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17" /&gt; &lt;application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" &gt; &lt;activity android:name="com.create.namestrings.MainActivity" android:label="@string/app_name" &gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.MAIN" /&gt; &lt;category android:name="android.intent.category.LAUNCHER" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;/application&gt; &lt;/manifest&gt; </code></pre> <p>Plese help!!!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    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.
    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