Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8544291
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T12:31:18+00:00 2026-06-11T12:31:18+00:00

I didn’t had any other way to ask this question, So here is my

  • 0

I didn’t had any other way to ask this question, So here is my problem:
I have a library project that I use for two applications and its working well. Now I have common login page and login functionality for both the applications and to avoid duplicating the code I want to use same login activity for both the applications. here is code that I use

library project

     public class CanteenPreference {

        // Static variables declaration
        private static final String KEY_INSTANCE_URL = "instance_url";
        private static final String KEY_USER_NAME = "user_name_preferences";
        private static final String KEY_ACCESS_KEY = "access_key_preferences";
        public static final String DEFAULT_URL = "some url";
        private static final String URL_SUFFIX = "/api/call";

        /**
         * Gets the preferred url.
         * 
         * @param activity
         * @return
         */
        public static String getUrl(Activity activity){
            SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(activity.getApplicationContext());
            String previousURL = sharedPrefs.getString(KEY_INSTANCE_URL, null);
            if (previousURL == null) {
                Intent in=new Intent(activity,LoginActivity.class);
                activity.startActivity(in);

                previousURL = sharedPrefs.getString(KEY_INSTANCE_URL, DEFAULT_URL + URL_SUFFIX);
            }
            return previousURL;
        }

        /**
         * Gets the preferred user name.
         * 
         * @param activity
         * @return
         */
        public static String getUserName(Activity activity){
            SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(activity.getApplicationContext());
            String previousUsername = sharedPrefs.getString(KEY_USER_NAME, null);
            if (previousUsername == null) {
                activity.startActivity(new Intent(activity, LoginActivity.class));

                previousUsername = sharedPrefs.getString(KEY_USER_NAME, "test");
            }
            return previousUsername;
        }

        /**
         * Gets the preferred password.
         * 
         * @param activity
         * @return
         */
        public static String getPassword(Activity activity){
            SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(activity.getApplicationContext());
            String previousPassword = sharedPrefs.getString(KEY_ACCESS_KEY, null);
            if (previousPassword == null) {
                activity.startActivity(new Intent(activity, LoginActivity.class));

                previousPassword = sharedPrefs.getString(KEY_ACCESS_KEY, "test");
            }
            return previousPassword;
        }

        /**
         * Writes the preferences
         * 
         * @param activity
         * @param url
         * @param userName
         * @param password
         * @return true if committed
         */
        public static boolean write(Activity activity, String url, String userName, String password){
            SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(activity.getApplicationContext());
            SharedPreferences.Editor prefEditor = sharedPrefs.edit();

            prefEditor.putString(KEY_INSTANCE_URL, url + URL_SUFFIX);
            prefEditor.putString(KEY_USER_NAME, userName);
            prefEditor.putString(KEY_ACCESS_KEY, password);
            return prefEditor.commit();
        }
    }

and loginactivity in library

 public class LoginActivity extends Activity {
    private EditText mUrlInput;
    private EditText mUserInput;
    private EditText mPasswordInput;
    private Button mButton;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.login_page);
        mButton = (Button) findViewById(R.id.loginButt);
        mUrlInput = (EditText) findViewById(R.id.urlInput);
        mUserInput = (EditText) findViewById(R.id.userInput);
        mPasswordInput = (EditText) findViewById(R.id.passwordInput);

        mUrlInput.setText(CanteenPreference.DEFAULT_URL);

        mButton.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {
                final String url = mUrlInput.getText().toString();
                final String userName = mUserInput.getText().toString();
                final String password = mPasswordInput.getText().toString();

                if (url == null || url.length() == 0 || userName == null
                        || userName.length() == 0 || password == null
                        || password.length() == 0) {
                    Toast toast = Toast.makeText(LoginActivity.this,
                            "All fields are required", Toast.LENGTH_SHORT);
                    toast.show();

                } else {

                    Thread loginThread = new Thread() {
                        @Override
                        public void run() {
                            try {
                                DefaultHttpClient httpClient = new DefaultHttpClient();
                                HttpPost httpPost = new HttpPost(url);
                                List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();

                                nameValuePairs.add(new BasicNameValuePair(
                                        "username", userName));
                                nameValuePairs.add(new BasicNameValuePair(
                                        "password", password));

                                httpPost.setEntity(new UrlEncodedFormEntity(
                                        nameValuePairs));
                                HttpResponse httpResponse = httpClient
                                        .execute(httpPost);

                                if (httpResponse.getStatusLine()
                                        .getStatusCode() != HttpStatus.SC_OK) {
                                    throw new Exception("Invalid credentials !");
                                }

                            } catch (Exception e) {
                                Log.d("Login: ", "Invalid credentials", e);
                                Toast toast = Toast.makeText(
                                        LoginActivity.this,
                                        "Invalid credentials",
                                        Toast.LENGTH_SHORT);
                                toast.show();
                            }
                            // write the preferences
                            CanteenPreference.write(LoginActivity.this, url,
                                    userName, password);
                            // finish the activity
                            LoginActivity.this.finish();
                        }
                    };

                    loginThread.start();
                }
            }
        });
    }
}

I have defined Login activity in both application and library manifest still I get following logcat`

    09-07 16:00:12.436: W/ActivityThread(1429): Application com.jumbybay.ferry is waiting for the debugger on port 8100...
09-07 16:00:12.465: I/System.out(1429): Sending WAIT chunk
09-07 16:00:12.465: I/dalvikvm(1429): Debugger is active
09-07 16:00:12.476: I/System.out(1429): Debugger has connected
09-07 16:00:12.476: I/System.out(1429): waiting for debugger to settle...
09-07 16:00:12.685: I/System.out(1429): waiting for debugger to settle...
09-07 16:00:12.836: I/dalvikvm(1429): threadid=3: reacting to signal 3
09-07 16:00:12.896: I/System.out(1429): waiting for debugger to settle...
09-07 16:00:12.896: I/dalvikvm(1429): Wrote stack traces to '/data/anr/traces.txt'
09-07 16:00:13.096: I/System.out(1429): waiting for debugger to settle...
09-07 16:00:13.306: I/System.out(1429): waiting for debugger to settle...
09-07 16:00:13.336: I/dalvikvm(1429): threadid=3: reacting to signal 3
09-07 16:00:13.346: I/dalvikvm(1429): Wrote stack traces to '/data/anr/traces.txt'
09-07 16:00:13.505: I/System.out(1429): waiting for debugger to settle...
09-07 16:00:13.708: I/System.out(1429): waiting for debugger to settle...
09-07 16:00:13.836: I/dalvikvm(1429): threadid=3: reacting to signal 3
09-07 16:00:13.856: I/dalvikvm(1429): Wrote stack traces to '/data/anr/traces.txt'
09-07 16:00:13.906: I/System.out(1429): waiting for debugger to settle...
09-07 16:00:14.106: I/System.out(1429): waiting for debugger to settle...
09-07 16:00:14.306: I/System.out(1429): waiting for debugger to settle...
09-07 16:00:14.376: I/dalvikvm(1429): threadid=3: reacting to signal 3
09-07 16:00:14.385: I/dalvikvm(1429): Wrote stack traces to '/data/anr/traces.txt'
09-07 16:00:14.515: I/System.out(1429): waiting for debugger to settle...
09-07 16:00:14.717: I/System.out(1429): waiting for debugger to settle...
09-07 16:00:14.846: I/dalvikvm(1429): threadid=3: reacting to signal 3
09-07 16:00:14.866: I/dalvikvm(1429): Wrote stack traces to '/data/anr/traces.txt'
09-07 16:00:14.916: I/System.out(1429): debugger has settled (1325)
09-07 16:00:15.356: I/dalvikvm(1429): threadid=3: reacting to signal 3
09-07 16:00:15.375: I/dalvikvm(1429): Wrote stack traces to '/data/anr/traces.txt'
09-07 16:00:15.866: I/dalvikvm(1429): threadid=3: reacting to signal 3
09-07 16:00:15.886: D/dalvikvm(1429): threadid=1: still suspended after undo (sc=1 dc=1)
09-07 16:00:15.886: I/dalvikvm(1429): Wrote stack traces to '/data/anr/traces.txt'
09-07 16:00:16.375: I/dalvikvm(1429): threadid=3: reacting to signal 3
09-07 16:00:16.385: D/dalvikvm(1429): threadid=1: still suspended after undo (sc=1 dc=1)
09-07 16:00:16.385: I/dalvikvm(1429): Wrote stack traces to '/data/anr/traces.txt'
09-07 16:00:16.866: I/dalvikvm(1429): threadid=3: reacting to signal 3
09-07 16:00:16.876: D/dalvikvm(1429): threadid=1: still suspended after undo (sc=1 dc=1)
09-07 16:00:16.886: I/dalvikvm(1429): Wrote stack traces to '/data/anr/traces.txt'
09-07 16:00:17.375: I/dalvikvm(1429): threadid=3: reacting to signal 3
09-07 16:00:17.385: D/dalvikvm(1429): threadid=1: still suspended after undo (sc=1 dc=1)
09-07 16:00:17.385: I/dalvikvm(1429): Wrote stack traces to '/data/anr/traces.txt'
09-07 16:00:17.886: I/dalvikvm(1429): threadid=3: reacting to signal 3
09-07 16:00:17.896: D/dalvikvm(1429): threadid=1: still suspended after undo (sc=1 dc=1)
09-07 16:00:17.896: I/dalvikvm(1429): Wrote stack traces to '/data/anr/traces.txt'
09-07 16:00:18.385: I/dalvikvm(1429): threadid=3: reacting to signal 3
09-07 16:00:18.395: D/dalvikvm(1429): threadid=1: still suspended after undo (sc=1 dc=1)
09-07 16:00:18.395: I/dalvikvm(1429): Wrote stack traces to '/data/anr/traces.txt'
09-07 16:00:18.896: I/dalvikvm(1429): threadid=3: reacting to signal 3
09-07 16:00:18.906: D/dalvikvm(1429): threadid=1: still suspended after undo (sc=1 dc=1)
09-07 16:00:18.906: I/dalvikvm(1429): Wrote stack traces to '/data/anr/traces.txt'
09-07 16:00:19.395: I/dalvikvm(1429): threadid=3: reacting to signal 3
09-07 16:00:19.405: D/dalvikvm(1429): threadid=1: still suspended after undo (sc=1 dc=1)
09-07 16:00:19.405: I/dalvikvm(1429): Wrote stack traces to '/data/anr/traces.txt'
09-07 16:00:19.896: I/dalvikvm(1429): threadid=3: reacting to signal 3
09-07 16:00:19.916: D/dalvikvm(1429): threadid=1: still suspended after undo (sc=1 dc=1)
09-07 16:00:19.916: I/dalvikvm(1429): Wrote stack traces to '/data/anr/traces.txt'
09-07 16:00:20.395: I/dalvikvm(1429): threadid=3: reacting to signal 3
09-07 16:00:20.415: D/dalvikvm(1429): threadid=1: still suspended after undo (sc=1 dc=1)
09-07 16:00:20.415: I/dalvikvm(1429): Wrote stack traces to '/data/anr/traces.txt'
09-07 16:00:20.906: I/dalvikvm(1429): threadid=3: reacting to signal 3
09-07 16:00:20.926: D/dalvikvm(1429): threadid=1: still suspended after undo (sc=1 dc=1)
09-07 16:00:20.926: I/dalvikvm(1429): Wrote stack traces to '/data/anr/traces.txt'
09-07 16:00:21.405: I/dalvikvm(1429): threadid=3: reacting to signal 3
09-07 16:00:21.425: D/dalvikvm(1429): threadid=1: still suspended after undo (sc=1 dc=1)
09-07 16:00:21.425: I/dalvikvm(1429): Wrote stack traces to '/data/anr/traces.txt'
09-07 16:00:21.916: I/dalvikvm(1429): threadid=3: reacting to signal 3
09-07 16:00:21.926: D/dalvikvm(1429): threadid=1: still suspended after undo (sc=1 dc=1)
09-07 16:00:21.936: I/dalvikvm(1429): Wrote stack traces to '/data/anr/traces.txt'
09-07 16:01:15.126: W/ActivityThread(1470): Application com.jumbybay.ferry is waiting for the debugger on port 8100...
09-07 16:01:15.176: I/System.out(1470): Sending WAIT chunk
09-07 16:01:15.176: I/dalvikvm(1470): Debugger is active
09-07 16:01:15.385: I/System.out(1470): Debugger has connected
09-07 16:01:15.385: I/System.out(1470): waiting for debugger to settle...
09-07 16:01:15.585: I/System.out(1470): waiting for debugger to settle...
09-07 16:01:15.787: I/System.out(1470): waiting for debugger to settle...
09-07 16:01:15.996: I/System.out(1470): waiting for debugger to settle...
09-07 16:01:16.195: I/System.out(1470): waiting for debugger to settle...
09-07 16:01:16.399: I/System.out(1470): waiting for debugger to settle...
09-07 16:01:16.601: I/System.out(1470): waiting for debugger to settle...
09-07 16:01:16.795: I/System.out(1470): waiting for debugger to settle...
09-07 16:01:16.996: I/System.out(1470): waiting for debugger to settle...
09-07 16:01:17.207: I/System.out(1470): waiting for debugger to settle...
09-07 16:01:17.408: I/System.out(1470): waiting for debugger to settle...
09-07 16:01:17.610: I/System.out(1470): debugger has settled (1403)
09-07 16:02:10.908: D/AndroidRuntime(1470): Shutting down VM
09-07 16:02:10.908: W/dalvikvm(1470): threadid=1: thread exiting with uncaught exception (group=0x409c01f8)
09-07 16:02:11.056: E/AndroidRuntime(1470): FATAL EXCEPTION: main
09-07 16:02:11.056: E/AndroidRuntime(1470): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.jumbybay.ferry/com.jumbybay.ferry.FerryMain}: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.jumbybay.ferry/com.jumbybay.activity.LoginActivity}; have you declared this activity in your AndroidManifest.xml?
09-07 16:02:11.056: E/AndroidRuntime(1470):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956)
09-07 16:02:11.056: E/AndroidRuntime(1470):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
09-07 16:02:11.056: E/AndroidRuntime(1470):     at android.app.ActivityThread.access$600(ActivityThread.java:123)
09-07 16:02:11.056: E/AndroidRuntime(1470):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
09-07 16:02:11.056: E/AndroidRuntime(1470):     at android.os.Handler.dispatchMessage(Handler.java:99)
09-07 16:02:11.056: E/AndroidRuntime(1470):     at android.os.Looper.loop(Looper.java:137)
09-07 16:02:11.056: E/AndroidRuntime(1470):     at android.app.ActivityThread.main(ActivityThread.java:4424)
09-07 16:02:11.056: E/AndroidRuntime(1470):     at java.lang.reflect.Method.invokeNative(Native Method)
09-07 16:02:11.056: E/AndroidRuntime(1470):     at java.lang.reflect.Method.invoke(Method.java:511)
09-07 16:02:11.056: E/AndroidRuntime(1470):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
09-07 16:02:11.056: E/AndroidRuntime(1470):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
09-07 16:02:11.056: E/AndroidRuntime(1470):     at dalvik.system.NativeStart.main(Native Method)
09-07 16:02:11.056: E/AndroidRuntime(1470): Caused by: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.jumbybay.ferry/com.jumbybay.activity.LoginActivity}; have you declared this activity in your AndroidManifest.xml?
09-07 16:02:11.056: E/AndroidRuntime(1470):     at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1508)
09-07 16:02:11.056: E/AndroidRuntime(1470):     at android.app.Instrumentation.execStartActivity(Instrumentation.java:1384)
09-07 16:02:11.056: E/AndroidRuntime(1470):     at android.app.Activity.startActivityForResult(Activity.java:3190)
09-07 16:02:11.056: E/AndroidRuntime(1470):     at android.app.Activity.startActivity(Activity.java:3297)
09-07 16:02:11.056: E/AndroidRuntime(1470):     at com.jumbybay.activity.CanteenPreference.getUrl(CanteenPreference.java:32)
09-07 16:02:11.056: E/AndroidRuntime(1470):     at com.jumbybay.ferry.FerryMain.onCreate(FerryMain.java:42)
09-07 16:02:11.056: E/AndroidRuntime(1470):     at android.app.Activity.performCreate(Activity.java:4465)
09-07 16:02:11.056: E/AndroidRuntime(1470):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
09-07 16:02:11.056: E/AndroidRuntime(1470):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
09-07 16:02:11.056: E/AndroidRuntime(1470):     ... 11 more
09-07 16:02:11.716: I/dalvikvm(1470): threadid=3: reacting to signal 3
09-07 16:02:11.736: I/dalvikvm(1470): Wrote stack traces to '/data/anr/traces.txt'
09-07 16:07:11.416: I/Process(1470): Sending signal. PID: 1470 SIG: 9

manifest file main activity

        <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.jumbybay.ferry"
        android:versionCode="1"
        android:versionName="1.0" >

        <uses-sdk
            android:minSdkVersion="11"
            android:targetSdkVersion="10" />

        <uses-permission android:name="android.permission.INTERNET" />
        <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

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

                    <category android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
            </activity>

            <activity android:name=".ferryBlur" >
            </activity>
            <activity android:name=".PassengerList" >
            </activity>
            <activity android:name=".com.jumbybay.activity.LoginActivity" >
            </activity>
            <activity android:name=".TripIn" >
            </activity>
        </application>

    </manifest>

manifest file library

    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.jumbybay.activity"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="14"
        android:targetSdkVersion="15" />

    <uses-permission android:name="android.permission.NFC" />
        <uses-permission android:name="android.permission.INTERNET" />

    <uses-feature android:name="android.hardware.nfc" />

    <application>
        <activity
            android:name=".LoginActivity"
            android:label="Jumbybay : Canteen" >
        </activity>
        <activity android:name=".NfcReaderActivity" >
            <intent-filter>
                <action android:name="android.nfc.action.TAG_DISCOVERED" />

                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>
    </application>

</manifest>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T12:31:19+00:00Added an answer on June 11, 2026 at 12:31 pm

    Try to remove the . in your app manifest

    Change

    <activity android:name=".com.jumbybay.activity.LoginActivity" >
    

    into

    <activity android:name="com.jumbybay.activity.LoginActivity" >
    

    The . means that this is part of the package of your Manifest which in your case is wrong.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i didn't want to ask a question, but i don't have any solution at
I didn't see any questions that asked this previously so here goes: Once you
I didn't face this error before. I have a database db , that contains
Didn't know how else to put this. Say I have a JavaScript method that
I didn't see any similar questions asked on this topic, and I had to
I didn't find much in tutorials on this specific question.. So I have a
I didn't know how to express this problem that well in word form so
Didn't see a question similar to this, so here goes: Let's say I'm running
I didn't find an answer on the net and i hope this question have
Didn't even know how to exactly phrase this question, but here is the the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.