Transitioning from VS2010 to Eclipse IDE for Android/Java dev - java

I wonder if someone can help me... I've been developing VB.Net for years and C++/VB before that. I've also got some PHP experience. I'm now moving to Java to write an app for my Android mobile. I'm trying to use MOTODev Studio (Which extends eclipse)
I've not developed in Java before so it's a bit of a learning curve anyway. I'm fairly confident I'll be able to work out the important bits but I'm in a new IDE in a new language developing for a new platform.
As I'm new to Java, I was hoping to be able to rely on auto-code generation, intellisense, etc. I'm starting to think this was either very optimistic or I'm using eclipse very poorly.
For example, I know I need to override the OnClickListener() event but am unsure of the exact syntax. In VS, I'd just start typing Override in a class and up would pop intellisense with everything I can override and the appropriate signature, however, in eclipse none of the intellisense options seem to apply when I type public voidor #Override. Is this because I'm doing something wrong/is eclipse intellisense incomplete not very good?
In VS there's a bar at the top of the code page which lists objects in the file on the left and methods of the current object on the right. Does eclipse have an equivalent? If so, where?
I've managed to use the IDE to the extent that I've got a "Hello World" installed on my mob so it's more code generation techniques than windows/dialogues/etc.
I suppose what I really need is for someone to recommend some good resources to help me transition. I'd also appreciate any comments or advice from others that have done similar
Thanks in advance

So you learning three items at once
Language (Java)
Platform (Android)
Tool (Eclipse)
Here are my two cents for each of them:
Java - besides annotations guide already mentioned by Falmarri all java tutorials on oracle site are worth seeing you can find them here
Android - From my point of view very good entering points into android development are Android Developer Dev guide and API Demos project which demonstrates many android aspects ( You can add this project into your workspace in Eclipse via ->New Android Project-> Select from sample ->Choose target version -> Click OK , Voila you have new project in your workspace with a lot of useful android related code, describing many advanced and not so advanced topics). BTW Android developers blog is worth reading but
it usually covers more advanced topics
Eclipse - Falmarri already pointed and pretty good tutorial about Eclipse, I from my side would suggest to start from Help-> Help Contents -> Java Development User Guide
It covers all basic tasks and concepts. For your particular problem with overriding ( actually implementing) an interface method you've to first indicate that your class implements View.OnClickListener via class MyClass implements OnClickListener at this point eclipse will notice that you claiming to implement interface but didn't actually implemented some of it methods ( in this situation onClick(View v)) and will mark class declaration with error marker. Go to your class declaration and press Ctrl + 1 ( also known as "quick fix") and you will get some options to fix broken code. At the other hand if you really want to override parent class method you can press Ctrl + Space in a class body ( e.g not inside the method) and you will get option to override avalible methods.
Hope it helps

http://download.oracle.com/javase/tutorial/java/javaOO/annotations.html
yes, it's the default java perspective. Have you even installed the IDE yet?
http://www.vogella.de/articles/Eclipse/article.html

I'm not entirely sure I fully understand your questions, but if I'm in a Java class in Eclipse that implements some Interface and I want to implement methods I either select the quick fix (Ctrl+1) for the compiler error telling me I'm not implementing the Interface or I trigger content assist (Ctrl+Space) in the class body to get a list of methods to override. And with the bar you mention, do you mean something like the breadcrumb navigation (Alt+Shift+B)?

Related

Java project template on Mac?

I'm trying to expand upon the basic Java that I've learned by taking an example that I've found in a general Java programming book and growing it with more capability. I've been trying to use Xcode's v3.5.2 Java project template for a Java application using the Eclipse Juno IDE and I see some of the methods and classes are deprecated. After clicking around the internet for the past two or three days, I'm confused.
I have two primary questions:
What is the proper start in developing a Java application (not for the web) on a Mac? Is the template available through Xcode 3.5.2 the right way to go? I'm trying to find how the apple.laf.useScreenMenuBar (discussed in the Apple Developer User's Guide for Java) interplays with the Xcode template. Does one outdate the other? Should I start from scratch?
I have yet to come across any documentation/template for the bare-bones/stub setup of a Java application on the Mac other than what is available in Xcode! I would think that such a stub would be available given Apple's Human Interface Guidelines. If some reference is available, I would appreciate a link. I've been consulting Apple's Java Development Guide for Mac and the API documentation, Oracle and other places on the web but so far no luck and just confusion.
I get the idea that the true answer is to give up on Java on the Mac and program on the PC or just go with Objective-C! (I'd like to learn Objective C but unfortunately right now, I have better survivability in my company with Java and Python.)
Thanks for any kind suggestions.
Give unto XCode that which is objective c. Use Eclipse for everything else.

Ctrl+Arrow keys, multiword variable names and eclipse pydev

Caveat: I'm not sure if this post might be better suited for SuperUser or some other forum in the SE Family. If you know of a more appropriate place for this post, please let me know, and I will migrate it.
I know that eclipse for Java extends the Ctrl+Left, Ctrl+Right shortcuts to move the cursor within camelCased multiword variable names. This is a feature I really like about eclipse.
However, this feature seems to be absent when I use the PyDev plugin for python programming on eclipse.
Does anyone know how I can get/enable this feature in PyDev (or does it just not exist right now)
Thank you
There is an open feature request for exactly this on PyDev's sourceforge page, see here. I guess this confirms that it "does not exist right now".
The request is originally from 2010 but apparently hasn't received much attention yet. Maybe you can add your voice to the feature request to get it done sooner though.

Android Pros: How to wrap PayPal's MPL?

I have no Java experience and prefer Visual Basic; I've found a very nice translation IDE called Basic4android (www.basic4android.com). It works by interpreting a scripting language that's similar to Visual Basic and then using it to generate and compile native Java code. Rather ingenious, if you ask me. In fact I believe I found it from a reference here on StackOverflow.
I'm having some trouble wrapping PayPal's Mobile Payments Library:
www.x.com/community/ppx/xspaces/mobile/mep (scroll down for the HTML Tutorial)
I need to do it in a way that promotes the library's functionality so that B4A can in turn expose it to the Android device (emulator in this case). I've made some halting progress so far, but now I'm stuck on NullPointerExceptions occurring deep within the MPL.
The saga is pretty well described in a thread at their forum:
http://www.basic4ppc.com/forum/additional-libraries-official-updates/8819-looking-download-link.html
Here's my wrapper and the generated code—download here—as only licensed users may access downloads in that particular forum section.
The latest NullPointerException occurs a few calls down from the initWithAppID function. The JD-GUI decompiler reports an internal error when it gets to the com.paypal.android.b.b class, so it doesn't appear to be possible to know exactly what's going on down there.
I'm certain this can be done; I just need to know how to open the proper communication channel between the device and the MPL.
I'm new at Java and I'm new at Android. Quite a combination, wouldn't you say?
It turns out the problem is in the way PayPal bundles their resource files; non-Eclipse projects can't get at them.
More info on the original B4A thread.
Thanks,
Jeff
I think if you ask here about something that generates code for you, you won't be provided with any answers because you can't give any useful source code or something. Also, if you use something like this tool, you never know what it's generating. Also, you can't fix any occurring errors with the generated code... I could go on and on and on...
If you want to use Android the way it's supposed to be used, you'll need to learn Java and Android. If you are good with VB, this shouldn't be that hard. And this is what anyone is going to tell you.

Converting equations to java for android?

I am a cameraman and I want to make an app for my Moto Droid that will
calculate my depth of field given four inputs.
I am literally brand
new to javascript and this programming stuff, so I was wondering if
anyone could help me out.
I have a very basic GUI set up using Droiddraw which allows me to
input my 4 variables, which are:
Focus (#+id/focust)
Focal Length (#+id/flt)
Aperture (#+id/apt)
Circle of Confusion (#+id/coct)
Equations for this calculation are located here
for example...
to get hyperfocal distance I need to get: ((f^2)/(N*c))+f
all of these variables will be drawn from inputs in the GUI, but I don't know how to call them, how to write the actual math, and how to address the results so I can make them appear in the "results area" on the bottom of the screen.
I've never done java before and I only want to make this app because the existing ones don't fit my needs.
Can someone help?
Thanks!
If I'm not mistaken, DroidDraw is a tool for building the XML user interface description used by the Java API. If you want to program for Android in JavaScript, something like PhoneGap might be a better choice. It lets you build real Android application using HTML and JavaScript.
On the other hand, if you want to use the XML and Java APIs, then you should probably run through the Android tutorials. The first one is Hello, World.
Since you're just getting started with programming, I can't stress tutorials enough. It's true that your idea shouldn't be too hard to implement, but you need to understand the basics first.
I don't mean to give the impression that one style (PhoneGap vs. Java and XML) is better. For your purposes, either should be fine. It's more a question of what you prefer. Java/XML is the paradigm supported by Google, and provides access to more functionality. On the other hand, if you already know HTML or JavaScript (or are interested in learning them), PhoneGap will certainly provide everything you need. I think PhoneGap is also intended to make it easier for beginners, though I haven't used it, so I don't know how successful they have been.
The XML file that is generated by DroidDraw can't be used within PhoneGap. If you do choose to use PhoneGap, then you will need to build the interface in HTML. You might be able to use something like DreamWeaver or FrontPage or one of any number of HTML editors to help you with this step.
The XML file is just a description of an interface. When you start your application, the Android platform uses this description to build the user interface that you see. Once that has happened, you can move data from the interface to Java, or from Java to the interface, without any hassle. You certainly won't be limited by the XML interface description - it's pretty flexible.
If you've been going through the Android tutorials, then it might be best to forget that I even mentioned PhoneGap. It's a wildly different alternative that is the right choice for some people and some applications. But the Android tutorials won't help you to understand it. I only brought it up because you mentioned JavaScript in your original post.

Is there something like CodeRush from Java?

Is there something like CodeRush for Java?
The real answer is that Many Java IDE's give the same types of features (as relevant for Java), so you should really check them out and then ask about a specific missing feature that you had in CodeRush that you think would be relevant to a Java IDE.
While not quite like CodeRush, you can try JetBrains IDE for java (IntelliJ) to get similar functionality to what Resharper offers (not that dissimilar to CodeRush)
Nothing exist that is exactly like CodeRush for Java. The closest thing you will find is the JetBrains IDE as saret said.
The design philosophy of CodeRush/Refactor! is to never show a modal dialog like Eclipse/Resharper/Visual Studio does for refactoring. Instead CodeRush uses context sensitivity, by watching the AST, and only shows you refactorings that make sense. CodeRush/Refactor draws on top of the editor and animates things where appropriate.
Animation example:
Image source: http://www.skorkin.com/2012/07/reordering-method-parameters-with-visual-studio-and-coderush/

Categories

Resources