Skip to content

Commit

Permalink
updated onAttach signature.
Browse files Browse the repository at this point in the history
  • Loading branch information
Vamsee Lakamsani committed Feb 20, 2017
1 parent 8ebe096 commit 931efc2
Showing 1 changed file with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.github.nkzawa.socketio.androidchat;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
Expand Down Expand Up @@ -60,12 +61,20 @@ public MainFragment() {
super();
}


// This event fires 1st, before creation of fragment or any views
// The onAttach method is called when the Fragment instance is associated with an Activity.
// This does not mean the Activity is fully initialized.
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
mAdapter = new MessageAdapter(activity, mMessages);
public void onAttach(Context context) {
super.onAttach(context);
mAdapter = new MessageAdapter(context, mMessages);
if (context instanceof Activity){
//this.listener = (MainActivity) context;
}
}


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

0 comments on commit 931efc2

Please sign in to comment.