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 7642561
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T09:13:16+00:00 2026-05-31T09:13:16+00:00

I have two packages say com.android.package1 and com.android.package2 An activity in package1 (say A)

  • 0

I have two packages say com.android.package1 and com.android.package2
An activity in package1 (say A) wants to start an activity in package2 (say B)
To do this I used the following method

Intent to_start_B = new Intent(A.this,com.android.Package2.B.class);
startActivity(to_start_B);

This works fine for other activities, except for this (So no problems with manifest and call)!!

the code for this particular activity B is

public class B extends Activity {
private Logger logger = Logger.getMyLogger(this.getClass().getName());

private MicroRuntimeServiceBinder microRuntimeServiceBinder;
private ServiceConnection serviceConnection;

static final int CHAT_REQUEST = 0;
static final int SETTINGS_REQUEST = 1;

private MyReceiver myReceiver;
private MyHandler myHandler;

private TextView infoTextView;
private static String nickname="";

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    myReceiver = new MyReceiver();

    IntentFilter killFilter = new IntentFilter();
    killFilter.addAction("jade.demo.chat.KILL");
    registerReceiver(myReceiver, killFilter);

    IntentFilter showChatFilter = new IntentFilter();
    showChatFilter.addAction("jade.demo.chat.SHOW_CHAT");
    registerReceiver(myReceiver, showChatFilter);

    myHandler = new MyHandler();
    nickname = "Ganesh";//getIntent().getExtras().getString("uname");

    setContentView(R.layout.chat_main);
    Button button = (Button) findViewById(R.id.btn_chatroom);
    button.setOnClickListener(new OnClickListener() {

        public void onClick(View v) {
            // TODO Auto-generated method stub
            if (!checkName(nickname)) {
                logger.info("Invalid nickname!");
                myHandler.postError(getString(R.string.msg_nickname_not_valid));
            } else {
                try {
                    SharedPreferences settings = getSharedPreferences(
                            "jadeChatPrefsFile", 0);
                    String host = settings.getString("defaultHost", "");
                    String port = settings.getString("defaultPort", "");
                    infoTextView.setText(getString(R.string.msg_connecting_to)
                            + " " + host + ":" + port + "...");
                    startChat(nickname, host, port, agentStartupCallback);
                } catch (Exception ex) {
                    logger.severe("Unexpected exception creating chat agent!");
                    infoTextView.setText(getString(R.string.msg_unexpected));
                }
            }

        }
    });     
    infoTextView = (TextView) findViewById(R.id.infoTextView);
    infoTextView.setText("");

}

I am getting an error in following manner

03-07 11:36:25.399: W/dalvikvm(8493): threadid=1: thread exiting with uncaught exception (group=0x40015560)
03-07 11:36:25.409: E/AndroidRuntime(8493): FATAL EXCEPTION: main
03-07 11:36:25.409: E/AndroidRuntime(8493): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.android.home/chat.client.gui.MainActivity}: java.lang.NullPointerException
03-07 11:36:25.409: E/AndroidRuntime(8493):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
03-07 11:36:25.409: E/AndroidRuntime(8493):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
03-07 11:36:25.409: E/AndroidRuntime(8493):     at android.app.ActivityThread.access$1500(ActivityThread.java:117)
03-07 11:36:25.409: E/AndroidRuntime(8493):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
03-07 11:36:25.409: E/AndroidRuntime(8493):     at android.os.Handler.dispatchMessage(Handler.java:99)
03-07 11:36:25.409: E/AndroidRuntime(8493):     at android.os.Looper.loop(Looper.java:123)
03-07 11:36:25.409: E/AndroidRuntime(8493):     at android.app.ActivityThread.main(ActivityThread.java:3683)
03-07 11:36:25.409: E/AndroidRuntime(8493):     at java.lang.reflect.Method.invokeNative(Native Method)
03-07 11:36:25.409: E/AndroidRuntime(8493):     at java.lang.reflect.Method.invoke(Method.java:507)
03-07 11:36:25.409: E/AndroidRuntime(8493):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
03-07 11:36:25.409: E/AndroidRuntime(8493):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
03-07 11:36:25.409: E/AndroidRuntime(8493):     at dalvik.system.NativeStart.main(Native Method)
03-07 11:36:25.409: E/AndroidRuntime(8493): Caused by: java.lang.NullPointerException
03-07 11:36:25.409: E/AndroidRuntime(8493):     at chat.client.gui.MainActivity.onCreate(MainActivity.java:96)
 03-07 11:36:25.409: E/AndroidRuntime(8493):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
 03-07 11:36:25.409: E/AndroidRuntime(8493):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
03-07 11:36:25.409: E/AndroidRuntime(8493):     ... 11 more

So basically its problem related to that particular activity B only.
But if it is executed as part of another application it works fine!

Can anyone please let me know how to get rid of this problem ?

  • 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-05-31T09:13:17+00:00Added an answer on May 31, 2026 at 9:13 am

    Hey found a solution to my problem

    While integrating my two packages from different projects, I had dragged and droped packages from src and gen folder (along with layouts).
    So i had two copies of R file. But the pakage2.R file was invalid as a new R file was automatically generated with new R.id for each component in Package1 (in gen folder)
    So the solution was

    1. Remove Package2 from gen folder.
    2. Import Package1.R file ineach file of Package2
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say I have the following two classes: package example.model; public class Model {
Lets say I have string like this: String q = foo (one) bla (two)
When installing R packages (say mcmcpack in this example) under Ubuntu I have the
I'm learning about packages. I have two classes that are in different packages and
I am evaluating datamining packages. I have find these two so far: RapidMiner Weka
I have a project whose artifacts are two dynamic libraries, let's say libX.dylib and
Let's say I have two ear file and one .jar file with an EJB
Lets say I have two functions: def foo(): return 'foo' def bar(): yield 'bar'
Let's say that I have a two word string and I want to capitalize
Let's say that under my repository trunk I have one file (script.sh) and two

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.