Questions tagged [android-context]

Interface to global information about an application environment

Interface to global information about an application environment. This is an abstract class whose implementation is provided by the Android system. It allows access to application-specific resources and classes, as well as up-calls for application-level operations such as launching activities, broadcasting and receiving intents, etc.

Context - Android Developer

1980 questions
0
votes
0 answers

Error with ArrayAdapter context in another Activity

The thing is ... In an Activity I fill some fields to popularem one ListView to be loaded into another Acitivity , has tried to show it in the same Activity and works, the error happens when I try to show it in another Acitivity , I believe It has…
0
votes
1 answer

how does startActivity(this, OtherActivity.class) use Context object to start an activity?

I started reading about Context And I am a bit confused. I found the following definition. The Context class is an “Interface to global information about an application environment.” here I am not understanding what android application…
Sandeep Sharma
  • 1,855
  • 3
  • 19
  • 34
0
votes
2 answers

How to reference non-static method 'findViewById' from a static context?

I have just started with android development, and I am stuck at this: static Handler h = new Handler() { @Override public void handleMessage(Message msg) { TextView buttonmain = (TextView)findViewById(R.id.buttonmainid); …
fatehfox
  • 11
  • 2
0
votes
2 answers

Save in SharedPreferences value returned from JavascriptInterface in webview

I think taht's a Context problem, but I could not figure it out. I'm retrieving a user id from webview with JavascriptInterface Interface. I'm using WebAppInterface class to retrieve the value and save it in sharedprefs. I could test the returned…
Ricardo Gonçalves
  • 4,344
  • 2
  • 20
  • 30
0
votes
2 answers

How to design away the need of Android Contexts

I have several classes in my application that uses the Context object to access SharedPreferences and serialize files. Simply put, I want to know how to "design away" the Context. The background to why I want to do this is because: The classes…
Joakim
  • 3,224
  • 3
  • 29
  • 53
0
votes
1 answer

Get Android application from application context

I have access to application context but not to application. I want to get the application (so I can get all running activities), but couldn't find a way to do so. Is there an existing API to get application from application context or I will have…
hixhix
  • 771
  • 7
  • 23
0
votes
0 answers

Can I use DateFormat.is24HourFormat() with an application context?

See http://developer.android.com/reference/android/text/format/DateFormat.html#is24HourFormat%28android.content.Context%29 I know that I can use this with an Activity context, but can I use this method with an Application context instead (so I don't…
jwir3
  • 6,019
  • 5
  • 47
  • 92
0
votes
2 answers

Start an Activiy from an AsyncTask (PostExecute) in Android

I read lots of questions about it and anyone fix my problem. I have an AsyncTask where a new activity must be started. The code is the following: public class UpdateCatalog extends AsyncTask { private Context context; private…
0
votes
2 answers

Pass Context from Activity

Ok straight to the point I'm a beginner in this android programming, I have question about How to pass context from my activity due to "cant resolve method getapplicationcontext" this is MyLocationListener.java : public class MyLocationListener…
Rikudo Pain
  • 441
  • 9
  • 22
0
votes
2 answers

Android Cocos2d-x 3.7: how to get Application Context in cocos2d-x?

I use Android code cocos2dx call encountered a problem. I will not call in the Android cocos2dx Context, I'm not sure whether there is a problem with the following code, and then the following is the way I need to call in Android , as well as errors…
Lily
  • 1
  • 1
0
votes
1 answer

How to use ACTION_SEND intent from a Dialog which itself has been called from a service?

My app creates chat heads with the help of a service using System Alert Dialog Box. Now I have some images inside that dialog and want to share them using an intent. But I get the error that: android.util.AndroidRuntimeException: Calling…
0
votes
1 answer

Activity has leaked ServiceConnection com.google.android.youtube.player.internal.r$e@43cb2348 that was originally bound

I've seen this and several other similar questions, and I know the problem and what people are saying is the solution: to use the youtube API, you should use your application context rather than the activity context because of, seemingly, a bug in…
Jameson
  • 4,198
  • 4
  • 17
  • 31
0
votes
1 answer

ERROR: Attempt to invoke virtual method 'java.lang.Object android.content.Context.getSystemService(java.lang.String)' on a null object reference

I am trying to implement MovementDetector in my soft keyboard, but I get this error. When I compile my code everything works, but when I start using my keyboard it shows error in logcat. Here is my code: public class MovementDetector implements…
jelic98
  • 723
  • 1
  • 12
  • 28
0
votes
1 answer

Nullpointer exception on mediaplayer on a different class

I ahve a problem with this app. I think it's a matter of context , but I can not identify the problem and then solve it either ... I already posted a question with unc ode similar , but a person in the comments ( the only one who commented told me…
Animal
  • 1
0
votes
1 answer

is it bad to hold Activity in Singleton class?

I'm very new to android and I need your help. I'm curious if what I do is the right thing or not. My application has just only one Activity(MainActivity It's AppCompatActivity btw). But I use several Fragment instead. Some of Fragments contain an…
1 2 3
99
100