0

i built a code that switch from one activity to another. when run this code it prints following errors. Error in an XML file: aborting build. and Installation error: INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID here is my xml file

<?xml version="1.0" encoding="utf-8"?>
<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">



    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" >
        <activity
            android:name=".WishMeActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name=".Activity2"></activity>
    </application>
<uses-sdk android:minSdkVersion="8" />
</manifest>

here is activity 1

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;
    }
}

and finally this is activity 2

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();
    }
}

please suggest me the solution.

0

2 Answers 2

1

I you just want to go from one activity to another, then you dont need to give the sharedUserID. Its used in cases where you have two different applications that are signed with same certificate and you want to share data between them or you want them to run in the same process.

If you remove it, it should solve your problem.

For information about sharedUserID: http://developer.android.com/guide/topics/manifest/manifest-element.html#uid

Sign up to request clarification or add additional context in comments.

Comments

1

This may be due to your sharedUserId value being of a non-permitted value. It has to have the same format as the package structure (e.g. com.android).

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.