AIDE—Developing for Android on Android

When you get to the end of this line and start typing "</", the editor automatically will fill in the rest of the line for you. When you refresh the build, the error should go away, assuming that you haven't introduced any typos.

Figure 12. You can add new string resources to the file strings.xml.

Buttons are expected to trigger some reaction, however. This means you likely will want to add some kind of callback to a function in your button. This is handled within the layout file where the button is defined. You can add an extra property, "onClick", which gives a method name to be called when the button is clicked. For example, you might have the following in the button definition:


android:onClick="my_method"

You then can add the function "my_method" to the file MainActivity.java. This new method needs to be public and return void. Also, the only input parameter is a View object. Because you want to change the text in the TextView object, you'll need to add an ID so that you can refer to it. In the main.xml file, add the following property to the TextView entry:


android:id="@+id/view_text"

Figure 13. Add callbacks for buttons in the main.xml file.

You then can use "view_text" to access the text display. In the method "my_method", you can get a reference to this text field with the line:


TextView tview = (TextView)findViewById(R.id.view_text);

Figure 14. You need to add ID labels to interact with items in your program.

You then can reset the text to be "The button was clicked" with:


tview.setText("The button was clicked");

When you click Run, your program will be recompiled, re-installed and opened. Now you can see what happens when you click on the added button.

Figure 15. The actual callback code goes into MainActivity.java.

Figure 16. Before pressing the button.

Figure 17. After pressing the button.

Figure 18. There are lots of functions in the menu not covered here.

Figure 19. The premium version adds even more capabilities.

I've provided only a short introduction to AIDE and all of its super powers here. This article hasn't looked at more than the most basic features of an Android application. Lots of tutorials exist to get you up to speed in Android development, and now you can run through those tutorials on the go.

______________________

Joey Bernard has a background in both physics and computer science. This serves him well in his day job as a computational research consultant at the University of New Brunswick. He also teaches computational physics and parallel programming.

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Join us after the break for

sollen's picture

Join us after the break for an exploration of what makes LED Light Bar Tesla’s latest EV such an amazing ride — and where the company must improve if it truly wants to compete with the BMWs and Mercedes-Benzes of the world.

Reply to comment | Linux Journal

how to Make dubstep's picture

Thank you for the good writeup. It in truth was a
amusement account it. Glance advanced to far added agreeable from you!
By the way, how could we be in contact?

White Paper
Linux Management with Red Hat Satellite: Measuring Business Impact and ROI

Linux has become a key foundation for supporting today's rapidly growing IT environments. Linux is being used to deploy business applications and databases, trading on its reputation as a low-cost operating environment. For many IT organizations, Linux is a mainstay for deploying Web servers and has evolved from handling basic file, print, and utility workloads to running mission-critical applications and databases, physically, virtually, and in the cloud. As Linux grows in importance in terms of value to the business, managing Linux environments to high standards of service quality — availability, security, and performance — becomes an essential requirement for business success.

Learn More

Sponsored by Red Hat

White Paper
Private PaaS for the Agile Enterprise

If you already use virtualized infrastructure, you are well on your way to leveraging the power of the cloud. Virtualization offers the promise of limitless resources, but how do you manage that scalability when your DevOps team doesn’t scale? In today’s hypercompetitive markets, fast results can make a difference between leading the pack vs. obsolescence. Organizations need more benefits from cloud computing than just raw resources. They need agility, flexibility, convenience, ROI, and control.

Stackato private Platform-as-a-Service technology from ActiveState extends your private cloud infrastructure by creating a private PaaS to provide on-demand availability, flexibility, control, and ultimately, faster time-to-market for your enterprise.

Learn More

Sponsored by ActiveState