My program manage a socket based communication. When the client connect to the server socket this ClientActivity will be started: clientActivity = new ClientActivity(); Intent intent = new Intent(mainActivity, clientActivity.getClass());
Never instantiate activities with new
. Either the classes should not be activities in the first place, or you should invoke them with an Intent
.
The reason for the NPE is that onCreate()
was not called on the activity you created yourself.