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

Side effects of application level initialization of libraries?

I came across some libraries that needs to be in Application class. Lets have a look at PrefCompat. First we initialize it public class Application extends android.app.Application { @Override public void onCreate() { …
Atiq
  • 14,435
  • 6
  • 54
  • 69
0
votes
0 answers

Cast context into call back interface type from non activity class

Note! This issue is now resolved, But still wonder How? Please explain? These are my call back function which is being referenced in setter method of Custom adapter GridCartAdapter declaring in activity…
Muhammad Usman
  • 863
  • 1
  • 11
  • 18
0
votes
3 answers

Adapter error on a ListView

I want to add a new layout with some specific data to a ListView. I made a class which extendeds a BaseAdapter, but when I try to put my data and Context (this) in my new class, it shows an error package com.bignner.hotel; public class…
0
votes
1 answer

Access Android Account Manager From FirebaseInstanceIdService

I'm currently using FCM to trigger a SyncAdapter when there are new data for individual users. As soon as a new user logs in into the app, I create a new account, using AccountManager, and store their auth_token, in order to be able to use it for…
Diego Couto
  • 585
  • 1
  • 5
  • 16
0
votes
2 answers

Can't get CoordinatorLayout inside RecylerAdapter via findViewById

What am i trying to do? I have a RecyclerView which keeps rows and looks like a ListView. Rows of these list are defined at feed_listview_row.xml. I have a RecyclerAdapter for this RecyclerView and it is called Feed_Recycler_Adapter.java which you…
0
votes
2 answers

Error in Alert dialog on this

This is my code, b3.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (v == b3) { AlertDialog.Builder builder = new AlertDialog.Builder(this); …
user6742489
0
votes
2 answers

Get the context of Activity in a Serializable class

I have a class that implements 'Serializable' but i am unable to get the context of my main activity in it. Here is my code for this class: public class Game implements Serializable{ private String name; private ColorTheme theme; private int…
0
votes
2 answers

Glide - App crashes with a context error in another activity

I have a problem with Glide. This problem happens in this way: I go to my profile page, then I click back button, then I insert an object in my Firebase database (Now the app crashes). The problem is in my UserProfile activity but I don't know how…
Carlo
  • 813
  • 1
  • 15
  • 34
0
votes
1 answer

Android studio - How to pass context value from a fragment to another activity?

I have a fragment 'X' whose parent activity is 'A'. I have another activity 'B' which contains a method 'getData()'; This activity also has its own parameterized constructor in which object of Context is being passed to this constructor. Activity…
Simran
  • 593
  • 1
  • 14
  • 37
0
votes
3 answers

Sending intent to MainActivity through (From) AsyncTask

I looked for a couple of questions asked on Stack Overflow for sending a int to my MainActivity and displaying it on my TextView. But trying to initialize activity or context don't work.. The latest error I get is this: FATAL EXCEPTION: AsyncTask…
0
votes
2 answers

getDefaultSharedPreferences(getActivity()) in AsyncTask

public class MainActivityFragment extends Fragment { public static ArrayAdapter mForecastAdapter; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle…
0
votes
1 answer

Dialog being called from listview adapter throwing Unable to add window -- token null is not for an application

Hello everyone Im having an issue with making a dialog appear from an onClick listener from within a listview item. The dialogs were appearing and working fine within my application before I made certain methods in the activity that calls for the…
TWeeKeD
  • 119
  • 1
  • 2
  • 16
0
votes
1 answer

setImageResource for Image Button from a class

In Android M, I need to set an ImageButton to a specific resource in the drawable folder. Which will which will work from the MainActivity where the view was declared. I have a second Activity that needs to call a class with the method being to…
0
votes
1 answer

IIssues in context

Actually I am going from one fragment to another fragment and it shows exception context as null. Does any one has a solution for this? dashboard_newrequest_list.setAdapter(new OngingmechanicAdapter(getActivity(), …
A.asha
  • 45
  • 6
0
votes
1 answer

Problems with HelloMapView tutorial

In the HelloMapView tutorial, the map seems to load fine, I can see maps, and also I can see the mark of Mexico that the example gives. But, when I click on the Mexico mark, my application crashes, with the message Android application crash I…
Paul
  • 1
  • 1
  • 5