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
1 answer

Receiving different context as expected

A short introduction as I can: I have a MainActivity that implements SomeInterface, a headless state Fragment called HeadlessFragment. HeadlessFragment is setting an alarm (with compliance to API 18) on the onAttach method: Fragment…
Aviv
  • 414
  • 4
  • 16
0
votes
3 answers

Pass context of calling activity to called activity in android

I want to pass context of calling activity to called activity so that I can access the spinner present in calling activity Please help.
0
votes
1 answer
0
votes
3 answers

Getting context of Android inside additional classes

Created java class DBOperations i android project to realize database operations but found that some operations need Context object. Couldn't get it with this or getapplicationcontext method. I decided to pass context object as a paramether,e.g.…
Ilqar Rasulov
  • 169
  • 1
  • 2
  • 10
0
votes
1 answer

Change button text color Android M

Ok, so i need to change two buttons´ text color after they have been clicked, and I´ve this: manButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { …
0
votes
2 answers

Context - unable to create external files directory

I have a very strange problem with my app that appears when you start app on the Nexus 4. I have following code in Application class: public class MyApp extends Application { @Override public void onCreate() { super.onCreate(); File dir =…
Pavel Strelchenko
  • 536
  • 1
  • 6
  • 19
0
votes
1 answer

Cancel repeating Alarm in Android

I've created a repeating Alarm that goes off every minute. I created a class with 2 static functions to start and cancel the alarm. I did this so I can start and cancel it from multiple places. Starting the alarm works fine, but canceling is…
Jason Lie
  • 159
  • 3
  • 12
0
votes
1 answer

Is it possible to fudge the constructor of WebView with my new Context instead of original Application Context?

I want a helper class to evaluate javascript with WebView: public class EvaluateHelper { public static String evaluate(String st){ WebView w; String result; //something code to evaluate javascript using WebView; …
ggrr
  • 7,737
  • 5
  • 31
  • 53
0
votes
1 answer

Android custom serialization access to context

I have an object with a BitmapDrawable field that I would like to serialize. I've implemented custom serialization/deserialization with the following methods: private void writeObject(ObjectOutputStream out) throws IOException { …
Nick
  • 6,900
  • 5
  • 45
  • 66
0
votes
3 answers

How to handle delay in activites android

I am stuck in a problem hope someone suggest me a solution. I am using new Handler().postDelayed(new Runnable() { @Override public void run() { }}); method to delay some task its…
ImGenie
  • 323
  • 1
  • 15
0
votes
1 answer

AlertDialog in PreferenceFragment crashes app

I'm trying to create an AlertDialog in my PreferenceFragment so the user can confirm that he/she wants to delete all user data. This is the code I've made: public class SettingsFragment extends PreferenceFragment { @Override public void…
0
votes
1 answer

Is there way to access a dialog by using context?

I'm doing an Android Instrumentation Test Case using the class ActivitiyInstrumentationTestCase2. I've displayed an dialog using the Activity context. Activity.java Dialog customDialog = new Dialog(this); Is there any way to retrieve the dialog…
Ophitect
  • 543
  • 4
  • 18
0
votes
3 answers

Android: I'm confused about how to get the right context to find my Views

I've got my MainTabbedActivity.xml which holds a Fragment.xml. Fragment.xml holds a ListView. ListView gets populated with an array of CustomView.xml. CustomView.xml holds a TextView which I wanna pass a string to. So it's…
0
votes
1 answer

DialogFragment is not using my desired theme

I have a problem with Themes and Styles in Android when using different Android versions. So the main problem is that I have a DialogFragment popping up at some point in the application and it contains an EditText. The AlertDialog is created like…
Joakim
  • 3,224
  • 3
  • 29
  • 53
0
votes
1 answer

Standard Preferences Saving and Accessing Method Between Activities, Widgets, Background Services and etc in Android

I am quite new to Android and I have a scenario while developing an app in Android which I can't figure out what method I should use to save and access my preferences between different activities, widgets, background services, broadcast receivers…
Night2
  • 1,168
  • 9
  • 18