Questions tagged as 'android-context'

2
answers

What is a context on Android?

What is a context on Android? What is the difference between getContext() , getApplicationContext() , getBaseContext() ? Is it related to getActivity?     
asked by 01.11.2014 / 00:07
3
answers

What is the difference between methods for obtaining a context? [duplicate]

You can, in addition to this , get the context in various ways, with different methods. As shown in the code below, we have getApplicationContext() and getBaseContext() that apparently has the same purpose. public class M...
asked by 27.01.2017 / 13:35
2
answers

What is the best way to pass a context to a nested class?

I have a nested class that is used for a new Thread and has some Toast to display some user information depending on the error. I already tried to pass the context through the constructor, I already created a context variable in th...
asked by 09.11.2016 / 00:45
1
answer

How to get the context in a fragment?

What should I insert into a method that needs the context argument in this fragment? public class Tab1tests extends Fragment { private ViewPager mViewPager; private DatePickerDialog.OnDateSetListener hourSetListener; private DateP...
asked by 08.07.2017 / 13:37
2
answers

NullPointerException while deleting log

Good morning. I have a problem that I can not solve. I'm developing my first Android app and I'm going to stumble over this error, SQLite can not work with Context. I did some research and found no solution. I hope some charitable soul helps me...
asked by 12.07.2016 / 15:35
0
answers

Android: Error in getContext () when using SharedPreferences [duplicate]

I'm using SharedPreferences with Retrofit2 and notificações . Each time the Notification is executed I get the exception " 'java.lang.String android.content.Context.getPackageName()' on a null object reference ". I...
asked by 07.11.2017 / 22:17
0
answers

Error using "this" [duplicate]

I'm trying to implement a direct dialing code using Action_call in the android studio but it's giving this error and I can not solve it, could anyone help me?     
asked by 31.05.2017 / 15:09
1
answer

Static Objects in Activities with View Pagers

I have an activity with a view pager, and this controls 3 fragments, f1, f2, f3. Fragment f1 shows items added by the user, fragment f2 loads all items from an external server, showing them in a list, and finally fragment f3 shows the items that...
asked by 14.09.2016 / 15:27
1
answer

Fragment context error

I have a problem, I found a tutorial to create a ListView but it is implemented with extends Activity and I am with extend Fragment and so I have an error in the place marked with an arrow: package com.sapires.Joes; import a...
asked by 05.08.2014 / 00:22
2
answers

What is a context on Android?

What is a context on Android? What is the difference between getContext() , getApplicationContext() , getBaseContext() ? Is it related to getActivity?     
asked by 01.11.2014 / 00:07