Hi Alina, this is a jruby users group. JRuby http://jruby.org/ is not
java, its Ruby (a different programming language) running on the JVM
(Java
Virtual Machine). Ruby is a really great language, and in my opinion, an
easier language to start programming with than Java. With JRuby, and a
cool
project called Ruboto http://ruboto.org/ it is certainly possible to
use
JRuby to write Android apps. But, depending on where you are in your
studies with Java, it might not be the quickest path to getting an app
written.
As for what you need to learn, it kind of depends on what kind of app
youd
like to make. Obviously, the more you learn about programming, the
easier
it will be to make apps, and the more complex and interesting the apps
you
make can be.
Android has a mailing list forum for developers like this one
herehttps://groups.google.com/forum/#!forum/android-developersand
people there might be more helpful for your particular question. They
also have a couple Google+ communities,
herehttps://plus.google.com/communities/105153134372062985968and
here https://plus.google.com/+AndroidDevelopers/posts. Beyond that,
there
seems to be tons of resources out there for learning Android and getting
help.
Dont feel discouraged, programming can be hard but if you want to learn
how to do it, I am sure you can. The challenges make it so much more
rewarding than many other things you could be doing.
I assume that you are working through a book or course of some sort on
Java. Stick with that! If you work through a good solid book or course
like Deitels
Java: How to
Programhttp://www.deitel.com/Books/Java/JavaHowtoProgram9e/tabid/3622/Default.aspxand
then some Android specific resources, youll be in good shape to begin
making any app you want to. While a book like that wont teach you
everything you need to know, it will teach you enough that you can
easily
learn anything else you need when you need it. At least, thats been my
experience. If you dont have a book like that, there are tons of free
material for beginners out there on the internet, and you can learn to
program without spending a dime. One could learn most of the Java
language
directly from Oracles site, in fact: the Java
Tutorialshttp://docs.oracle.com/javase/tutorial/though those can be
kind of dry.
If you are interested in learning Ruby, there are tons of great
resources
for that too. To write Android apps, even with JRuby, youll still need
to
know some Java (so you can understand the Android documentation and the
objects you are working with, and have some idea of whats going on under
the hood when things in JRuby go wrong.) But in the end, many people
find
Ruby a much nicer language to work with. Of course, Im a Rubyist, so its
natural Id say that.
Some Ruby resources I can personally recommend:
RubyMonk https://rubymonk.com
CodeAcademy http://www.codecademy.com/tracks/ruby
Rails Tutorial http://ruby.railstutorial.org/
And many more I could link if you are really interested. That last is
more
about Web D. with Ruby on Rails http://rubyonrails.org/ and
wont teach you much , if anything, directly about programming Android
apps, but I saw it described recently as the Ruby devs version of
building your own lightsaber and its so apt. Its a great way to learn a
ton of very important skills that any modern programmer will need like
testing, version control, basic command line skills and some of the
libraries and tools youll need in any ruby project of import.
Why would you possibly want to write Android apps with Ruby instead of
Java. Well, lets just look at some example code. First is some typical
Android Java code:
public class DisplayMessageActivity extends Activity {
@SuppressLint("NewApi")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_display_message);
// Make sure we're running on Honeycomb or higher to use
ActionBar APIs
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
// Show the Up button in the action bar.
getActionBar().setDisplayHomeAsUpEnabled(true);
}
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
NavUtils.navigateUpFromSameTask(this);
return true;
}
return super.onOptionsItemSelected(item);
}
}
I took this from the Android Developers
sitehttp://developer.android.com/training/basics/firstapp/starting-activity.html
.
Now, heres some unrelated, but also typical Ruboto (JRuby library for
writing Android apps) code, taken from the Ruboto
wikihttps://github.com/ruboto/ruboto/wiki/Building-a-UI:
require “ruboto/widget”
ruboto_import_widgets :EditText, :TextView, :Button, :LinearLayout
class RubotoDemoActivity
def on_create(bundle)
super
# Create a proc to act as the buttons’s click listener
handle_click = proc do |view|
@tv.append “\n#{view.getText}”
@et.text = view.getText
end
setContentView(
linear_layout(:orientation => :vertical) do
@et = edit_text
linear_layout do
button :text => “Hello, World”, :on_click_listener =>
handle_click
button :text => “Hello, Ruboto”, :on_click_listener =>
handle_click
end
@tv = text_view :text => “Click buttons or menu items:”
end
)
endend
This is, of course, to some extent subjective, but I know which one I
find
easier to read, simpler to reason about, and just plain more pleasant to
look at. And the Ruby community is amazing and one of a kind. Of course,
there are some cons to using ruby. Its performance is slower (though in
many apps this isnt truly that big a deal), when it is, you can always
write part of the app in Java if you need.
Whichever language you go with, if your desire is to build Android apps,
then you ought to start building Android apps today. While you work
through
any of this other material. find some really basic step-by-step Android
app
tutorials and just start following along. This one, Android Programming
Tutorial http://www.tutorialspoint.com/android/ for instance, looks
like
you can just follow each step and get a basic Hello World app running .
Once you get it working following their directions, see what you can
change
, make the text say something different (I like to be a bit juvenile and
change it to dirty words sometimes if Im at home by myself and working
through a tutorial of some sort), make it a different color, make it do
something different. Anything you can figure out to change about it.
Then,
when you sit there, realizing that the change you just made on the
machine
was because of something you did, youll begin to feel the magic.
So, definitely keep learning Java (or Java plus Ruby), but as you work
through that book or class or whatever, and you do a few exercises, stop
and switch gears, and spend a little time doing Android specific stuff.
Especially at those times when you are feeling stuck and discouraged.
I dunno if you posted this here because you are actually interested in
Ruby, or if it was just an accident or misunderstanding, but I wanted to
pass along a bit of encouragement to you, and some resources to help you
on
your way. Why? Because it was only a very short time ago that I knew
nothing at all about programming, and decided I wanted to learn. And
now,
after just a year and a half or so of very hard work, I have worked on
some
awesome projects with some of the smartest programmers in opensource,
been
to my first RubyConf, and have started interviewing for professional
jobs
with starting salaries earning more than I ever made in my life. And I
love
programming. I feel empowered. When there is something I want to code,
if I
feel like spending the time and energy to code it, I feel totally
capable
of doing so. You will get there too.
I can remember that feeling of being stuck, wanting to make apps, and
just
not knowing where to start, or how long it would take. The answers
turned
out to be: Start where I am, and just keep learning. and Longer than I
would have liked, but a lot less time than I feared. And remember, youll
get out what you put in.
Hope this helps.
Cheers,
Eric