Questions tagged [android-application-class]

Extending Android's Application class can be very useful to maintain global state, initialise a module, and so on, before any other part of your code runs.

Android Developer Docs say:

Base class for maintaining global application state. You can provide your own implementation by creating a subclass and specifying the fully-qualified name of this subclass as the "android:name" attribute in your AndroidManifest.xml's <application> tag. The Application class, or your subclass of the Application class, is instantiated before any other class when the process for your application/package is created.

91 questions
0
votes
0 answers

application class return nullpointer

its my AplicationClass ==> @Override public void onCreate() { super.onCreate(); mydRef = FirebaseDatabase.getInstance().getReference(); tipDondur(); } public static Context context() { return app.getApplicationContext(); } public…
golbasi
  • 1
  • 2
0
votes
0 answers

"Firebase API initialization failure." when extending Application class and using Firebase in Android

I am integrating Firebase Cloud Messaging Service in my Android app. Currently my app extends the Application class (named as MainApplication) and is declared in manifest application tag. I have followed all the instructions to enable Firebase Cloud…
0
votes
0 answers

Android disable back button in class that extended Application Class

I have a class that extended Application Class I wondering if there is any way I could disable back button here?
0
votes
1 answer

Can I show physical layout of Application class to Users?

I read that a class that extends application is first run when my app is opened by my user. So I'm trying to give my application class a layout, so it may looks like a splash screen. But setContentView() is not working on class that extends…
0
votes
1 answer

Converting Android application to android library gives Error: constant expression required

I have an Android application which I wish to convert to a library to use in another application. I have changed com.android.application to com.android.library in the apply plugin section in gradle file. Removed application id. Removed the Launcher…
Arka Prava Basu
  • 1,639
  • 3
  • 13
  • 23
0
votes
1 answer

service don't stop in fragment that start in application class

i'm developing a translator app and for some reasons i want to initiate some service in Application Class. i create a "MyApplication" class that extends Application: public class MyApplication extends Application{ @Override public void onCreate() { …
0
votes
1 answer

Extended Application can not run correctly

everyone. I am new to android. Recently, I tried to learn how to extend Application, but there is a strange problem. I have tried a lot of methods, but still can not solve it. So, thanks in advance if anyone can help me. The code section is like…
xing
  • 93
  • 1
  • 11
-1
votes
1 answer

Error: incompatible types: Application cannot be converted to AnalyticsApplication.: Android Studio 2.3.2

I updated my Android Studio to 2.3.2 after which the gradle build fails with the below error: error: incompatible types: Application cannot be converted to AnalyticsApplication. I have tried searching about it but could not find anything…
manini
  • 328
  • 1
  • 4
  • 13
-1
votes
1 answer

Adding multiple application class in AndroidManifest

My android app was needed to add multiDexApplication support. But Now I need to add another custom application class. How can I do that? //Here's My manifest code:
Soumya Rauth
  • 1,015
  • 4
  • 12
  • 31
-2
votes
1 answer

Accessing Database created in one activity from another activity

I have created an instance of my database helper class in the main activity. I want to access that instance from any another activity where I can update that database. I have created an instance with getApplicationContext() as context but it's…
-2
votes
1 answer

Using this.getApplicationContext(); with multiple application classes

In my app i need to store the location to firebase so im using two location classes as application because i need to store location for two different entities First Application class public class FirstApplicationClass extends MultiDexApplication…
-2
votes
2 answers

How to check app uninstall and send information to the server in a Phone?

Need some information about how to check whether an Android app is being uninstalled or is uninstalled so that App Server comes to know that a user has uninstalled the app. Any Help is appreciated.
-2
votes
2 answers

MyApplication.java did not run at the second time app started?

I have 1 application custom class MyApplication.java and 1 activity MainActivity.java. At the first time when I start app, class MyApplication.java run correctly. Then I exit app by finish the activity MainActivity.this.finish(); Then I click the…
Qk Lahpita
  • 315
  • 8
  • 16
-4
votes
1 answer

Android - Using this or getApplicationContext() in MyApplication class?

I have created a MyApplication class that extends Application and have defined it in the manifest. Within MyApplication's onCreate() method, is there any difference between using this or getApplicationContext() in order to get the application…
ban-geoengineering
  • 15,533
  • 18
  • 140
  • 225
-4
votes
1 answer

Is there any function in Android to output random stuff from a collection of things in database ? For more details read information given below

I am making an Android app for automatic generation of question paper. In which I've made a database where I've stored questions but I'm facing problem in generating ramdon questions so that questions don't get repeated in the same question paper.…