Related
This is a thread made for learning c programming and making ourselves useful in this developing site and take part or help the developers for the making or the discovery of wonderful or let's say useful modifications
ANY HELP FROM ANY MEMBER IS APPRECIATED
whoever wants to learn and help others in developing is welcome . we want as many members as possible so friends please come learn and contribute ..... currently this thread is being hosted by:-
Senior Member badadroid lover;and
Member billpao
Please share your knowledge with all of us and try and learn more.... its an open thread.
introduction
Turbo C++ Integrated Development Environment
IDE is nothing but Integrated Development Environment in which one can develop, run, test and debug the application. The Turbo C++ IDE appears as shown in figure.
The C Developing Environment is a screen display with windows and pull-down menus. The program listing, error messages and other information are displayed in separate windows. The menus may be used to invoke all the operations necessary to develop the program, including editing, compiling, linking, and debugging and program execution. If the menu bar is inactive, it may be invoked by pressing the [F10] function key. To select different menu, move the highlight left or right with cursor (arrow) keys. You can also revoke the selection by pressing the key combination for the specific menu.
Invoking the Turbo C IDE
The default directory of Turbo C compiler is c:\tc\bin. So to invoke the IDE from the windows you need to double click the TC icon in the directory c:\tc\bin.
The alternate approach is that we can make a shortcut of tc.exe on the desktop.
Opening New Window in Turbo C
To type a program, you need to open an Edit Window. For this, open file menu and click “new”. A window will appear on the screen where the program may be typed.
Writing a Program in Turbo C
When the Edit window is active, the program may be typed. Use the certain key combinations to perform specific edit functions.
Saving a Program in Turbo C
To save the program, select save command from the file menu. This function can also be performed by pressing the [F2] button. A dialog box will appear asking for the path and name of the file.Provide an appropriate and unique file name. You can save the program after compiling too but saving it before compilation is more appropriate.
Making an Executable File in Turbo C
The source file is required to be turned into an executable file. This is called “Making” of the .exe file. The steps required to create an executable file are:
1. Create a source file, with a .c extension.
2. Compile the source code into a file with the .obj extension.
3. Link your .obj file with any needed libraries to produce an executable program
All the above steps can be done by using Run option from the menu bar or using key combination Ctrl+F9 (By this linking & compiling is done in one step).
Compiling and linking in the Turbo C IDE
In the Turbo C IDE, compiling and linking can be performed together in one step. There are two ways to do this: you can select Make EXE from the compile menu, or you can press the [F9] key
Correcting Errors in Turbo C
If the compiler recognizes some error, it will let you know through the Compiler window. You’ll see that the number of errors is not listed as 0, and the word “Error” appears instead of the word “Success” at the bottom of the window. The errors are to be removed by returning to the edit window. Usually these errors are a result of a typing mistake. The compiler will not only tell you what you did wrong, they’ll point you to the exact place in your code where you made the mistake.
Executing a Programs in Turbo C
If the program is compiled and linked without errors, the program is executed by selecting Run from the Run Menu or by pressing the [Ctrl+F9] key combination.
Exiting Turbo C IDE
An Edit window may be closed in a number of different ways. You can click on the small square in the upper left corner, you can select close from the window menu, or you can press the Alt+F3 combination. To exit from the IDE, select Exit from the File Menu or press Alt+X Combination.
here is the download link
I want to suggest some C programming books:
For completely starters:
C Programming A Modern Approach
Learn C The Hard Way
Deep C Secrets
For guys that have a few experience:
The C Programmin Language ( from the C editors )
C: A Reference Manual
The C Puzzle Book
---------- Post added at 10:51 PM ---------- Previous post was at 10:17 PM ----------
We have started a new C Team for starters. Anyone that want to learn C or know a few things for C can join here. We prefere users that want to contribute at badadroid project. If many members come I will make a private chat room fot the team that we will share our ideas,questions,problems etc. and we will talk of course.
The members at team now are:
billpao, badadroid lover , karimdag
If someone interests post it here or send me message!
Maybe 1 project to start...
Screenlock problem on Wave II...
Maybe minimum requirement, to know which files are involved from source code...
I have NOTHING to contribute, because no Programming skills...
Best Regards
I want to learn C too !
Sent from my GT-S8500 using xda app-developers app
adfree said:
Maybe 1 project to start...
Screenlock problem on Wave II...
Maybe minimum requirement, to know which files are involved from source code...
I have NOTHING to contribute, because no Programming skills...
Best Regards
Click to expand...
Click to collapse
Screen lockfix is really challenging for us!
karimdag said:
I want to learn C too !
Sent from my GT-S8500 using xda app-developers app
Click to expand...
Click to collapse
If you are going to start C I will put you on the team
---------- Post added 6th April 2013 at 12:05 AM ---------- Previous post was 5th April 2013 at 11:44 PM ----------
New member added karimdag !
badadroid lover said:
This is a thread made for learning c programming and making ourselves useful in this developing site and take part or help the developers for the making or the discovery of wonderful or let's say useful modifications
ANY HELP FROM ANY MEMBER IS APPRECIATED
whoever wants to learn and help others in developing is welcome . we want as many members as possible so friends please come learn and contribute ..... currently this thread is being hosted by:-
Senior Member ash009;
Member badadroid lover;and
Member billpao
Please share your knowledge with all of us and try and learn more.... its an open thread.
Click to expand...
Click to collapse
Seriously guys, I have been following especially the modem driver development for some time, and I can tell you it is not my missing experience in the c language that cause the lack of understanding of what is going on under the hood. It is hard for me to write this, but I would not recommend starting with c as a programming language at all (the void pointers still make me go crazy :]). The code has grown with the development and is in the current state, how should I put it, not very developer friendly.
You can hate me for that, but in my opinion there is no way on earth a beginner can contribute to the implementation without making it even less readable or transform it into a complete patchwork rug.
Don't get me wrong, I love your encouragement, but lets be realistic: without some kind of documentation only the contributers know what, how and why they do what they are doing.
Hats off to Volk, Rebellos and everyone involved!
DieterM75 said:
Seriously guys, I have been following especially the modem driver development for some time, and I can tell you it is not my missing experience in the c language that cause the lack of understanding of what is going on under the hood. It is hard for me to write this, but I would not recommend starting with c as a programming language at all (the void pointers still make me go crazy :]). The code has grown with the development and is in the current state, how should I put it, not very developer friendly.
You can hate me for that, but in my opinion there is no way on earth a beginner can contribute to the implementation without making it even less readable or transform it into a complete patchwork rug.
Don't get me wrong, I love your encouragement, but lets be realistic: without some kind of documentation only the contributers know what, how and why they do what they are doing.
Hats off to Volk, Rebellos and everyone involved!
Click to expand...
Click to collapse
Also mind haw grown ! Now we are able to do what ever we want to but of course we need to want to do what we do. And even if the first steps will be very hard i think all of us will do his best therefore learning C won't be used only in this project we will be able to use it in many others and even creating our own !
"If we want so we can"
Edit 2 : ''my..experience in the C Language" so this mean that you already learned it. So could you please help us by giving us some other refrences : Books, websites, videos..
Sent from my GT-S8500 using xda app-developers app
DieterM75 said:
Seriously guys, I have been following especially the modem driver development for some time, and I can tell you it is not my missing experience in the c language that cause the lack of understanding of what is going on under the hood. It is hard for me to write this, but I would not recommend starting with c as a programming language at all (the void pointers still make me go crazy :]). The code has grown with the development and is in the current state, how should I put it, not very developer friendly.
You can hate me for that, but in my opinion there is no way on earth a beginner can contribute to the implementation without making it even less readable or transform it into a complete patchwork rug.
Don't get me wrong, I love your encouragement, but lets be realistic: without some kind of documentation only the contributers know what, how and why they do what they are doing.
Hats off to Volk, Rebellos and everyone involved!
Click to expand...
Click to collapse
hey man everything doesn't happen in a shot every thing needs to get started and this is a starting as we might end up helping the devs..... btw our learning speed of course is pacing up... as we are working as a team...... and it would even be better if people (inc. you) would share whatever you know .... and also help devs to whichever extent....... we will do our best.... maybe you also will....i don't know.... i just know that is good to ...... and we are running on the right track......
adfree said:
Maybe 1 project to start...
Screenlock problem on Wave II...
Maybe minimum requirement, to know which files are involved from source code...
I have NOTHING to contribute, because no Programming skills...
Best Regards
Click to expand...
Click to collapse
there
DieterM75 said:
This should be the driver itself:
https://raw.github.com/Rebell/andro...ellybean/drivers/video/samsung/s3cfb_lg4573.c
I could also find some setup methods related to the display driver in the following module:
https://raw.github.com/Rebell/andro...e/jellybean/arch/arm/mach-s5pv210/mach-wave.c
Simply search for "S8530" and you will find pretty interesting parts
Just found another one:
https://raw.github.com/Rebell/andro...ean/arch/arm/mach-s5pv210/wave-panel-lg4573.c
Still no clue why gpios are set the way they are...
Click to expand...
Click to collapse
everyone check these :-
C Programming Tutorial for Beginners 1
C Programming Tutorial for Beginners 2 (Part 1): Using Variables With C
C Programming Tutorial for Beginners 2 (Part 2): Using Variables With C
C Programming Tutorial for Beginners 3 (Part 1): Programming in C with Strings and Char Data Type
C Programming Tutorial for Beginners 3 (Part 2): Programming in C with Strings and Char Data Type
C Programming Tutorial for Beginners 4 (Part 1): Programming in C with Conditionals: IF/ELSE/ELSE IF
C Programming Tutorial for Beginners 4 (Part 2): Programming with Conditionals: IF/ELSE/ELSE IF
next step
A Simple C Program
Every C program must have one special function main (). This is the point where execution begins when the program is running. We will see later that this does not have to be the first statement in the program, but it must exist as the entry point. The group of statements defining the main () enclosed in a pair of braces ({}) are executed sequentially. Each expression statement must end with a semicolon. The closing brace of the main function signals the end of the program. The main function can be located anywhere in the program but the general practice is to place it as the first function.
Here is an elementary C program.
main ()
{
}
There is no way to simplify this program, or to leave anything out. Unluckily, the program does not do anything. Following the "main" program name is a couple of parentheses, which are an indication to the compiler that this is a function. The 2 curly brackets { }, properly called braces, are used to specify the limits of the program itself. The actual program statements go between the 2 braces and in this case, there are no statements because the program does absolutely nothing. You will be able to compile and run this program, but since it has no executable statements, it does nothing. Keep in mind however, that it is a legal C program.
main ( ) function should return zero or one. Turbo C accepts both int and void main ( ) and Turbo C coders use both int and void main ( ) in their programs. But in my belief, void main ( ) is not a standard usage. The reason is, whenever a program gets executed it returns an integer to the OS. If it returns 'zero', the program is executed successfully. Otherwise it means the program has been ended with error. So main ( ) shouldn't be declared as void.d as void.
main( ) should be declared as
int main( )
{
……………..
……………..
return 0 ;
}
.For a much more interesting program, load the program
int main ()
{
printf (“Welcome to C language”);
return 0;
}
and display it on your monitor. It is same as the previous program except that it has one executable statement between the braces.
The executable statement is another function. Again, we won't care about what a function is, but only how to use this one. In order to output text to the monitor, it's placed within the function parentheses and bounded by quotes. The end result is that whatever is included between the quotes will be showed on the monitor when the program is run.
Notice the semi-colon; at the end of the line. C uses a semi-colon as a statement terminator, so semi-colon is required as a signal to the compiler that this line is complete. This program is also executable, so you'll be able to compile and run it to see if it does what you think it should. With some compilers, you may get an error message while compiling, indicating that the function printf () should have a prototype.
#include<stdio.h>
#include<conio.h>
int main ()
{
printf (“Welcome to C language”);
return 0;
}
Here you'll be able to see #include at the beginning of the program. It is a pre-processor directive. It's not a part of our program; it's an instruction to the compiler to make it do something. It says the C compiler to include the contents of a file, in this case the system file stdio.h. This is the name of the standard library definition file for all Standard Input Output. Your program will almost certainly want to send stuff to the screen and read things from the keyboard. stdio.h is the name of the file in which the functions that we want to use are defined. A function is simply a group of related statements that we can use later. Here the function we used is printf . To use printf correctly C needs to know what it looks like, i.e. what things it can work on and what value it returns. The actual code which performs the printf will be tied in later by the linker. Note that without the definition of what printf looks like the compiler makes a guess when it sees the use of it. This can lead to the call failing when the program runs, a common cause of programs crashing.
The <> characters around the name tell C to look in the system area for the file stdio.h. If I had given the name "abc.h" instead it would tell the compiler to look in the current directory. This means that I can arrange libraries of my own routines and use them in my programs.
Imagine you run above program and then change it and run it again you may find that the previous output is still stucked there itself, at this time clrscr(); would clear the previous screen.
One more thing to remember while using clrscr() is that it should be called only after the variable declaration, like
int p,q,r;
clrscr()
Here is an example of minimal C program that displays the string Welcome to C language (this famous example included in all languages moreover been done originally in C in 1978 from the creators of the language, Brian Kernighan and Dennis Ritchie) Example
#include<stdio.h>
#include<conio.h>
int main ()
{
clrscr();
printf (“Welcome to C language”);
return 0;
}
When you execute above program you won’t see ‘Welcome to C language’ on the console because the screen will just flash and go away .If you want to see the line you can use getch() function just below the printf() statement. Actually it waits until a key is pressed.
Identifiers
Identifiers are the names that are given to various program elements such as variables, symbolic constants and functions.Variable or function identifier that is called a symbolic constant name.
Identifier can be freely named, the following restrictions.
Alphanumeric characters ( a ~ z , A~Z , 0~9 ) and half underscore ( _ ) can only be used.
The first character of the first contain letters ( a ~ z , A~Z ) or half underscore ( _ ) can only be used.
Case is distinguishable. That is, word and WORD is recognized as a separate identifier.
Reserved words are not allowed. However, part of an identifier reserved words can be included.
Here are the rules you need to know:
1. Identifier name must be a sequence of letter and digits, and must begin with a letter.
2. The underscore character (‘_’) is considered as letter.
3. Names shouldn't be a keyword (such as int , float, if ,break, for etc)
4. Both upper-case letter and lower-case letter characters are allowed. However, they're not interchangeable.
5. No identifier may be keyword.
6. No special characters, such as semicolon,period,blank space, slash or comma are permitted
Examples of legal and illegal identifiers follow, first some legal identifiers:
float _number;
float a;
int this_is_a_very_detailed_name_for_an_identifier;
The following are illegal (it's your job to recognize why):
float :e;
float for;
float 9PI;
float .3.14;
float 7g;
Keywords
Keywords are standard identifiers that have standard predefined meaning in C. Keywords are all lowercase, since uppercase and lowercase characters are not equivalent it's possible to utilize an uppercase keyword as an identifier but it's not a good programming practice.
Points to remember
1. Keywords can be used only for their intended purpose.
2. Keywords can't be used as programmer defined identifier.
3. The keywords can't be used as names for variables.
The standard keywords are given below:
Data Types
C offers a standard, minimal set of basic data types. Sometimes these are called "primitive" types. A lot of complex data structures can be developed from these basic data types. The C language defines 4 fundamental data types:
character
integer
floating-point and
double floating-point
This data types are declared using the keywords char,int,float and double respectively. Typical memory requirements of the basic data types are given below
@Thread:
Good idea.
I recommend this tutorial - http://www.cprogramming.com/tutorial/c-tutorial.html
And of course http://www.google.com
To develop Android/Linux kernel you need... well - Linux host machine. For the begginers Ubuntu is good choice. Shell commands are google'able.
You also need knowledge about GIT. So http://try.github.com waits.
@adfree:
I concur that fixing Wave2 LCD wakeup would be good first "task".
@DieterM75:
I started C++ coding with practically falling into thing called "Open Tibia Server".
I started ARM assembler with creating FOTA bootloader.
Everything is for people, thing is I was spending up to 8-10hours daily when learning new things. To understand certain things there's just need to remember that it was all created by humans. Smart humans. And it has its technical limitations.
You are right about the files used
arch/arm/s5pv210/mach-wave.c <- Wave platform startup and operational code, putting it all together and loading drivers for most of the stuff onboard, there's general definition of platform data for LG4573, some GPIO config functions, etc etc.
arch/arm/s5pv210/wave-panel-lg4573.c <- more platform-dependent code, that's specifically LCD type identification routine and command sequences for certain LCD types (I can pull sequences for type 1 and 2 from bootloaders or APPS, though we haven't identified any devices actually using these typest)
drivers/video/samsung/s3cfb-lg4573.c <- platform-independent driver code for LG4573 IC
drivers/video/samsung/s3cfb.c <- platform-independent (at least in theory, there's ugly hack for S8500's AMOLED for eg. so this doesn't exactly follow the standards) code for CPU's framebuffer device.
There'll be also something in include/linux/lg4573.h or around I believe, like platform data definition etc.
What's to careful about - S3CFB is kinda "master" driver. During sleep it's first to put to sleep and it does invoke its "client" driver sleep function, that's LCD. It does also invoke some GPIO config stuff. So yeah - that's messy and not really transparent.
@badadroid lover:
Dude, don't attach images in BMP. This is just... Wrong, It's common sense to use JPG or PNG through internet.
Rebellos said:
@badadroid lover:
Dude, don't attach images in BMP. This is just... Wrong, It's common sense to use JPG or PNG through internet.
Click to expand...
Click to collapse
all right actually ummm... im sorry ..... ill use jpg now.....
Double
Double-precision floating point numbers are also numbers with a decimal point. We know that the float type can take large floating point numbers with a small degree of precision but the double-precision double type can hold even larger numbers with a higher degree of precision.
The sizes of the double types are as follows.
Type Bytes Minimal range
doubleprecision 8 IE-38 to IE+38 with 10 digit of precision
long double 8 IE-38 to IE+38 with 10 digit of precision
char
char is a special integer type designed for storing single characters. The integer value of a char corresponds to an ASCII character. E.g., a value of 65 corresponds to the letter A, 66 corresponds to B, 67 to C, and so on.
As in the table below, unsigned char permits values from 0 to 255, and signed char permits values from -127 (or -128) to 127. The char type is signed by default on some computers, but unsigned on others the sizes of the char types are as follows.
Type Bytes Minimal range
char 1 -127 to 127
unsigned char 1 0 to 255
signed char 1 -127 to 127
Float Floating point numbers are numbers with a decimal point. The float type can take large floating point numbers with a small degree of precision (Precision is simply the number of decimal places to which a number can be calculated with accuracy. If a number can be calculated to three decimal places, it is said to have three significant digits.)
Memory size : 4 bytes
Minimal range : IE-38 to IE+38 with six digit of precision
int
An integer is a whole number (a number without a fractional part). It can be positive or negative numbers like 1, -2, 3, etc., or zero.
The sizes of the integer variables depend on the hardware and operating system of the computer. On a typical 16-bit system, the sizes of the integer types are as follows.
TYPE
Bytes
Possible Values le Values
int
2 or 4
-32,767 to 32,767
unsigned int
2 or 4
0 to 65,535
signed int
2 or 4
-32,767 to 32,767
short int
2
-32,767 to 32,767
unsigned short int
2
0 to 65,535
signed short int
2
-32,767 to 32,767
long int
4
-2,147,483,647 to 2,147,483,647
signed long int
4
-2,147,483,647 to 2,147,483,647
unsigned long int
4
0 to 4,294,967,295
here is an awesome site i have been following:- http://www.cprogrammingexpert.com/
Even though this site is french I find it good.
http://www.siteduzero.com/
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.
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.
I'm developing an app for iOS and android that identifies songs. We have a matching engine in c++ that works well, but my question is about the rest of the app. We have a user interface design that allows the user to record, match and save, as well as share, edit, and see their recordings.
I'm not a coder - just a designer- and I'm getting conflicting advice about how to implement. One person wants to do the majority of the functions in c++ with just a thin native GUI skin, while the other says we should write in native IOS (swift) and Android and only have the engine in c++.
The argument for c++ is it will be a single code base to maintain - it would include doing the sharing, storing history, displaying sonograms, etc. The argument against is that in fact it will not be easier to maintain, and will also create a lot of problems making calls, for example, between the interface and the function modules. For example, we currently have a function for sharing (email, facebook etc) entirely in C++ which the interface calls to, and I'm not sure if that's the best way to do things.
Hope this is clear - it's a very hard thing for me to assess as ignorant as I am! Any advice would be greatly appreciated.
I'd have the engine being c++ only, and then code in the native language for the specific platform.
Here is why:
-Maintaining UI design in c++ is terrible, which can be bad for potential customers
-Not good for load times, you want your app to be as fast as possible
-While it is good for future support (one dev can handle both the engine and the UI, less devs = less spent money), leaving it all on one dev can; have terrible documentation for the code, which will make it harder for new recruits to begin.
-IDE support (no I am not joking), android studio can do the UI pretty darn good, and adding c++ will just make it either look old or ugly.
Those are just my 2 cents
What are the pros and cons of plain PHP or Classic ASP?
PHP and Classic ASP are server-side scripting languages. What is wrong with having a website written in this instead of the trendy JavaScript Frameworks like React, Angular etc.? If memory serves me correctly, there is an issue with security where you can post in a text box some script and hack into a system.
Can we please discuss some pitfalls or drawbacks to having a website written entirely in PHP or ASP? What does a JavaScript framework or Node.js bring to the table that would otherwise be lacking?
I am just now venturing into a contract where I am tasked with updating and maintaining existing code. All I know right now is that it is written in PHP and Classic ASP. I am in the process of investigating these scripting languages and I want to know what the opinion of other developers are.