how to call An Activity class from a normal java class
you will need to pass Current Activity Context to ReceivedChat
at the time of Object Creation from an Activity or any other Application Components as :
ReceivedChat(String message, String from,Context context)
{
this.message = message;
this.from = from;
this.context=context; //<< initialize Context here
Intent i = new Intent(context,XmppChatActivity.class);
//....your code here
context.startActivity(i);
}
and instead of starting another Activity from class Constructor create an method in ReceivedChat
and call it after object creation