Note that there are some explanatory texts on larger screens.

plurals
  1. PORunning an android application
    primarykey
    data
    text
    <p>I am having trouble when I am trying to run my simple android applications On my system I tested for some other applications which were not created on my system and those worked well but when I edit those on my system then also these applications wont work. I am getting many errors</p> <pre><code>09-26 07:23:55.458: E/AndroidRuntime(1341): ... 11 more at com.calculation.MainActivity.&lt;init&gt;(MainActivity.java:19) at java.lang.Class.newInstanceImpl(Native Method) : at java.lang.Class.newInstance(Class.java:1130) at android.app.Instrumentation.newActivity(Instrumentation.java:1061) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2128) </code></pre> <p>Why am I getting this Please Help me</p> <pre><code>package com.calculation; import android.os.Bundle; import android.app.Activity; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; import android.app.AlertDialog; import android.content.DialogInterface; public class MainActivity extends Activity { EditText value1,value2; Button add; TextView display; int num1=0, num2=0, total=0; final AlertDialog alertdialog= new AlertDialog.Builder(MainActivity.this).create(); @SuppressWarnings("deprecation") @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); value1=(EditText)findViewById(R.id.input1); value2=(EditText)findViewById(R.id.input2); add=(Button)findViewById(R.id.btnadd); display=(TextView)findViewById(R.id.result); if(value1==null) { alertdialog.setTitle("AlertDialog"); alertdialog.setMessage("Please Enter a Valid Input"); alertdialog.setIcon(R.drawable.ic_launcher); alertdialog.setButton("Ok", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // TODO Auto-generated method stub Toast.makeText(getApplicationContext(), "You Clicked OK" , Toast.LENGTH_LONG).show(); } }); } else if(value2==null) { alertdialog.setTitle("AlertDialog"); alertdialog.setMessage("Please Enter a Valid Input"); alertdialog.setIcon(R.drawable.ic_launcher); alertdialog.setButton("Ok", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // TODO Auto-generated method stub Toast.makeText(getApplicationContext(), "You Clicked OK" , Toast.LENGTH_LONG).show(); } }); } add.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub num1=Integer.parseInt(value1.getText().toString()); num2=Integer.parseInt(value2.getText().toString()); total=num1+num2; display.setText("ADDITION IS"+total); } }); } </code></pre> <p>}</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.
    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