While observing an existing android application, I encountered this line of code:
((StoredVariables)this.getApplication()).getId
Why we are using this? What is the outcome of the code? Does it returns previously stored values from sharedPreference? No documentation found on internet to get an idea about it. Please explain.
You are probably a little newbie in Java also
I'm not sure about what is "this" in this.getApplication() and what the StoredVariable is, since it is not an android class...
But here are recommendations for you:
Look for StoredVariable in your class in imports section. You can find something like import my.project.StoredVariable;
Open the class (I'm 80% sure it will be interface) to see the class (this is already answer to your question)
See getId() method there
To know more about usage of StoredVariables. If this line of code is placed inside class that extends some Activity (e.g. AppCompatActivity, Activity e.t.c.)
Open AndroidManifest.xml and look into <application> tag to find android:name in there. Open class with that name (ctrl + click or cmd + click on class name)
This class is extending Application class (or subclass) and implementing StoredVariables interface, or it is directly StoredVariable class
Related
Class referenced in the manifest, se.linerotech.myapplication.RepositoryActivity, was not found in the project or the libraries
this is my first app ever (github browser),am copying the steps from a video and when i tried to debugg my app to see if i was getting the data for user it crashed
i tried to redo the steps and go over everything i did but it didnt work
Just to be clear, you have two different errors in those screenshots.
The one in the manifest is saying it can't find the Activity class with that name, for the reason outlined in CommonsWare's answer - it's looking for se.linerotech.myapplication.RepositoryActivity, and that's not where your class is. It's in red because it's an unrecognised name/not found.
The other error is in the output window - it's saying you have an Activity class at se.linerotech.myapplication.acitvity.RepositoryActivity which hasn't been added to the manifest. This is true (you tried adding it, but didn't do it right) and every Activity needs to be included in the manifest, which is why it's complaining.
The two errors stem from the same issue, I just wanted to make it clear what each one means, since if you just looked at the error log you might think you've used the correct fully-qualified name for the class (it's right there in the output!). But it's two different sides complaining about the same thing for different reasons.
Class referenced in the manifest, se.linerotech.myapplication.RepositoryActivity, was not found in the project or the libraries
That is because you do not have a class with that fully-qualified class name.
Your class is se.linerotech.myapplication.activity.RepositoryActivity, because it resides in the se.linerotech.myapplication.activity package. Use se.linerotech.myapplication.activity.RepositoryActivity instead of .RepositoryActivity in your manifest.
I've tried just about everything and can't figure this out. I have a base class that extends activity with a bunch of shared code in it and 2 classes that extend it. I was building with the proguard rules I have just fine, but this was without the hierarchy described above. After refactoring the common code into the base class, I'm getting errors like this:
can't find referenced method 'android.widget.EditText' access$000(com.mypackage.ExtendedClass1)
can't find enclosing method 'void addListeners()' in program class com.mypackage.ExtendedClass1
This base class contains an inner class, and there are references to other libraries, but the problems I'm seeing are nothing to do with those methods. Are there things I need to watch out for with class hierarchies? Again, I didn't have these problems until I refactored the common code. Also, I should note that the base class is abstract!
Please note, I've kept only 4 classes - 1 of which is an inner class in the base class. My build goes from usually taking around 30 seconds to something that may never end.. I will let it run overnight just to see if it ever returns.
Thanks!
Mike
hi guys sorry about my english,
I have problem in my application Android , I have code panner in apps it's working! but I don't have code interstitial in application, I tried to enter this code
https://developers.google.com/mobile-ads-sdk/docs/admob/advanced
*add under public class MainActivity extends AbstractContentActivity{
find this problem in eclipse :
Multiple markers at this line
- Cannot override the final method from AbstractActivity
- overrides
com.ex.activity.AbstractActivity.onCreate
If you have control over AbstractActivity, remove the final keyword from onCreate and then you'll be able to extend it properly. Also note that in their example they're using just a plain Activity.
If you can't modify AbstractActivity, look at it's code it must have an extension point (overridable method) which will be called from onCreate.
I've read through similar errors however I'm confused as to how to avoid this error when working with the ADT plugin for eclipse.
I'm attempting to follow this tutorial on how to create a Grid view of images:
http://developer.android.com/guide/topics/ui/layout/gridview.html
Step five simply states open Open HelloGridView.java, however I'm not sure if I should just create a new class, or activity.
"Step five:
Create a new class called ImageAdapter that extends BaseAdapter:
I've tried both creating a new class and creating a new activity. When i created an activity I made com.example.HelloGridView the hierarchy. But I don't think this is right and I don't think these should be activities. and I receive this error:
The declared package "" does not match the expected package "com.example.hellogridview"
in the HelloGridView.java and ImageAdapter.java
What I really want to know is how should I create a new class like in step four and step 5?
(also I'm very new to android I've gone through the android training "get started" but still feel slightly clueless, Where should I go from here?)
Any help would be greatly appreciated!!
Your new class HelloGridView need to must be under your application package com.example.hellogridview.
I get this error when my code path does not match the package name.
For example, if your package name is com.whatever.myapplication, then the class should be under /yourworkspacedirectory/com/whatever/myapplication folder.
I am trying to find memory leaks in my Android application.
I have the following situation:
class A created a class A$24 which created a thread. This thread has a reference to class A, so this is the leak.
I understand that A$24 is an anonymous class created in class A, but how can i find out where is was created, in which line in the code.
My problem is to understand who is the problematic thread.
In the project explorer of the resource perspective use the view menu, select "Customize view..." and uncheck "Inner class files" and "Java output folders". Now you should see the generated class files in the project explorer in a "bin" folder.
If you navigate to your A$24.class file, you can open it using a double click. Look for lines at the top talking about field selectors, like this
// Field descriptor #10 Z
private final synthetic boolean val$fStartMinimized
In this example, a final field fStartMinimized is used by the anonymous class (and therefore copied into the anonymous class). Using that field name you should be able to locate the anynomous class in question.
If there is no such field declaration (and also no method name giving you a clue), then you may get more insight with the ByteCode outline plugin (but I've never used that myself).