Skip to content
Snippets Groups Projects
Commit 0038a614 authored by Emeric Vigier's avatar Emeric Vigier
Browse files

#17220: fix service NullPointerException issue

Conflicts:

	src/com/savoirfairelinux/sflphone/client/CallElementList.java
parent 13179524
No related branches found
No related tags found
No related merge requests found
......@@ -72,7 +72,7 @@ public class AccountManagementFragment extends PreferenceFragment
static final int ACCOUNT_CREATE_REQUEST = 1;
static final int ACCOUNT_EDIT_REQUEST = 2;
private SFLPhonePreferenceActivity sflphonePreferenceActivity;
private ISipService service;
private ISipService service = null;
ArrayList<AccountDetail.PreferenceEntry> basicDetailKeys = null;
ArrayList<AccountDetail.PreferenceEntry> advancedDetailKeys = null;
......@@ -106,6 +106,19 @@ public class AccountManagementFragment extends PreferenceFragment
Log.i(TAG, "Create Account Management Fragment");
/*
* FIXME if service cannot be obtained from SFLPhonePreferenceActivity,
* then get it from Application
*/
service = sflphonePreferenceActivity.getSipService();
if (service == null) {
service = ((SFLphoneApplication)sflphonePreferenceActivity.getApplication()).getSipService();
if (service == null) {
Log.e(TAG, "onCreate() service=" + service);
}
}
Log.w(TAG, "onCreate() service=" + service);
setPreferenceScreen(getAccountListPreferenceScreen());
LocalBroadcastManager.getInstance(getActivity()).registerReceiver(mMessageReceiver, new IntentFilter("accounts-changed"));
......
......@@ -83,6 +83,7 @@ public class CallElementList extends ListFragment implements LoaderManager.Loade
private CallElementAdapter mAdapter;
private String mCurFilter;
private SFLPhoneHome sflphoneHome;
private SFLphoneApplication sflphoneApplication;
private ISipService service;
private AccountSelectionButton mAccountSelectionButton;
private AccountList mAccountList;
......@@ -303,6 +304,8 @@ public class CallElementList extends ListFragment implements LoaderManager.Loade
Log.i(TAG, "On Long Click");
final CharSequence[] items = {"Hang up Call", "Send Message", "Add to Conference"};
final SipCall call = (SipCall) mAdapter.getItem(pos);
// FIXME
service = sflphoneApplication.getSipService();
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle("Action to perform with " + call.mCallInfo.mDisplayName)
.setCancelable(true)
......
......@@ -89,6 +89,7 @@ public class ContactListFragment extends ListFragment implements OnQueryTextList
Activity mContext;
String mCurFilter;
private SFLPhoneHome sflphoneHome;
private SFLphoneApplication sflphoneApplication;
private ISipService service;
private AccountSelectionButton mAccountSelectionButton;
private AccountList mAccountList;
......@@ -103,8 +104,9 @@ public class ContactListFragment extends ListFragment implements OnQueryTextList
public void onAttach(Activity activity) {
super.onAttach(activity);
sflphoneHome = (SFLPhoneHome) activity;
service = ((SFLphoneApplication) sflphoneHome.getApplication()).getSipService();
mAccountList = ((SFLphoneApplication)sflphoneHome.getApplication()).getAccountList();
sflphoneApplication = (SFLphoneApplication) sflphoneHome.getApplication();
service = sflphoneApplication.getSipService();
mAccountList = sflphoneApplication.getAccountList();
Log.i(TAG, "onAttach() service=" + service + ", mAccountList=" + mAccountList);
}
......@@ -228,6 +230,8 @@ public class ContactListFragment extends ListFragment implements OnQueryTextList
// TODO getCallInstnace should be implemented in SipCallList
// final SipCall call = SipCall.getCallInstance(info);
final SipCall call = new SipCall(info);
// FIXME
service = sflphoneApplication.getSipService();
AlertDialog.Builder builder = new AlertDialog.Builder(mContext);
builder.setTitle("Action to perform with " + call.mCallInfo.mDisplayName)
.setCancelable(true)
......
......@@ -142,8 +142,8 @@ public class SFLPhonePreferenceActivity extends Activity implements ActionBar.Ta
mBound = false;
}
stopService(new Intent(this, SipService.class));
serviceIsOn = false;
// stopService(new Intent(this, SipService.class));
// serviceIsOn = false;
super.onDestroy();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment