Uploaded February 2013 | Updated November 2026, 3 hours ago
Demonstration on how to access resources (such as images) by the file name with Android programming.
Contents:
- Importing images into the project.
- Adding a button and ImageView to the project.
- Debugging an incorrectly cast object
- Setting an ImageView's image by resource ID.
- Getting an image's resource ID based on its name.
- Displaying a die image based on an integer counter.
Demonstration on how to access resources (such as images) by the file name with Android programming.
Contents:
- Importing images into the project.
- Adding a button and ImageView to the project.
- Debugging an incorrectly cast object
- Setting an ImageView's image by resource ID.
- Getting an image's resource ID based on its name.
- Displaying a die image based on an integer counter.
![CLion under Linux: Install & Run
Demo of installing CLion IDE (for C/C++ programming) under Linux (specifically Ubuntu).
To run clion.sh from a terminal
(if double-clicking on the icon fails):
[1] Press the Windows key to open up the menu in the top-left corner of Ubuntu.
[2] type terminal; run it.
[3] Enter the commands:
cd clion-2016.2.2
cd bin
./clion.sh
- Change the clion-2016.2.2 to match the folder name you extracted)
- That ./ is important in the final command.
- This should launch the installer.
For a video on installing VMWare Player and creating an Ubuntu VM, see http://youtu.be/TXGREvxPbL4
Topics:
- Downloading latest Clion installer via a browser
- Running installer via GUI
- Creating C++ Hello World project in CLion
- Import multiple existing C++ files.
- Excluding files from the build.
If double clicking on clion.sh shows you the contents, then right-click and select Open With, then Other Applications... and click View All Applications and select Run Software. CLion under Linux: Install & Run](https://i.ytimg.com/vi/_fs0P7qoQKg/mqdefault.jpg)








![Basic ListView Demo: Android Programming
Demonstration on how to create a simple list view and populate it with text elements. Full Java code below.
package ca.demo.demolistview;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
// Array of options } ArrayAdapter } ListView
// List view: {views: da_items.xml}
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
populateListView();
registerClickCallback();
}
private void populateListView() {
// Create list of items
String[] myItems = {Blue, Green, Purple, Red};
// Build Adapter
// TODO: CHANGE THE [[ to a less than, ]] to greater than.
ArrayAdapter[[String]] adapter = new ArrayAdapter[[String]](
this, // Context for the activity.
R.layout.da_item, // Layout to use (create)
myItems); // Items to be displayed
// Configure the list view.
ListView list = (ListView) findViewById(R.id.listViewMain);
list.setAdapter(adapter);
}
private void registerClickCallback() {
ListView list = (ListView) findViewById(R.id.listViewMain);
list.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
// TODO: CHANGE THE [[ to a less than, ]] to greater than.
public void onItemClick(AdapterView[[?]] paret, View viewClicked, int position, long id) {
TextView textView = (TextView) viewClicked;
String message = You clicked # + position
+ , which is string: + textView.getText().toString();
Toast.makeText(MainActivity.this, message, Toast.LENGTH_LONG).show();
}
});
}
} Basic ListView Demo: Android Programming](https://i.ytimg.com/vi/eAPFgC9URqc/mqdefault.jpg)
