Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid Runtime error
    primarykey
    data
    text
    <p>I am a beginner at writing android apps. Can you please help me how to deal with this problem. i have included the logcat entry and activity class.</p> <p><strong>log:</strong> </p> <pre><code>11-07 12:46:28.245: D/AndroidRuntime(579): Shutting down VM 11-07 12:46:28.245: W/dalvikvm(579): threadid=1: thread exiting with uncaught exception (group=0x40015560) 11-07 12:46:28.285: E/AndroidRuntime(579): FATAL EXCEPTION: main 11-07 12:46:28.285: E/AndroidRuntime(579): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.trial.login/com.trial.login.Login1Activity}: java.lang.NullPointerException 11-07 12:46:28.285: E/AndroidRuntime(579): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647) 11-07 12:46:28.285: E/AndroidRuntime(579): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663) 11-07 12:46:28.285: E/AndroidRuntime(579): at android.app.ActivityThread.access$1500(ActivityThread.java:117) 11-07 12:46:28.285: E/AndroidRuntime(579): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931) 11-07 12:46:28.285: E/AndroidRuntime(579): at android.os.Handler.dispatchMessage(Handler.java:99) 11-07 12:46:28.285: E/AndroidRuntime(579): at android.os.Looper.loop(Looper.java:123) 11-07 12:46:28.285: E/AndroidRuntime(579): at android.app.ActivityThread.main(ActivityThread.java:3683) 11-07 12:46:28.285: E/AndroidRuntime(579): at java.lang.reflect.Method.invokeNative(Native Method) 11-07 12:46:28.285: E/AndroidRuntime(579): at java.lang.reflect.Method.invoke(Method.java:507) 11-07 12:46:28.285: E/AndroidRuntime(579): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839) 11-07 12:46:28.285: E/AndroidRuntime(579): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) 11-07 12:46:28.285: E/AndroidRuntime(579): at dalvik.system.NativeStart.main(Native Method) 11-07 12:46:28.285: E/AndroidRuntime(579): Caused by: java.lang.NullPointerException 11-07 12:46:28.285: E/AndroidRuntime(579): at com.trial.login.Login1Activity.onCreate(Login1Activity.java:28) 11-07 12:46:28.285: E/AndroidRuntime(579): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) 11-07 12:46:28.285: E/AndroidRuntime(579): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611) 11-07 12:46:28.285: E/AndroidRuntime(579): ... 11 more </code></pre> <p><strong>LoginActivity.class:</strong></p> <pre><code> package com.trial.login; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; public class Login1Activity extends Activity { TextView username, password; EditText user_edit, pwd_edit; Button login, cancel; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); login = (Button) findViewById(R.id.bt1); cancel = (Button) findViewById(R.id.bt2); username = (TextView) findViewById(R.id.tv1); password = (TextView) findViewById(R.id.tv2); user_edit = (EditText) findViewById(R.id.txtUname); pwd_edit = (EditText) findViewById(R.id.txtPwd); login.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { display(); } }); } cancel.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { user_edit.clearComposingText(); pwd_edit.clearComposingText(); } }); public void display(){ String user_temp, pwd_temp; user_temp = user_edit.getText().toString(); pwd_temp = pwd_edit.getText().toString(); username.setText(user_temp); password.setText(pwd_temp); } } </code></pre>
    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.
    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