0

Hi I currently have two packages in my android application say com.packagea and com.packageb .Now I am attempting to activate an activity in com.packageb from an activity in com.packagea by the following code

    String username = ((android.widget.EditText)findViewById(R.id.editUserName)).getText().toString();
    String pass = ((android.widget.EditText)findViewById(R.id.editPass)).getText().toString();
    Intent i = new Intent(this, Authenticate.class);
    i.putExtra("uname", username);
    i.putExtra("pass",pass);
    startActivityForResult(i, 1);

However it wont even go into Authenticate.class which is in com.packageb. Any suggestions why it isnt going in that class. Here is how I have declared the activity in my manifest file

    <activity
        android:name=".Authenticate"
        android:label="@string/title_activity_options" >
    </activity>

Do I need to specify a package name along with this. This only happens when I attempt to call an activity from a different package. Any suggestions on how to resolve this issue

MistyD
  • 16,373
  • 40
  • 138
  • 240

2 Answers2

0

Try using the fully qualified name:

 com.packageb.Authenticate

    <activity
      android:name="com.packageb.Authenticate"
      android:label="@string/title_activity_options" >
  </activity>

instead of

 <activity
    android:name=".Authenticate"
    android:label="@string/title_activity_options" >
</activity>
GrIsHu
  • 29,068
  • 10
  • 64
  • 102
0

If Authenticate activity is in com.packageb and you are trying to invoke it form com.packagea package you can use the ceonvenience method Intent.setClassName():

Intent i = new Intent();
i.setClassName("com.packageb", "com.packageb.Authenticate");
...
Diego Torres Milano
  • 65,697
  • 9
  • 111
  • 134