Error: ‘class sf::Text’ has no member named ‘setFillColor’

Just finished section 10 of my course. While working through the code, I ran into a snag:

alaskalinuxuser@alaskalinuxuser-OptiPlex-7010:~/Documents/c++/Cpp_training/JelloStorm$ ./build.sh
JelloStorm.cpp: In function ‘int main()’:
JelloStorm.cpp:121:13: error: ‘class sf::Text’ has no member named ‘setFillColor’
pausedText.setFillColor(Color::White);

I triple checked with the instructor videos, and the instructor’s source code, and he put “setFillColor”. However, I couldn’t make that work like that. Perhaps it is due to an older version of SFML being used in the course than what I’m using now.

Fortunately, fixing the issue was easy:

pausedText.setColor(Color::White);

The setFillColor attribute still works for rectangle shapes and what not, but not for text. For text, you just use “setColor”.

hud

I love it when a problem is simple! Check out the whole commit, and the new Heads Up Display on my GitLab!

Linux – keep it simple.

JelloStorm.cpp:198:58: error: ?createBackground? was not declared in this scope

grass

After the rough time I had completing section 6 of the course, I was not looking forward to section 7. However, it turned out that section 6 was just tough, and section 7 was pretty easy. That doesn’t mean I didn’t have any trouble though.

alaskalinuxuser@alaskalinuxuser-OptiPlex-7010:~/Documents/c++/Cpp_training/JelloStorm$ ./build.sh
JelloStorm.cpp: In function ?int main()?:
JelloStorm.cpp:198:58: error: ?createBackground? was not declared in this scope
int tileSize = createBackground(tileBackground, arena);
^

Turns out when you make a header file, you have to be sure to include it! Yes, I forgot that line, so I fixed it as such:

#include <SFML/Graphics.hpp>
#include <sstream>
#include <SFML/Audio.hpp>
#include <Player.h>
#include <JelloStorm.h>

And now that it is fixed, my archer has a nice grassy field to walk around in! You can check out the game thus far or the commit at my GitLab!

Linux – keep it simple.

Player.cpp:6:16: error: no ‘int Player::player()’ member function declared in class ‘Player’

Finally completed section 6 of my C++ course. It was rough. I ran into several issues that the instructor did not explain, because he is using Windows Microsoft Visual Studio, and I am using Geany on Linux.

I guess there are some things that just get taken for granted when you are building on Windows. Essentially, when you include header files in Visual Studio, it auto-magically (yes, it’s a word) links everything together. I could do the same in Linux, if I set up a proper Makefile.

Due to my niavete, I had to search the web a lot for this one. Figured it out, so I can let you in on the secret:

#!/bin/bash

# You need libsfml installed on your system!

g++ -I./ -fpermissive -Wall -Wextra -g -c -std=c++11 Player.cpp -o Player.o
g++ -I./ -fpermissive -Wall -Wextra -g -c -std=c++11 JelloStorm.cpp -o JelloStorm.o

g++ JelloStorm.o Player.o -o JelloStorm-app -lsfml-graphics -lsfml-window -lsfml-system -lsfml-audio

./JelloStorm-app

echo “type ./JelloStorm-app to launch”
exit

If you use header files in Linux, you need to include them with the -I option. That solved my first problem, then I needed to fix two more.

The second problem seems to be with the code, but I couldn’t quite figure it out. It was an error that ISO standards require a type to be set for Player(). I started using -fpermissive which seemed to negate that. The course was written a while ago, so I guess that there is a newer, better way to do this. In any event, now that the third problem is fixed, it went away.

After this, the game would load, but the player character (an archer) would not display. This lead to the third problem… which was the title problem:

Player.cpp:6:16: error: no ‘int Player::player()’ member function declared in class ‘Player’

This error was giving me fits. I looked things over for hours, searched the web, compared my hand typed code to the instructors code line by line. Finally, it hit me: Player::player()! This needed to be Player::Player()! I forgot to upper case one letter, and it boiled down to that!

The compiler was right, there was no “player” member in the class, because it was declared as “Player”!!!!

Screenshot from 2018-05-16 11-45-42

If you look really close, there is an archer standing there.

You can check out the commit on my GitLab, hopefully soon I’ll be adding jello to storm my character!

Linux – keep it simple.

New C++ project: JelloStorm!

For the purposes of my C++ training class, I am supposed to make a zombie horde game. However, I am not a horror fan, and I have 3 very young children. So, I decided to tone it down a bit and make it more comical and cartoon-ish. Thus enter: JelloStorm!

sample

While hunting in the woods, an archer comes across a field filled with large living jello blobs that seek to encase you in gelatin! Find more arrows to keep the wiggly pests at bay, and eat wild grapes to keep your strength up!

At least, that’s the basic idea. I worked on the artwork and made it myself. All except for the outline of the jello blobs, which I modded from some free artwork. That’s probably why they look better than the archer and grapes. You can check out what I have so far at my GitLab.

I’m not 100% sure of the game mechanics yet, but I’m looking forward to learning some new things in the class. Also, I sorted through tons of great sound effects from https://bigsoundbank.com/, which hosts lots of quality sound effects that the author has made and released free and royalty free with some limitations. You can check out his about and rights page for more information. I picked out some good ones for the game.

In any event, I hope you enjoy our journey as I learn how to make this comical little game.

Linux – keep it simple.

C++ and variable screen sizes?

clouds

I’m at the end of section 3 of my online course, and I’ve learned so much! I’ll be honest, since Java and C++ are both object oriented languages, I feel that it has been a pretty smooth transition so far.

While not part of the course, I noticed when showing some friends my game, it didn’t look right on their screen. The problem was that the game is coded for a single screen size, and if they have a smaller screen, it doesn’t display properly. Some things are off the screen, or off center.

So, I remembered an old Android trick for similar issues, and started implementing it here. Rather than setting static sizes throughout the game, I set my code up like so:

int sWidth = 1024;

int sHeight = 786;

sf::RenderWindow window(sf::VideoMode(sWidth, sHeight), “Timber!”);

By making the objects variants of sWidth and sHeight, I can later poll the screen size and set the graphics to match. At least that is the plan. Right now I am just doing it manually, but rather than adjusting every line of code, I am just changing the sWidth/sHeigth lines.

You can check out the full commit, including adding text and time bars at my GitLab.

Linux  – keep it simple.

Fool’s Mate Friday?

Fool’s Mate Friday is going to take a little detour, as I work on learning a new programming language.

If you have followed my blog at all, you will notice that I’ve made a bit of a shift away from Android. When I was working with Android, I was heavily invested in Java programming, both for games and app, as well as making custom ROM’s. I’ve come to realize though, that while Java is cross platform, it is a bit of a niche these days.

Java is used by Android, but rarely used by other computer operating systems. True, it CAN be run on just about any OS, but usually ISN’T. Most browsers have dropped Java applet support, and most OS’s don’t include Java support without installing some form of JRE (Java Runtime Environment).

As I’ve switched (at least temporarily) from Android to Ubuntu Touch (UBPorts), I’ve seen a real need for more robust apps for that platform. Unfortunately, UT doesn’t support Java natively, and that left me out in the dark.

But, God gave us brains, and I’m always trying to use mine to learn new things, or master things I already know. So, I’ve decided to take up a new programming language. Obviously, if you read the title, you already know that I picked C++.

It can be hard to just “learn” something new by reading a book, or looking at code. One of the things that helped me a lot when learning how to make Android games was to sign up for a class on Udemy by Rob Percival. He made the course fun and dynamic by making little creative games or applications to teach the student new concepts or ideas. With that in mind, I jumped back on Udemy and snagged a course (during the $10 site-wide sale) called “Beginning C++ Game Programming“. It focuses on teaching a complete noob how to program in C++ by creating 3 simple games.

One of the perks to this programming style is getting to see something get created from start to finish, and have a graphically playable product when I’m done. It uses the SFML library (which sounds like a dirty acronym, but really is an open source library – Simple and Fast Media Library) for handling the graphics, and it seems to be really intuitive and straightforward. It also seems to be very similar to using libGDX that I was using with Android, so that make working with it easy for me to learn.

Since Java and C++ are both object oriented languages, the concepts of each are the same, which is helping me in the learning process. Although I still try to type things the Java way, so that may take a while to get used to. Either way, I’m having fun with the course, and while I’ve only completed about 15% of the course, it has been interesting and fun.

sfml_timber_1

The course does use Microsoft Visual Studio, however, I’m just using Geany to type and compile my programs. Other than one or two little snags about include files being different from Windows and Linux, I haven’t had any trouble doing things my way. Hopefully you’ll enjoy hearing about the journey!

Linux – keep it simple.

Fool’s Mate Friday: LaserChess

Okay, so this may seem a bit off topic, but I was exploring old chess games for some inspiration. While this didn’t inspire me that much, it certainly was interesting to play Laser Chess, a DOS game circa 1994.

laserchess

The premise of the game is simple. There are 18 pieces per side, most of which are able to move in a similar fashion to regular chess pieces. However, unlike chess pieces, you don’t capture the enemy pieces. Instead, you maneuver your pieces into place, and then fire a beam from your laser cannon.

Each piece appears to have some unique attribute as to what happens to the laser beam. It also matters which way your piece is facing. Think of a series of beams, reflectors, splitters, and prisms. The beam gets redirected off of your pieces, and possibly your opponents pieces, until it comes in contact with something that is not reflective, split, or pass through. Then it obliterates that object.

And I thought Fischer Random was hard. This game is insane.

If you want to try it out, download DosBox, and head over to the dos games section of my GitLab miscellaneous files folder. Good luck!

Linux – keep it simple.

Fool’s Mate Friday: Jin, FICS, and Correspondence Chess

Apparently, the earliest documented correspondence chess game was played between Henry I of England and Louis VI of France, but the earliest correspondence chess game in which all of the moves were recorded took place sometime in 1804 between F. W. de Mauvillion of Breda and an officer at a city of Holland, The Hague. According to Harry Golombek in his book ”Golombek’s Encyclopedia of Chess”.

Since then, we’ve moved to more modern methods of distance play, especially since the Internet. Now you can play on your computer, your cell phone, via email, or even telephone.

That brings us to Jin, but not rummy. That’s right, I’m talking about Jin, the chess interface. Here’s what the author of this great program says about it:

Jin is an open source, cross platform, graphical client for chess servers, written in Java. Jin can run either as a standalone application (available at this website) or as an applet, directly from your browser (available at the chess server’s website).

I’ve been using Jin for quite a while now on my Linux based machine. Among the many great things about Jin is that it is open source and cross platform. There is not enough of these kinds of good programs going around.

One of the best features, of course, is the ability to hook up to several chess servers, including FICS, the Free Internet Chess Server. I play there regularly myself. Of course, I am a big fan of free, so the price is right, but I also like the ability you have to message other players (somewhat like email), chat with your opponent during the game, keep a journal of your past games, and even email your played games to yourself. Perhaps later I can do an article specific to FICS and some of the great features there.

For now, you are probably wondering if this has anything to do with my Just Chess Engine. Well, I hope to one day have it playable on chess servers (although I doubt it would garner a great score), but it is not there yet. It is, however, available for others to drag and drop into their Android or Java applications to be used as a weak starter engine. No, I want to focus today on correspondence.

My next goal with my chess programming is to stick with Android for now, and in particular, cell phones. I’d like to build an android app that allows you to play other people who are not in the same room. I plan to venture into several different methods of communication, which will help me learn a lot about programming. In all of these methods, I hope to make a playable chess app as the objective.

My plan thus far is to make an app that starts with the option to play against the Just Chess engine, as a single player game. Then, I hope to move to a local, player verses player game, and for kicks, I’d like to progress to a game in which two players may play remotely, with the moves being sent via text, and the game app automatically importing those text moves into play.

From there, who knows? If the text games work well, I may branch out to how to have multiple games going at once, distinguished via some tag in the text messages. Or perhaps I’ll try my hand at a Bluetooth chess app. I’m not really sure. Either way, I have some work ahead of me, and hope you enjoy following along with my journey.

Linux – keep it simple.

Critical Velocity! A fun side scrolling arcade style game.

After finishing my Android developer course, I decided to try to put my new found (fledgling) skills to use by making a game. It’s a classic side scroller with an arcade feel to it. The story line is pretty short and to the point: you are a captain of a space ship that must escape a tunnel buried beneath the surface of a collapsing planet.

As you pass each object in the tunnel, you gain speed. There are power ups and bonus points, all the usual suspects in arcade game play, so be sure to check it out in my “Homemade Apps” section, on the play store, or in my github (it is licensed under the Apache 2.0 open source license.)

The background for the game was provided by the Quiet Learner ( https://qlfiles.net/ ), the music is “Space Blockbuster” by Soulbringer ( http://freemusicarchive.org/music/Soulbringer/Soulbringer/Soulbringer_-_Space_Blockbuster ), and the graphics were modified from Dan Cook’s work which he released to the public ( http://www.lostgarden.com/2005/03/game-post-mortem-hard-vacuum.html ). It’s great when people share their work so others can build upon it or with it. The same applies for my work on this game, if you can use it, do!

Linux – keep it simple.

Downloading internet content and apps about the worlds richest celebrities

In the continuing saga of my Android Developer Course with Rob Percival, I needed to make an app that would show a picture of a famous celebrity, and give the user a multiple choice quiz on who it was. Once clicked, it should tell you if you pass or fail, and load the next picture and names.

I decided to be different. Instead, I chose to have one name and four pictures. You can download the app here:

http://www.mediafire.com/file/srrey66ma3hxe5i/guesstherichcelebrity.apk

device-2017-03-13-131637

But be warned, when you click on your celebrity choice, you have to wait until it puts up a right/wrong toast before clicking again. Oh, you can click again, and it will not crash, but then you will only prolong the wait, which is a bit lengthy, due to my fledgling Java skills. Or maybe it is just my slow internet. Either way, be patient.

The way I went about doing this in my app was actually quite a bit different than that of my instructors. His way was much more streamlined and worked faster. I was happy that mine did work, though, Praise God!

Here’s what I did:

MainActivity.java

[CODE]
/* Copyright 2017 by AlaskaLinuxUser (https://thealaskalinuxuser.wordpress.com)
*
* Licensed under the Apache License, Version 2.0 (the “License”);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an “AS IS” BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alaskalinuxuser.guessthatceleb;

// Import some libraries….
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.os.AsyncTask;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Random;
import java.util.concurrent.ExecutionException;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class MainActivity extends AppCompatActivity {

// Declare our strings, integers, imageviews, bitmaps, and textviews.
String result;
int celebNum;
int aCeleb;
int rightAnswer;
String foundString;
String whosWho;
String whosName;
String whoWins;
ImageView picOne;
ImageView picTwo;
ImageView picThree;
ImageView picFour;
TextView nameText;
Bitmap winningPic;
Bitmap myBit;

// Our new class to download the page html data to parse for info.
public class DownloadPage extends AsyncTask<String, Void, String> {

// Do this in the background.
@Override
protected String doInBackground(String… urls) {

// A few declared items.
result = “”;
URL url;
HttpURLConnection urlConnection = null;
//Log.i(“WJH”, urls[0]); // To log that the URL arrived in the class when called.

// Try this.
try {

// Make our URL based on our given url to lookup.
url = new URL(urls[0]);

// Make a connection for that URL and open it.
urlConnection = (HttpURLConnection) url.openConnection();

// Start an input stream to get the bits.
InputStream in = urlConnection.getInputStream();

// Buffer it to reader.
BufferedReader reader = new BufferedReader(new InputStreamReader(in, “iso-8859-1”), 8);

// Build it string by string.
StringBuilder sb = new StringBuilder();
String line = null;
while ((line = reader.readLine()) != null) // Read line by line
sb.append(line + “\n”);

// Here is the result.
String resString = sb.toString();

// Close the stream.
in.close();

// Tie the result to our variable that is known outside of this class.
result = resString;

// return that variable.
return result;

// Have an exception clause so you don’t crash.
} catch (Exception e) {

e.printStackTrace();

return “Failed”;

}

}

}

// Our new class to download the picture in the background.
public class DownloadPic extends AsyncTask<String, Void, Bitmap> {

@Override
protected Bitmap doInBackground(String… urls) {

String result = “”;
URL url;
HttpURLConnection urlConnection;

try {

url = new URL(urls[0]);

urlConnection = (HttpURLConnection) url.openConnection();

// To download in one “go” as Rob says.
urlConnection.connect();

// To grab the whole thing at once.
InputStream inStream = urlConnection.getInputStream();

// Turn that data into a bitmap.
myBit = BitmapFactory.decodeStream(inStream);

// Return that bitmap.
return myBit;

// Have an exception if there is a failure.
} catch (Exception e) {

e.printStackTrace();

//Log.i(“WJH”, “Failed”); // You can log this to see the failure if needed.

// Since it fails, return nothing.
return null;

}

}
}

// Our random number generator.
public void randomIzer() {

// The random number generator itself.
Random ranGen = new Random();

// The random number of richest celebrities.
celebNum = ranGen.nextInt(20);

// The random number of the right answer.
rightAnswer = ranGen.nextInt(4);

//Log.i(“WJH”, Integer.toString(rightAnswer)); // Log this to test the random number answer.

}

// Our method to get the name of the celebrity.
public void getCelebname(){

// Call the class to download the page.
DownloadPage task = new DownloadPage();
String result = null;

// my trick number we will use later.
aCeleb=0;

try {

// execute, or go on and do that task.
result = task.execute(“http://www.therichest.com/top-lists/top-100-richest-celebrities&#8221;).get();

// A fail clause.
} catch (Exception e) {

e.printStackTrace();

}

// Now regex the data with this pattern.
Pattern pat = Pattern.compile(“<span>(.*?)</span>”);

// And search for matches in the results.
Matcher mat = pat.matcher(result);

// For every one you find, do this.
while (mat.find() && aCeleb <= celebNum) {

// Add to my magic number.
aCeleb++;

// The search results.
String foundNameString = (mat.group(1));

// Tie the search results to a public variable we can use outside of this method.
whosName = foundNameString;

//Log.i(“WJH”, whosName); // Log to see if this is working.

}

}

// And a method to figure out which picture we need. Same as above method, just a different
// search pattern.
public void getCelebpic(){

DownloadPage task = new DownloadPage();
String result = null;
aCeleb=0;

try {

result = task.execute(“http://www.therichest.com/top-lists/top-100-richest-celebrities&#8221;).get();

} catch (Exception e) {

e.printStackTrace();

}

Pattern pat = Pattern.compile(“0px\\)\” sizes=\”70px\” srcset=\”(.*?)\””);

Matcher mat = pat.matcher(result);

while (mat.find() && aCeleb <= celebNum – 1) {

aCeleb++;

foundString = (mat.group(1));

whosWho = foundString;

//Log.i(“WJH”, foundString); // Log to see if this is working.

}

}

// Ok, now we need to download that picture.
public void downloadPics(){

// Call the class to download the picture.
DownloadPic task = new DownloadPic();

try {

// Let’s get the picture.
Bitmap myImage = task.execute(whosWho).get();

} catch (InterruptedException e) {
e.printStackTrace();
} catch (ExecutionException e) {
e.printStackTrace();
}

}

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

// Define a few objects.
picOne = (ImageView)findViewById(R.id.imageViewZero);
picTwo = (ImageView)findViewById(R.id.imageViewOne);
picThree = (ImageView)findViewById(R.id.imageViewTwo);
picFour = (ImageView)findViewById(R.id.imageViewThree);
nameText = (TextView)findViewById(R.id.nameView);

// Set up our first round.
setupGame();

}

// The method to set up each round of choices.
public void setupGame() {

// Call the randomizer method.
randomIzer();

// Okay, so the real winner is:
// Get the winner name.
getCelebname();
// Set the winner name to the text field.
nameText.setText(whosName);
// Get the URL for the celeb pic.
getCelebpic();
// Tie in our winning variable, since we will overwrite it later.
whoWins = whosWho;
// Call the method to download the pic.
downloadPics();
// Tie in our winning pic to our downloaded pic, since we will overwrite it later.
winningPic = myBit;

// if/then. if you are the right answer, set your pic to the winning pic.
if (rightAnswer == 0) {

picOne.setImageBitmap(winningPic);

} else {

// If not, then plus one on the celebNum and call for a random picture.
celebNum++;
getCelebpic();
downloadPics();
picOne.setImageBitmap(myBit);

}

if (rightAnswer == 1) {

picTwo.setImageBitmap(winningPic);

} else {

celebNum++;
getCelebpic();
downloadPics();
picTwo.setImageBitmap(myBit);

}

if (rightAnswer == 2) {

picThree.setImageBitmap(winningPic);

} else {

celebNum++;
getCelebpic();
downloadPics();
picThree.setImageBitmap(myBit);

}

if (rightAnswer == 3) {

picFour.setImageBitmap(winningPic);

} else {

celebNum++;
getCelebpic();
downloadPics();
picFour.setImageBitmap(myBit);

}
}

// Well, am I right? This is called through onClick of each imageview.
public void amIRight(View view){

// Make a tag number string with get tag for the clicked object.
String tagNum = (String) view.getTag();
//Log.i(“WJH”, Integer.toString(rightAnswer)); // Log to see if this is working.
//Log.i(“WJH”, tagNum); // Log to see if this is working.
// Parse the integer from the string.
int taggedNum = Integer.parseInt(tagNum);
// Define a toast text for later.
String toastText;

// If the tagged number of the clicked square is the right answer….
if (taggedNum == rightAnswer) {

// Set the text to correct.
toastText = “Correct!”;

// If not….
} else {

// Set the text to incorrect.
toastText = “Incorrect.”;

}

// Set up the next round.
setupGame();

// And tell the user if they were right or not.
Toast.makeText(getApplicationContext(), toastText, Toast.LENGTH_LONG).show();

/* This may seem a bit odd. Logic would dictate we toast first, then set up the
* next round. But, if I toast first, the toast does not display because the phone
* is working too hard to get the new pictures. This way, we wait until the new pictures
* are in, then display the toast, which works, but seems sloppy.
*/
}
}
[/CODE]

And the activity_main.xml

[CODE]
<?xml version=”1.0″ encoding=”utf-8″?>
<LinearLayout
xmlns:android=”http://schemas.android.com/apk/res/android&#8221;
xmlns:app=”http://schemas.android.com/apk/res-auto&#8221;
xmlns:tools=”http://schemas.android.com/tools&#8221;
android:id=”@+id/activity_main”
android:layout_width=”match_parent”
android:layout_height=”match_parent”
android:orientation=”vertical”
android:paddingLeft=”@dimen/activity_horizontal_margin”
android:paddingRight=”@dimen/activity_horizontal_margin”
android:paddingTop=”@dimen/activity_vertical_margin”
android:paddingBottom=”@dimen/activity_vertical_margin”
tools:context=”com.alaskalinuxuser.guessthatceleb.MainActivity”
android:gravity=”top|center_horizontal”>

<TextView
android:text=”TextView”
android:layout_width=”wrap_content”
android:layout_height=”wrap_content”
android:layout_alignParentTop=”true”
android:layout_centerHorizontal=”true”
android:id=”@+id/nameView”
android:textSize=”40sp”
android:layout_margin=”25dp” />

<GridLayout
android:layout_width=”wrap_content”
android:layout_height=”wrap_content”
android:layout_centerVertical=”true”
android:layout_centerHorizontal=”true”
android:rowCount=”2″
android:columnCount=”2″>

<ImageView
android:layout_height=”150dp”
android:layout_width=”150dp”
android:src=”@mipmap/ic_launcher”
android:layout_row=”0″
android:layout_column=”0″
android:tag=”0″
android:onClick=”amIRight”
android:id=”@+id/imageViewZero” />

<ImageView
android:layout_height=”150dp”
android:layout_width=”150dp”
android:src=”@mipmap/ic_launcher”
android:layout_row=”0″
android:layout_column=”1″
android:tag=”1″
android:onClick=”amIRight”
android:id=”@+id/imageViewOne” />

<ImageView
android:layout_height=”150dp”
android:layout_width=”150dp”
android:src=”@mipmap/ic_launcher”
android:layout_row=”1″
android:layout_column=”0″
android:tag=”2″
android:onClick=”amIRight”
android:id=”@+id/imageViewTwo” />

<ImageView
android:layout_height=”150dp”
android:layout_width=”150dp”
android:src=”@mipmap/ic_launcher”
android:layout_row=”1″
android:layout_column=”1″
android:tag=”3″
android:onClick=”amIRight”
android:id=”@+id/imageViewThree” />

</GridLayout>
</LinearLayout>
[/CODE]

Of course, don’t forget to add internet permission in the AndroidManifest.xml:

[CODE]
<?xml version=”1.0″ encoding=”utf-8″?>
<manifest xmlns:android=”http://schemas.android.com/apk/res/android&#8221;
package=”com.alaskalinuxuser.guessthatceleb” >

<uses-permission android:name=”android.permission.INTERNET”/>

<application
android:allowBackup=”true”
android:icon=”@mipmap/ic_launcher”
android:label=”@string/app_name”
android:supportsRtl=”true”
android:theme=”@style/AppTheme” >
<activity android:name=”.MainActivity” >
<intent-filter>
<action android:name=”android.intent.action.MAIN” />

<category android:name=”android.intent.category.LAUNCHER” />
</intent-filter>
</activity>
</application>

</manifest>
[/CODE]

All of the java has notes sprinkled throughout for definitions of what I am trying to attempt. Be sure to check it out, and if you find it useful, be sure to use it! You can always check my github for these small apps if you want to download it and test out some other methods or use it in your own projects.

Linux – keep it simple.