I know there's some way to do this because i've done it by accident, I just don't know the proper terminology to use in a google/SO search, so my apologies. For instance: the View class, a built in Android class, how can I bring up the file inside Android Studio with all the methods etc to see how the class works? and yes I'm aware I can just go to android.developer.com and see everything, but thats not my question.
I think you're talking about going to the class declaration. On Mac you can hold down Command and click on the class you want to go to, for Windows and Linux you can hold Control and click on the class.
https://developer.android.com/studio/intro/keyboard-shortcuts.html
Related
I have to estimate the time it takes to update a specific application made for Android 4.4 to Android 10 and I need to see all the methods that are deprecated or not working. Is there any way to see the methods without going file by file? (I'm using Android Studio with Java)
When I build the application I only get one or two types of error at a time, when I correct them I get another one and so on.
Thanks and best regards.
P.S: How long does it take you to update something like that? I'm a junior and I'm a little lost doing this.
Here, go to Analyze -> Inspect code. After inspecting check maturity there you will have depreciated methods. (Don't forget to change minSdk)
After you will do that it give you method with a warning and you can filter it by having API not support warning
Just migrating Eclipse to Android Studio, and struggling a lot without knowing much shortcuts and import the extended class methods such as "Right Click-> Source->Override/Implement Methods" then we implement methods. Here I found no Source option. How may I include those methods. plz help me to get this quickly, as now I'm typing them .
In Android Studio the menu you're looking for is Code. You then can select what types of methods you need generated.
I have a project and I am trying to fire Keyboard events. I am using the Instrumentation Class, and it is working perfectly on the emulator, but when I launch it on my device, the call doesn't work, is there any way to make it work?
Also, I searched on the web, and I found some posts about the IWindowManager and the internal APIs, I fully understand the risk of using them, but my project is a research and is not intended to be published, so I don't mind using those APIs in my porject if they can solve my problem, but the problem is that I can't find the JAR that contains these classes.
TLDR : I need a solution that helps me fire keyboard events on my Android device, any ideas are appreciated
Actually, there is an easier method, that I found
Using Activity class or WebView class. Both have the same function.
The code looks something like this:
webView.dispatchKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN,KeyEvent.KEYCODE_1));
In instrumentation, there is the api to send keycode:
getInstrumentation().sendCharacterSync(int keycode);
If you have root access to the device, you can check the code here:
https://code.google.com/p/androidscreencast/source/browse/AndroidScreencastClient/src/net/srcz/android/screencast/client/ClientHandler.java ;
to use IWindowManager. The IWindowManager is apart of android system, you can find the class in android.jar, the source code can be downloaded from android official website.
Somehow I've screwed up my Eclipse installation. Used to be if I added a new instance of an Android object (say a TextView) and I right clicked on the error, it would offer to add the import. Also if I had an Android object and typed it followed by a period, it would show me all the allowed functions. Now it doesn't do either, just shows me java info. Don't know what I did, since this used to work. I updated everything, but still no joy. Can anyone help me get this back to the way it was?
Thanks,
Dan
Check your settings in Window->Preferences->Java->Editor->Content Assist
I'm a long time windows developer looking to learn something about Android programming. I'm working my way through the Sams book Teach Yourself Android Application Programming in 24 hours. I've discovered some flaws with the book already but nothing that I couldn't figure out on my own, until now. I'm working on adding a second class to my project and in the New Java Class dialog, it says to click the Browse button next to the Superclass box and pick "android.app.Activity". However, the only thing shown is java.lang.Object.
I'm pretty certain that I've set thing up correctly, but then, maybe I haven't.
Can anyone give me guidance?
Thanks!
Bo
The browse button tries to do an auto-match based on what is currently in the Superclass text box.
Delete java.lang.Object and enter Act (for example) then click Browse and see what you get. ;-)
BTW - I'm assuming you're using Eclipse? If so, confirm and someone will retag the question as it's more of an Eclipse usage question rather than Android specific.
After creating a class you can just extend it ..
Create a class and then manually add the part in bold
public class MyActivity extends android.app.Activity{
}