[Q] Visusal Kitchen for Android? - Android

Just curious, but does anyone know if there's an android kitchen in the works that will be more like the EvirisVisual Kitchen for WM? I, as well as several others I'm sure, would have a little less of a learning curve if there was an android kitchen that was set up the same way as the WM kitchens. Just a thought... What does everyone else think?

PMDColeslaw said:
Just curious, but does anyone know if there's an android kitchen in the works that will be more like the EvirisVisual Kitchen for WM? I, as well as several others I'm sure, would have a little less of a learning curve if there was an android kitchen that was set up the same way as the WM kitchens. Just a thought... What does everyone else think?
Click to expand...
Click to collapse
What is there to learn though? I thought Visual Kitchen involved a learning curve.
The Bepe Platform Rebuilder (which the VK was based off of) was command-line driven and simple.

dsixda said:
What is there to learn though? I thought Visual Kitchen involved a learning curve.
The Bepe Platform Rebuilder (which the VK was based off of) was command-line driven and simple.
Click to expand...
Click to collapse
True, but what I liked about the VK was that it ran the command line stuff in the background based on options the user set on the front end UI. It was a big help to those who aren't code/script guru's by letting us set up our roms in a visual UI.
EDIT:Your Kitchen is pretty user friendly BTW. I just miss the point and click UI and not having to edit so many xml files.

PMDColeslaw said:
True, but what I liked about the VK was that it ran the command line stuff in the background based on options the user set on the front end UI. It was a big help to those who aren't code/script guru's by letting us set up our roms in a visual UI.
EDIT:Your Kitchen is pretty user friendly BTW. I just miss the point and click UI and not having to edit so many xml files.
Click to expand...
Click to collapse
I'm pretty sure a nice UI-based kitchen can be done in Windows, except the person who does it will soon realize there will be platform incompatibilities over Windows XP/7 and 32-bit and 64-bit.. but those can be fixed easily if they include all possible working binaries for all the platforms.

dsixda said:
I'm pretty sure a nice UI-based kitchen can be done in Windows, except the person who does it will soon realize there will be platform incompatibilities over Windows XP/7 and 32-bit and 64-bit.. but those can be fixed easily if they include all possible working binaries for all the platforms.
Click to expand...
Click to collapse
Not necessarily. If the UI is coded in a multi-platform language (Qt, C#-Mono, Python, even PHP) then it is possible to port to any platform. Also, if all the command line stuff from the BAT files are placed into the UI too, then only one executable (with the resources of course) and it is done.

dsixda said:
I'm pretty sure a nice UI-based kitchen can be done in Windows, except the person who does it will soon realize there will be platform incompatibilities over Windows XP/7 and 32-bit and 64-bit.. but those can be fixed easily if they include all possible working binaries for all the platforms.
Click to expand...
Click to collapse
fonix232 said:
Not necessarily. If the UI is coded in a multi-platform language (Qt, C#-Mono, Python, even PHP) then it is possible to port to any platform. Also, if all the command line stuff from the BAT files are placed into the UI too, then only one executable (with the resources of course) and it is done.
Click to expand...
Click to collapse
I would very much like that if someone could do it. I know a lot of people have Linux running on a virtual machine or whatever but I actually like Windows 7. Maybe its laziness but I'd really like to not have to learn an entirely new OS before I can continue building my own ROMs. Again just my opinion. I noticed Fresh's kitchen appears to have a nice UI but it's still not released and I have no idea if it will be completely Windows ran or not.

PMDColeslaw said:
I would very much like that if someone could do it. I know a lot of people have Linux running on a virtual machine or whatever but I actually like Windows 7. Maybe its laziness but I'd really like to not have to learn an entirely new OS before I can continue building my own ROMs. Again just my opinion. I noticed Fresh's kitchen appears to have a nice UI but it's still not released and I have no idea if it will be completely Windows ran or not.
Click to expand...
Click to collapse
You don't need a virtual machine, just use Cygwin in Windows

fonix232 said:
Not necessarily. If the UI is coded in a multi-platform language (Qt, C#-Mono, Python, even PHP) then it is possible to port to any platform. Also, if all the command line stuff from the BAT files are placed into the UI too, then only one executable (with the resources of course) and it is done.
Click to expand...
Click to collapse
The problem is, there are certain functions that cannot be handled with one language alone. So, we can have a GUI-based application, like one using Tk on top of TCL (just an example!), but we'd still need to run it from Cygwin/Linux etc. so that other commands like perl, sed, od etc. will be able to work. Or maybe there is a better solution that I am not aware of.

dsixda said:
The problem is, there are certain functions that cannot be handled with one language alone. So, we can have a GUI-based application, like one using Tk on top of TCL (just an example!), but we'd still need to run it from Cygwin/Linux etc. so that other commands like perl, sed, od etc. will be able to work. Or maybe there is a better solution that I am not aware of.
Click to expand...
Click to collapse
How about a Java front-end for the existing Kitchen? The thought has occurred to me, but my focus is already spread amongst several different projects.
Something like this code from jcase(?) might be a good start?
String txt = ((EditText) findViewById(R.id.txtCmd)).getText().toString(); // cmd line
boolean su = ((CheckBox) findViewById(R.id.asRoot)).isChecked(); // run as root
Process p;
try {
if (su) {
p = Runtime.getRuntime().exec("su");
(new DataOutputStream(p.getOutputStream())).writeBytes(txt + "; exit\n"); // you want the shell to terminate itself so you know the command has finished
} else
p = Runtime.getRuntime().exec(txt);
} catch (Exception e) {
e.printStackTrace();
return;
}
try {
StringBuilder sb = new StringBuilder();
InputStreamReader isr = new InputStreamReader(p.getInputStream());
int r;
while ((r = isr.read()) > 0)
sb.append((char) r); // you may want to use a buffer
msg = sb.toString();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}​

I haven't done Java development in 10 years But I'll definitely put this in my "TO DO" list for future work. Thanks
gnarlyc said:
How about a Java front-end for the existing Kitchen? The thought has occurred to me, but my focus is already spread amongst several different projects.
Something like this code from jcase(?) might be a good start?
String txt = ((EditText) findViewById(R.id.txtCmd)).getText().toString(); // cmd line
boolean su = ((CheckBox) findViewById(R.id.asRoot)).isChecked(); // run as root
Process p;
try {
if (su) {
p = Runtime.getRuntime().exec("su");
(new DataOutputStream(p.getOutputStream())).writeBytes(txt + "; exit\n"); // you want the shell to terminate itself so you know the command has finished
} else
p = Runtime.getRuntime().exec(txt);
} catch (Exception e) {
e.printStackTrace();
return;
}
try {
StringBuilder sb = new StringBuilder();
InputStreamReader isr = new InputStreamReader(p.getInputStream());
int r;
while ((r = isr.read()) > 0)
sb.append((char) r); // you may want to use a buffer
msg = sb.toString();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}​
Click to expand...
Click to collapse

dsixda said:
I haven't done Java development in 10 years But I'll definitely put this in my "TO DO" list for future work. Thanks
Click to expand...
Click to collapse
Dude. I don't know what I was smoking when I posted that. That was code that you would run on an Android phone! Should I edited it out so future generations don't think I'm a total goob?
Anyway, you get the idea. If I can get a few things cleaned up, I'll try to do it myself or get you started or help or at least cheer you on.

gnarlyc said:
How about a Java front-end for the existing Kitchen? The thought has occurred to me, but my focus is already spread amongst several different projects.
Something like this code from jcase(?) might be a good start?
String txt = ((EditText) findViewById(R.id.txtCmd)).getText().toString(); // cmd line
boolean su = ((CheckBox) findViewById(R.id.asRoot)).isChecked(); // run as root
Process p;
try {
if (su) {
p = Runtime.getRuntime().exec("su");
(new DataOutputStream(p.getOutputStream())).writeBytes(txt + "; exit\n"); // you want the shell to terminate itself so you know the command has finished
} else
p = Runtime.getRuntime().exec(txt);
} catch (Exception e) {
e.printStackTrace();
return;
}
try {
StringBuilder sb = new StringBuilder();
InputStreamReader isr = new InputStreamReader(p.getInputStream());
int r;
while ((r = isr.read()) > 0)
sb.append((char) r); // you may want to use a buffer
msg = sb.toString();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}​
Click to expand...
Click to collapse
Are you SERIOUS??? After the Oracle vs. Google incident, you are suggesting we use Java??
I appreciate the help but its way easier coding for 32bit Windows since any 64bit Windows will run 32bit and use .Net for kitchen GUI.
If Linux fan boys want some love, they can use WINE
Then again, my coding skills SUCK and I wish someone would create some type of Visual kitchen

DJGonzo said:
Are you SERIOUS??? After the Oracle vs. Google incident, you are suggesting we use Java??
I appreciate the help but its way easier coding for 32bit Windows since any 64bit Windows will run 32bit and use .Net for kitchen GUI.
If Linux fan boys want some love, they can use WINE
Then again, my coding skills SUCK and I wish someone would create some type of Visual kitchen
Click to expand...
Click to collapse
Most of the apps on your phone are in Java. If something happens and we are unable to use Java anymore, I don't think people will really care about a GUI front-end to an already working and great kitchen. So, yes, I AM SERIOUS!
Creating a GUI front-end instead of a whole new kitchen should be relatively easy in most languages, depending on how fancy you want to get. (A window with buttons that launch scripts, more or less... That's simplifying it somewhat, but you get the idea.)

I'm probably making myself look like an ass which I am in the sense that I have no coding skills but isn't Fresh's Kitchen a visual kitchen or am I not understanding the concept.
The only reason I'm asking is, even though I have no knowledge of taking something like this on it seems to me that if it's already been done it should be a little easier to figure out.
Again, I might just be an ass and if so I apologize.

DJGonzo said:
Are you SERIOUS??? After the Oracle vs. Google incident, you are suggesting we use Java??
I appreciate the help but its way easier coding for 32bit Windows since any 64bit Windows will run 32bit and use .Net for kitchen GUI.
If Linux fan boys want some love, they can use WINE
Then again, my coding skills SUCK and I wish someone would create some type of Visual kitchen
Click to expand...
Click to collapse
Java is still platform independent, but has some really annoying requirements, and would run slow on big files.
.Net: We could use Mono for that. Mono libraries are to included in Windows .Net (or was to be. I heard somewhere that Mono Project will ask Windows to include their libraries too so any .Net app can run on Linux, Windows, and Mac, with the same user experience), and also installing it is easy. Yes, it is harder to develop under Mono, harder than Visual Studio, but still possible.
But .Net has some serious restrictions too. Can not use JAVA apps (only with launching a command line, so no direct inclusion), thus SignAPK is out (until you want to see some ugly black window, or use a backside process). And also it would need a lot of things to do, like update itself frequently, so someone needs to maintain a mod/firmware/rom/app/kernel/recovery server, and so much more.
It is simplyer to make a nice PHP site what does the same, write a UI for it, and upload to the site itself. Thus people can always access the latest stuff, and also, save their work (as a config file) for further modding. Oh and do not forget, the server would produce the file a lot faster than a PC

fonix232 said:
Java is still platform independent, but has some really annoying requirements, and would run slow on big files.
.Net: We could use Mono for that. Mono libraries are to included in Windows .Net (or was to be. I heard somewhere that Mono Project will ask Windows to include their libraries too so any .Net app can run on Linux, Windows, and Mac, with the same user experience), and also installing it is easy. Yes, it is harder to develop under Mono, harder than Visual Studio, but still possible.
But .Net has some serious restrictions too. Can not use JAVA apps (only with launching a command line, so no direct inclusion), thus SignAPK is out (until you want to see some ugly black window, or use a backside process). And also it would need a lot of things to do, like update itself frequently, so someone needs to maintain a mod/firmware/rom/app/kernel/recovery server, and so much more.
It is simplyer to make a nice PHP site what does the same, write a UI for it, and upload to the site itself. Thus people can always access the latest stuff, and also, save their work (as a config file) for further modding. Oh and do not forget, the server would produce the file a lot faster than a PC
Click to expand...
Click to collapse
I suggested Java for several reasons:
1) as you say, it's multiplatform - That fits really nicely with the kitchen.
2) The kitchen already uses Java, so the requirements have already been met.
3) I'm not a programmer. I say that, but I've taken three college programming courses now. Two of them were Java. So, I know Java well enough.
4) I was suggesting a front-end GUI to the existing kitchen, not something entirely new.
It basically boils down to whoever gets motivated enough to volunteer their time. If they choose Java, then it's Java. If they choose Motorola 68k assembly, then that's what it is. Who knows, dsixda may make something that ties in with his kitchen, and someone else may make something similar in their language of choice. That would be great. More choices are generally a good thing up to a point.

gnarlyc said:
Most of the apps on your phone are in Java. If something happens and we are unable to use Java anymore, I don't think people will really care about a GUI front-end to an already working and great kitchen. So, yes, I AM SERIOUS!
Click to expand...
Click to collapse
Android does NOT run Java. It runs Dalvik bytecode.
Whether the language is "very similar" p) or not is a different thing.
Google just made made a compiler that can compiler Java code, but its not Java
LOL Im just teasing.
I DO like the PHP kitchen idea. They do it for the HTC Desire and that would be a great project.

aerajan said:
I'm probably making myself look like an ass which I am in the sense that I have no coding skills but isn't Fresh's Kitchen a visual kitchen or am I not understanding the concept.
The only reason I'm asking is, even though I have no knowledge of taking something like this on it seems to me that if it's already been done it should be a little easier to figure out.
Again, I might just be an ass and if so I apologize.
Click to expand...
Click to collapse
No you're right, Fresh's Kitchen is along the lines (visually) of what I am used to coming from WM and the VK. It just doesnt seem to get updated very often so far. If I read correctly it still only works with 1.5 roms which is great... If you like 1.5, which virtually no one does, lol.

How an AIR front end combined with a PHP backend?

DJGonzo said:
Android does NOT run Java. It runs Dalvik bytecode.
Whether the language is "very similar" p) or not is a different thing.
Google just made made a compiler that can compiler Java code, but its not Java
LOL Im just teasing.
I DO like the PHP kitchen idea. They do it for the HTC Desire and that would be a great project.
Click to expand...
Click to collapse
The problem I have with an online PHP kitchen is that it goes away from the idea of giving the user full control of their files and helping them learn that way too. In addition it may be inconvenient when you want to move files around.

Related

how to start programming android?

Hello guys,
I've never programmed before and I wish to learn programming android apps. I really don't know how to start, what should I learn first. I need your help on how to start, your suggestions.
Thank you very much
smartuse said:
Hello guys,
I've never programmed before and I wish to learn programming android apps. I really don't know how to start, what should I learn first. I need your help on how to start, your suggestions.
Thank you very much
Click to expand...
Click to collapse
You may want to start with learning java; See here: http://mobile.tutsplus.com/tutorials/android/java-tutorial/. You may also want to learn C/C++. Take a browse around here: http://developer.android.com/guide/basics/what-is-android.html.
smartuse said:
Hello guys,
I've never programmed before and I wish to learn programming android apps. I really don't know how to start, what should I learn first. I need your help on how to start, your suggestions.
Thank you very much
Click to expand...
Click to collapse
You'll also need the android sdk and I believe eclipse is a good bit of software.
Sent from my HTC EVO 3D X515m using XDA App
Android Application Development -o'Reilly
Don't understand!
I looked at linkes you have advised, but really don't understand some things: why used paranthesys ant other signs. I mean I understand that there is a syntax but I don't understand for example why used this type of paranthesis "()" but not this type "{}".
For example, I dont clearly understand this code
public class Cat {
private String mCatName;
Cat(String name) {
mCatName=name;
}
public String getName() {
return mCatName;
};
public void setName(String strName) {
mCatName = strName;
};
}
I can't find the explanation. I need a course from the begining. What do you recommend for me, friends?
Thank you guys!
This is the Syntax: get used to it, you can't change it anyway...
PHP:
//Make a class called Cat
public class Cat {
//set up a variable, type:String, Name:mCatName
private String mCatName;
//Constructor (method which runs by default)
Cat(String name) {
mCatName=name;
}
//Public: it can be called from everwhere (even other classes or programs)
//Method name: getName.
//It simply returns the content of the variable mCatname;
public String getName() {
return mCatName;
};
//Public: it can be called from everwhere (even other classes or programs)
//Method name: setName
//It sets the variable mCatName to the value of the input variable strName
public void setName(String strName) {
mCatName = strName;
};
}
This code is a class called Cat.
It got a String which represents the Cat's name. It is set to "name" by default.
With the methods getName and setName you can either output or change the name of the Cat.
This is very basic Java. You won't learn Java in a day, just learn bit for bit.
Thanks
But tell me please, how did you started programming? What was or from which source you started first. What were your first steps?
May be it will help me, because I don't know anything in programming.
Thank you
I started with html (not a real programing language, but helpful though)
Then we did some basics in school (Pascal, basic, .net, java) and i learned PHP and more Java in my free time.
Once you learn one programing language its rather easy to switch.
Java is a good base to start with.
There are tons of tutorials on the Internet which are great for beginners. I cant recommend you a specific, i only know German ones.
I'm going to post the book that I was taught from. I can't vouch for other books, they may be better - however the person who wrote this book was a lecturer at my university and he handed out photocopies of this book as we went through the module, while the book was still being written.
It was ammended based on feedback from a number of years of students and the parts of the language and concepts they found difficult. When I went into Uni I had no programming background beyond dabbling very lightly into HTML/PHP.
The book has exercises in it, as will any other book or online guide you find, I highly recommend attempting all of them as you progress.
http://www.amazon.co.uk/Java-Just-Time-John-Latham/dp/1848900252/ref=tmm_pap_title_0
Yes, I know it costs actual money, but for a going from complete beginner -> understand Java and its concepts well enough to begin thinking about putting it on your CV, I don't think that's such a bad thing - and he's deliberately put it at a cheap price point aimed at students, it should be 3-4x that amount to bring it in line with other university textbooks that are much less helpful.
smartuse said:
But tell me please, how did you started programming? What was or from which source you started first. What were your first steps?
May be it will help me, because I don't know anything in programming.
Thank you
Click to expand...
Click to collapse
I used a book called Object First with Java, BlueJ...
BlueJ is the IDE (where you type the code in to make programs) and its free.
Java is the language, we could talk you through the code above, but its better you learn it yourself, and then you will be able to read the code above.
Look into what Object Oriented Languages are, but tbh, that Book can be found online, its not cheap but I found it rather good!
http://www.amazon.co.uk/Objects-Fir...5628/ref=sr_1_1?ie=UTF8&qid=1325806069&sr=8-1
An amazon link to the book, hope this helps!
Thanks
Thank you, guys!
I'll try to find more information about Java online. Thank you all very much!
Also, look on you tube for "the new Boston" he makes some good programming videos
Which is difference between SDK and Oracle ?
I want to know which is difference between SDK and Oracle ?
Please help me I am new here and want to start programming.

C++ For Android?

Hey all,
I'm pretty new to android development and I was curious if anyone could tell me the benefits of learning C++ alongside Java (specifically while working with Android).
My first project that I'd like to accomplish seems a little arduous, though I do have help. I'm attempting to create an app that is used to catalog clothes, but also parses image data to detect the colors. In this way, it will be (hopefully, by some means) possible to have the app help match the clothes for the user. The inspiration for this is my extreme colorblindness.
Anyone who potentially has feedback regarding interpreting data from the camera on Android, feel free to pitch your two cents.
Read this. May help you. http://forum.xda-developers.com/showthread.php?t=2225668
Sent from my SonyX8 using Tapatalk 2
ScatteredHell said:
Read this. May help you. http://forum.xda-developers.com/showthread.php?t=2225668
Sent from my SonyX8 using Tapatalk 2
Click to expand...
Click to collapse
Thanks so much!
Sent from my HTC One using xda app-developers app
not sure you need c++ for your project
My experience with C++ (using Marmalade) is that if you need a lot of UI, than you are better off with the Java framework. Designing UI with Marmalade is a real pain. It's great for power hungry games and apps, but not for UI.
If you absolutely need to use C++, my advise it to start with the native Java and NDK, and only if you're not satisfied, look elsewhere. Even in Marmalade, which is supposed to be cross-platform, you will reach the point, too quickly in my opinion, in which the SDK doesn't give a cross platform solution to what you want (say use a downloaded third-party sdk, or request some OS function that the SDK does not offer), and you will have to implement specific OS "EDKs", so will have to know your native coding anyway.
Hi,
you should try Qt, though you need the android sdk/ndk, Jdk and Ant as well, but it works.
jrdemasi said:
Hey all,
I'm pretty new to android development and I was curious if anyone could tell me the benefits of learning C++ alongside Java (specifically while working with Android).
My first project that I'd like to accomplish seems a little arduous, though I do have help. I'm attempting to create an app that is used to catalog clothes, but also parses image data to detect the colors. In this way, it will be (hopefully, by some means) possible to have the app help match the clothes for the user. The inspiration for this is my extreme colorblindness.
Anyone who potentially has feedback regarding interpreting data from the camera on Android, feel free to pitch your two cents.
Click to expand...
Click to collapse
Get a book from fipkart to lear this. "Android Devlopment"
jrdemasi said:
Hey all,
I'm pretty new to android development and I was curious if anyone could tell me the benefits of learning C++ alongside Java (specifically while working with Android).
My first project that I'd like to accomplish seems a little arduous, though I do have help. I'm attempting to create an app that is used to catalog clothes, but also parses image data to detect the colors. In this way, it will be (hopefully, by some means) possible to have the app help match the clothes for the user. The inspiration for this is my extreme colorblindness.
Anyone who potentially has feedback regarding interpreting data from the camera on Android, feel free to pitch your two cents.
Click to expand...
Click to collapse
I would choose for this between two options: develop entirely in Java except for the portions that are computationally heavy, which can be implemented in C/C++ using JNI glue code. Or you may implement everything using a C++ based framework, like Qt, both for the creation of the UI and of the rest of your application. With Qt of course, the specific UI portion can be written using QML, which might be faster.
const_char said:
I would choose for this between two options: develop entirely in Java except for the portions that are computationally heavy, which can be implemented in C/C++ using JNI glue code.
Click to expand...
Click to collapse
I second this, with the sidenote that you should only use C/C++ if the computationally heavy code is actually time-critical.
I mean, at first glance, your project sounds like it won't be very taxing on the CPU anyway. So having a full Java version may still be fast enough, and the user wouldn't even know the difference. In that case C/C++ is not worth the trouble (JNI is very ugly, and you shouldn't use it unless you really have to).
C++
I think C++ is not for suitable for this application. Although i did not use it. But you may first take some tutorial then you can start. When face problem then discus this forum. I am sure somebody may help you.
Sorry for my English.
Thank you
you can get pixel color use this sample code.
jrdemasi said:
Hey all,
I'm pretty new to android development and I was curious if anyone could tell me the benefits of learning C++ alongside Java (specifically while working with Android).
My first project that I'd like to accomplish seems a little arduous, though I do have help. I'm attempting to create an app that is used to catalog clothes, but also parses image data to detect the colors. In this way, it will be (hopefully, by some means) possible to have the app help match the clothes for the user. The inspiration for this is my extreme colorblindness.
Anyone who potentially has feedback regarding interpreting data from the camera on Android, feel free to pitch your two cents.
Click to expand...
Click to collapse
you can get pixel color use this sample code.
String imageUrl = SOME_IMG_URL;
InputStream in = new java.net.URL(imageUrl).openStream();
Bitmap bitmap = BitmapFactory.decodeStream(in);
int pixel = bitmap.getPixel(x,y);
and.
int red = Color.red(pixel);
int blue = Color.blue(pixel);
int green = Color.green(pixel);
you can get average color value of SOME_IMG and you can catalog this.
it seems easy!

Confused about how to evolve from (very) basic Android Development

Hello.
I followed all the New Boston Android videos, did everything, understood everything.
I tried to create a basic RSS feed reader, in order to better incorporate some concepts I learned in the New Boston videos (http processing, xml processing, adapting the content to lists, custom lists, etc). When I got to pass the information from the http processed data to xml parser and the list, that's when I got too much confused and knew I didn't have enough knowledge.
Then I tried to do some "Shopping List Manager" (just like OI Shopping, a bit adapted more to my taste), in order to learn.
However, again, when I neededto pass information to other objects in other classes or something like that, I get confused and don't know what to do.
So I bought CommonsWare book, "The Busy Coder's Guide to Android", which I have the latest version (5.1) and I'm reading, but I don't like to advance when I don't fully understand something. This time I'm stuck on the Action Bar part, more precisely this one:
Code:
private void configureActionItem(Menu menu) {
EditText add=
(EditText)menu.findItem(R.id.add).getActionView()
.findViewById(R.id.title);
add.setOnEditorActionListener(this);
}
I know this will seem very basic to many of you, but I get really confused on all this calls, returning results and more calls.
I don't have a background on OOP, except when I worked with PHP frameworks like Symfony, I work usually with direct task programming (scripting, automation, etc), as I am a Linux System Administrator, so my code is mainly scripting and web interface building (Python, Shell Script, PHP, Javascript, etc).
Can anybody explain what can I do to better understand this? It's just lack of practice and in time I'll understand better? Is it OOP lack of knowledge/practice? Or is it Java lack of knowledge/practice?
Thanks a lot for all your help.
Maybe the best approach is to get some face time with a person who is more experienced and have him explain to you the concept you have trouble with while focusing on the parts you don't grasp. A real human has this flexibility to do a "targeted strike" unlike a tutorial or a book that has no idea where in particular the student may get confused.
For this particular issue, the issue can be summarized as follows. Let's say you have an object call a function:
Code:
orange.peel();
This should be relatively straightforward. The next level of complexity is the fact that obj is just a variable representing an object, and in fact we can substitute anything else that evaluates to an object (i.e.: after it runs, you end up with an object). For example these all are legal ways to call the method as long as types match:
Code:
(new Orange()).peel();
(shouldEatSmallerOrange ? smallerOrange : largerOrange).peel();
retrieveOrangeFromBox().peel();
The last line illustrates calling some other function that returns the object, which is then used to call a second function. The final step from here is to recognize that instead of a single retrieveOrangeFromBox() we can have a chain of functions, each of which returns an object that is used to call the next function in line. For example:
Code:
findCar().accessCarTrunk().unloadBoxFromTrunk().retrieveOrangeFromBox().peel();
The names are unnecessarily verbose to illustrate how functions and their results relate to each other.
OOP + Android system
You're not that clear as to exactly what you are having a problem with, but in general, it sounds like you need to get a java book and learn the basic concepts of classes and interfaces. Since you say you have a background in PHP you could probably go pretty far just by following the Java tutorials on the Sun website. I say java because that's the target language here, any book on OOP in any language would be adequate but learning java would give you the added ability to read other people's android code examples more easily.
After that, you can learn the Android framework. You develop in the Java language but you work within the android framework. What that means is that here, for example, the action bar is provided to you by the android system, and this callback is called by the system, so it is all set up for you. But to understand what is happening, you need to understand when the system calls this method and what it does. That is the framework.
So more specifically, how can you understand this code? This method is called from another method, onCreateOptionsMenu(). OnCreateOptionsMenu() is a method in the Activity class that is called automatically by the system at a specific time. You need to read about the Activity class and the Activity lifecycle on the android developers site. If you want your activity to provide an options menu, you create it in OnCreateOptionsMenu and return it, the system will handle it from there. So back to configureActionItem(Menu menu), here you are passing in the menu object, which contains MenuItem objects, which the system uses to populate the menu (either on the action bar, or when you hit the menu button, depending on the android version). Each MenuItem object has a view that is associated with it (usually created in an XML file).
One thing that may be hard to understand is that all these calls are chained, so if you don't know what they are returning you don't know where to look for help. It's easier if you separate the calls out. Here, the documentation is your friend. If you look at the Menu class on the android dev site, you see that findItem() returns a MenuItem. So then you look up MenuItem, and you see that getActionView() returns a View. Look at the View class, and you can see findViewById() returns another view (a sub-view that is contained within this view). so when you look at it all together, unchained:
Code:
private void configureActionItem(Menu menu) {
MenuItem mi = menu.findItem(R.id.add);
View parentView = mi.getActionView();
EditText add = (EditText)parentView.findViewById(R.id.title);
}
findViewById returns a View, but you know that the view known by the id R.id.title is an EditText view, and you want to use it as an EditText, so you have to cast the View to an EditText (which is a subclass of View) so that the compiler knows that it is an EditText type of view. That's what the (EditText) is doing in front of the findViewById call. To understand that you need to read about subclassing and strongly-typed programming languages. PHP is weakly-typed, so that might be new to you.
finally, you call setOnEditActionListener on the EditText. OnEditActionListener is an interface that you have implemented in this class. An interface defines a common set of methods that are guaranteed to be present in whichever class has implemented it. So when you set the OnEditActionListener to this, (this means the current instance of this class), the EditText will hold on to the "this" object and it knows that it can call a certain set of methods on it. What are those methods? look up the OnEditActionListener interface in the docs:
it only has one method,
Code:
public abstract boolean onEditorAction (TextView v, int actionId, KeyEvent event);
so somewhere in this class, you will have this method defined and this is where you put code that you want to run when the EditText triggers this action. I assume this get called when the user touches the EditText.
It's really not going to be easy to work with android if you don't have a basic knowledge of OOP, specifically classes, inheritance, and interfaces. Also, knowing how java implements these concepts will help a lot. Then you can use your book to learn the Android framework.
GreenTuxer said:
Hello.
I followed all the New Boston Android videos, did everything, understood everything.
I tried to create a basic RSS feed reader, in order to better incorporate some concepts I learned in the New Boston videos (http processing, xml processing, adapting the content to lists, custom lists, etc). When I got to pass the information from the http processed data to xml parser and the list, that's when I got too much confused and knew I didn't have enough knowledge.
Then I tried to do some "Shopping List Manager" (just like OI Shopping, a bit adapted more to my taste), in order to learn.
However, again, when I neededto pass information to other objects in other classes or something like that, I get confused and don't know what to do.
So I bought CommonsWare book, "The Busy Coder's Guide to Android", which I have the latest version (5.1) and I'm reading, but I don't like to advance when I don't fully understand something. This time I'm stuck on the Action Bar part, more precisely this one:
Code:
private void configureActionItem(Menu menu) {
EditText add=
(EditText)menu.findItem(R.id.add).getActionView()
.findViewById(R.id.title);
add.setOnEditorActionListener(this);
}
I know this will seem very basic to many of you, but I get really confused on all this calls, returning results and more calls.
I don't have a background on OOP, except when I worked with PHP frameworks like Symfony, I work usually with direct task programming (scripting, automation, etc), as I am a Linux System Administrator, so my code is mainly scripting and web interface building (Python, Shell Script, PHP, Javascript, etc).
Can anybody explain what can I do to better understand this? It's just lack of practice and in time I'll understand better? Is it OOP lack of knowledge/practice? Or is it Java lack of knowledge/practice?
Thanks a lot for all your help.
Click to expand...
Click to collapse
Thanks a lot for your help. I also think my issue is with OOP, but I needed the opinion of people with more knowledge.
I understand very well what you said about onCreateOptionsMenu(), why and when is called, Activity class, lifecycle, etc.
Those things I understand without any problem. I also understand the basics of OOP, but I don't know almost nothing about Interfaces and I don't have almost any experience with inheritance, although I understand it.
I think I'm just confused because I haven't worked very long with OOP. I just don't know if I should invest in something like reading and testing something like Thinking in Java, or just practice more and more Android Development.

Coding languages

Hi guys, can anyone explain to me why you can have different coding languages? I am going to try and explain it the best way possible. Pretty much I want to know why some people use other coding languages instead of others? Are some better for particular activities? Like I know cross compatibility like you can't use html to code a game online you need to use Flash or Javascript etc.
tl;d why use one language over another?
Every programming language has advantages and disadvantages. For example Java is portable but slower then, let's say, C++. C++ is less portable and needs to be compiled seperately for every OS but it's faster. Python is very easy and very portable but it's slower then Java. Html, Javascript and Go are for websites. PHP is designed for the use with databases. Prolog uses a completely different approach and is good for logical stuff.
You see, (almost) every language has its own field of application. Additionally, everyone has a favorite language for whatever reasons (e.g. because he thinks the code is pretty). So it's a matter of taste as well.
nikwen said:
Every programming language has advantages and disadvantages. For example Java is portable but slower then, let's say, C++. C++ is less portable and needs to be compiled seperately for every OS but it's faster. Python is very easy and very portable but it's slower then Java. Html, Javascript and Go are for websites. PHP is designed for the use with databases. Prolog uses a completely different approach and is good for logical stuff.
You see, (almost) every language has its own field of application. Additionally, everyone has a favorite language for whatever reasons (e.g. because he thinks the code is pretty). So it's a matter of taste as well.
Click to expand...
Click to collapse
Thanks for the high quality response.
As a beginner, someone who wants to start developing android applications..What coding language do you think I should start with? I understand android is basically Java?
Blakebn2012 said:
Thanks for the high quality response.
As a beginner, someone who wants to start developing android applications..What coding language do you think I should start with? I understand android is basically Java?
Click to expand...
Click to collapse
Well, it's Java with some extra stuff. That's why I would recommend starting with Java. It's portable, object oriented and you'll need it for Android later anyway.
When I learned Java, I used the Head First Java book which I can highly recommend.
Ok thank you very much you have been a great help.
Blakebn2012 said:
Ok thank you very much you have been a great help.
Click to expand...
Click to collapse
You're welcome.
There's different languages for different things, like Java vs. C++ (Java is portable/cross-platform, pure object-oriented, has automatic garbage collection, etc; C++ is platform dependent and needs to be compiled on each environment, wasn't built from the ground up as OO, you need to allocate and manage memory yourself, etc. Java isn't quite as fast/efficient as C++ but it's come a long way from it's beginnings and is pretty close now, for desktop apps IMO anyway.
Then, for web development, there's Python and PHP. Both accomplish the same thing (doing back-end logic for websites, like querying databases so the data can be displayed on the page) but have different syntax. People like either one for different reasons and it's mainly just personal preference when it comes down to those.
So to answer your question, the difference between some languages is pretty great (like assembly and C#) and they're used for different purposes. And the difference between others, like PHP and Python, is for the most part superficial and it's just personal preference between the two.
The main reason we do have programming languages is that working directly on the bare hardware is pretty difficult. Working directly with machine code is difficult in many ways: it is hard to be kept bugfree, even harder to be read and understood, and there is also the problem that it's only working on a specific machine. Programming languages cope with those problems by introducing programming paradigms, which make several things easier, but it turned out that there is no paradigm which covers all needs. C/C++ for instance makes it possible to work pretty close to the machine while producing quite readable code, which can be ported easily from one plattform to another (compared to using assembly language). In contrast Java introduces a Virtual Machine on top of the actual system such that it's even a lot easier run code across several systems (compile it on one machine, run it everywhere ... as long as a JVM is available), and it brings the object oriented paradigm with it. Furthermore there are declarative languages for database programming, functional programming languages or logical programming languages for mathematical problems around, and so on ... . Sometimes you might not be interested in writing understandable portable code, such that assembly language is your best pet, but that's most probably not true in most situations.
123123132
Really good compact responses. I also want to recommend learning some shell programming, i.e. linux terminal programming for file/process management and low-level hardware manipulation in the kernel. Shells are usually mksh, zsh, bash, busybox ash, or symbolically linked to sh. This is known as a scripting language because you can run your programs/scripts on-the-fly without any compiling. Adding some shell scripts to your java app can make it very powerful such as with apps like trickster, synapse, performance control, etc., .. basically any kernel/hardware control apps.
Also you can try Ruby language. Its great for some everyday tasks, very simple and powerful(especially string processing). Also Ruby On Rails is very simple framework for web-developing. A week and you can try to code your own github. And the IRB console is good enough. But i duuno, is there any mobile-app-dev modifications of Ruby. Anyway, its still great enough.
Blakebn2012 said:
Hi guys, can anyone explain to me why you can have different coding languages? I am going to try and explain it the best way possible. Pretty much I want to know why some people use other coding languages instead of others? Are some better for particular activities? Like I know cross compatibility like you can't use html to code a game online you need to use Flash or Javascript etc.
tl;d why use one language over another?
Click to expand...
Click to collapse
That would be perfect, if we lived in a place where only one language is enough for all works XD
However, the really life isn't perfect.
Some works need complicated language to achieve and some don't.

[GUIDE] Programming languages alternatives for Android

Note to mods: this thread might be worth pinning! Using modern languages could highly improve code quality of Android apps.
OK, if you want native code, you can stick to C or C++, as you probably know interfacing native code with Java via JNI is neither pretty nor easy. But what about languages that compile to JVM (Dalvik/ART in Android case) that allow us to use tens of thousands of available java libraries in our projects? Java is quite nice but it's missing a lot of hot concepts available in modern languages like functional programming, duck typing and pattern matching. And as soon as you start using other JVM languages you'll discover Java is also extremely... verbose! I could use 5 Scala lines of code to do the same things I did in 50 lines of Java...
Note also that almost all of below languages handle null in a way much more civilized than Java. While in Java you would do:
Code:
if(someValue != null && someValue.someProperty!=null && someValue.someProperty.interestingString != null) doSomething(someValue.someProperty.interestingText)
In modern language you would just do:
Code:
doSomething(someValue?.someProperty?.interestingString)
Nice, eh?
And do believe me, these languages mix wonderfuly with Android API. Once you start coding in them, you won't come back to Java. Note that all of them have Android Studio plugins, that make the coding experience as easy as clicking "Install Plugin"!
So, let's start with the king:
Scala
Website: link
Getting started: link
Scala for Java developers: link
Why was it invented: Technically, Scala is a blend of object-oriented and functional programming concepts in a statically typed language. The fusion of object-oriented and functional programming shows up in many different aspects of Scala; it is probably more pervasive than in any other widely used language. The two programming styles have complementary strengths when it comes to scalability. Scala’s functional programming constructs make it easy to build interesting things quickly from simple parts. Its object-oriented constructs make it easy to structure larger systems and to adapt them to new demands. The combination of both styles in Scala makes it possible to express new kinds of programming patterns and component abstractions. It also leads to a legible and concise programming style.
A real beast of a language, I'm reading a fifth book on Scala right now, I have read tens of blog posts and I have a feeling like I haven't even scratched surface of it, although I've already incorporated Scala code into my XenoAmp project. If you're familiar with functional programming, you'll feel at home with Scala.
Let me rephrase the above paragraph: you PAINLESSLY incorporate below languages into your current project, without converting a single existing line! You just create new file that has extension different than .java!
Things like function literals, tuples, pattern matching and surprisingly flexible syntax of the language allow to create... a language within language, note very nice Scala/Android UI library named Scaloid and how it maintains its own minimal animation-only sub-language called Snails!
Scaloid activity layout example
Also read a blog post here about how can you write a clean code like this (note: NO SEMICOLONS!!! ):
Code:
Scala
findView[Button](R.id.button).onClick { view : View =>
Toast.makeText(this, "You have clicked the button", Toast.LENGTH_LONG).show()
}
instead of this:
Code:
Java
Button v= (Button) findViewById(R.id.button);
v.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(this, "You have clicked the button", Toast.LENGTH_LONG).show();
}
});
Kotlin
Website: link
Getting started: link
Kotlin for Java developers: link
Why was it invented:
to create a Java-compatible language,
that compiles at least as fast as Java,
make it safer than Java, i.e. statically check for common pitfalls such as null pointer dereference,
make it more concise than Java by supporting variable type inference, higher-order functions (closures), extension functions, mixins and first-class delegation, etc;
and, keeping the useful level of expressiveness (see above), make it way simpler than the most mature competitor – Scala.
A language created by creators of IntelliJ Idea (base of AndroidStudio), with Android in mind. It's also functional, syntax based on Scala syntax, but much simplier and easier to learn. Also has a tool to convert your Java code to Kotlin! So if you want to start using all hip goodies like functional programmin, patter matching, nullable expressions and operators - this is a place to start without feeling overwhelmed (by Scala)
Read what Jake Wharton (the one behind NineOldAndroids and ActionBarSherlock) thinks about Kotlin: https://docs.google.com/document/d/...bEhCqTt29hG8P44aA9W0DM8/edit?hl=pl&forcehl=1#
Ceylon
Website: link
Getting started: couldn't find a good primer, but you could figure it yourself
Ceylon for Java developers: link
Why was it invented:
to be easy to learn and understand for Java and C# developers,
to eliminate some of Java’s verbosity, while retaining its readability,
to improve upon Java's typesafety,
to provide a declarative syntax for expressing hierarchical information like user interface definition, externalized data, and system configuration, thereby eliminating Java's dependence upon XML,
to support and encourage a more “functional” style of programming with immutable objects and higher-order functions,
to provide great support for meta-programming, thus making it easier to write frameworks, and
to provide built-in modularity.
Supposedly more powerful than Kotlin, with better syntax for lambdas (function literals).
I might write a bit more about each language as soon as I start using them, so stay tuned. And share your experience with alternatives in this thread!
Gosu
Website: http://gosu-lang.github.io
Getting started: http://gosu-lang.github.io/docs.html
Its most notable feature is its Open Type System API, which allows the language to be easily extended to provide compile-time checking for things that would typically be dynamically checked at runtime in many other languages. [Wikipedia] Doesn't seem to have functional programming capabilities.
Groovy
to be continued

Categories

Resources