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

Android-AlertDialog with this and getApplicationContext()

Why AlertDialog work with the tag "this" but not with the tag "getApplicationContext()" AlertDialog.Builder alertDialog = new AlertDialog.Builder(this); //work AlertDialog.Builder alertDialog = new AlertDialog.Builder(getApplicationContext());…
Facebamm
  • 147
  • 2
  • 12
0
votes
0 answers

ListView losing content on scroll

I have a custom list adapter and I wrote this piece of code of getView. The problem i'm facing is that on scrolling, the content gets mixed up and the images mix with each other. getView Method public View getView(final int position, View…
0
votes
2 answers

Are there different Android contexts?

I thought that Android context work as a singleton object which you access from differents ways. Activities: like "this" Methods: getContext() or getApplicationContext() and more... However, in my project, I've created a simple Spinner using a…
juanhl
  • 1,170
  • 2
  • 11
  • 16
0
votes
2 answers

Inconvertable types error when passing and using fragment context in listener class

I am trying to implement and autocomplete function for an edittext in a fragment but having trouble passing the context of the fragment to the listener/textwatcher. In the constructor, it accepts the context as a parameter but brings an…
user3682205
  • 241
  • 4
  • 16
0
votes
0 answers

Catching app events from external library

I'm working in a external library that basically needs to catch all the touch events, and detect the activities life cycles, I was struggle a couple of days till I figure out a way to go, so I started as Flurry does, what does it means? Passing the…
0
votes
1 answer

Alternative to getDeclaredField("mBase") on Android 5

On Android 4.4 and below I am using the following code to setAccessible(true) and get the context for a dialog: private Context getOriginalContextForDialog(Dialog dialog) { try { if (dialog == null || (dialog != null &&…
Mark
  • 1,057
  • 1
  • 7
  • 14
0
votes
1 answer

getApplicationContext() in a singleton class via android?

hola mates i have some code here, but i don't quite understand it's logic. it's a singleton class that will eventually hold an ArrayList of crimes. i'm going to look up tutorials on singleton so i don't have to bug all of ya, but i still don't…
Bryan
  • 87
  • 6
0
votes
2 answers

Singleton and Context

I have started learning android using Android Big Nerd Ranch guide. Listing 9.1 Setting up the singleton (CrimeLab.java) public class CrimeLab { private static CrimeLab sCrimeLab; private Context mAppContext; private CrimeLab(Context…
WOW
  • 99
  • 1
  • 10
0
votes
1 answer

Access SQLite from BaseAdapter

I have a Base Adapter Class and want to acces an SQLite Table from it with a Cursor, but I have trouble with the context. Am I getting the context the right way? public class GetAllEntrysListViewAdapter extends BaseAdapter { private JSONArray…
maidi
  • 3,219
  • 6
  • 27
  • 55
0
votes
1 answer

Where can I learn more of either pass in a Context (so you can access resources), or make the helper methods static?

I need to use Toast.makeText(getApplicationContext()). The getApplicationContext() is what I am really after. I need a specific tutorial on passing Context around. Any sugestions? I see alot of developers answering questions with techo-speak like…
0
votes
1 answer

Change context language according to the current device language

Alright i know it's okay to have many languages in a single app . But i couldnt find the proper way . So here is what i want to do as a start , i want the activity to detect the android device language and then change a simple text …
Metalloid66
  • 119
  • 10
0
votes
1 answer

unable to add window token null is not for an application when using accessibility in android

I am trying to create a transparent activity in front of another app's login page. MyAccessibilityService Class extend the AccessibilityService class. When login page is identified the tranparentActivity() function will be called to show the dialog…
0
votes
0 answers

when i minimize at any stage of my app and re open the app it start from the begining

Usually when if we minimize an app in a activity then it will be on the paused state so when we come back to the app it should start from the same activity that we leave before, So that the activity will onResume. But my app(it is basicaly a simple…
user4527757
0
votes
0 answers

Does passing a File into a thread which required a Context, risk a memory leak?

If I use a Context to generate a file pointing to the internal storage location final File saveFile = context.getFilesDir(); Will I leak the context if I submit saveFile to a thread, and the phone gets rotated? I know if I passed the Context in it…
Ben987654
  • 3,280
  • 4
  • 27
  • 50
0
votes
5 answers

Call activity method from broadcast receiver android?

In my application I am sending a port SMS to the mobile. And when the message is recieved I need to perform some task in my activity and update the UI. Manifest Declaration of receiver
WISHY
  • 11,067
  • 25
  • 105
  • 197
1 2 3
99
100