У меня есть один класс noraml java, который сказал ReceivedChat.java в конструкторе этого класса, который я хочу назвать активностью Android.Как вызвать класс Activity из класса noraml java в Android
public class ReceivedChat {
String message;
String from;
Context context;
ReceivedChat(String message, String from) {
this.message = message;
this.from = from;
Bundle b = new Bundle();
b.putString("message", this.message);
b.putString("from", this.from);
b.putString("fromChat", "true");
Intent i = new Intent(context.getApplicationContext(), XmppChatActivity.class);
i.putExtras(b);
context.getApplicationContext().startActivity(i);
}
}
Мой класс деятельности - XmppChatActivity
.
Эта программа не работает. он не вызывает onCreate моего XmppChatActivity
класс Любая помощь будет благодарна мне.
Какая ошибка? –
где вы инициализируете 'context'? – Farnabaz