Note that there are some explanatory texts on larger screens.

plurals
  1. POerror in xml parsing
    text
    copied!<p>i built a code that switch from one activity to another. when run this code it prints following errors. <strong>Error in an XML file: aborting build.</strong> and <strong>Installation error: INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID</strong> here is my xml file</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="wishme.code" android:versionCode="1" android:versionName="1.0" android:sharedUserId="@string/app_name"&gt; &lt;application android:icon="@drawable/ic_launcher" android:label="@string/app_name" &gt; &lt;activity android:name=".WishMeActivity" 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;activity android:name=".Activity2"&gt;&lt;/activity&gt; &lt;/application&gt; &lt;uses-sdk android:minSdkVersion="8" /&gt; &lt;/manifest&gt; </code></pre> <p>here is activity 1</p> <pre><code>package wishme.code; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.provider.Contacts.Intents; import android.widget.TextView; import android.view.View; import android.widget.EditText; import android.widget.Button; import android.widget.RadioButton; import android.widget.Toast; public class WishMeActivity extends Activity { private EditText text; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); text=(EditText) findViewById(R.id.editText1); } public void myClickhandler(View view) { switch(view.getId()) { case R.id.button1: RadioButton celsiusbutton=(RadioButton) findViewById(R.id.radio0); RadioButton fahrenheit=(RadioButton) findViewById(R.id.radio2); if(text.getText().length()==0) { Toast.makeText(this,"Enter a Valid Value",Toast.LENGTH_LONG).show(); return; } float input=Float.parseFloat(text.getText().toString()); if(celsiusbutton.isChecked()) {text.setText(String.valueOf(convertFahrenheitToCelsius(input))); celsiusbutton.setChecked(false); fahrenheit.setChecked(true);} else { text.setText(String.valueOf(convertCelsiusToFahrenheit(input))); fahrenheit.setChecked(false); celsiusbutton.setChecked(true); } break; case R.id.button_nxt: Intent myintent=new Intent(view.getContext(),Activity2.class); startActivityForResult(myintent, 0); break; } } private float convertFahrenheitToCelsius(float fahrenheit) { return ((fahrenheit - 32) * 5 / 9); } // Converts to fahrenheit private float convertCelsiusToFahrenheit(float celsius) { return ((celsius * 9) / 5) + 32; } } </code></pre> <p>and finally this is activity 2</p> <pre><code>package wishme.code; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; public class Activity2 extends Activity{ public void onCreate(Bundle savedInstancestate) { super.onCreate(savedInstancestate); setContentView(R.layout.main2); Button previous=(Button) findViewById(R.id.button_prev); } public void prevclickhandler(View view) { Intent intent=new Intent(); setResult(RESULT_OK,intent); finish(); } } </code></pre> <p>please suggest me the solution.</p>
 

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