Hey guys I have been trying to figure this out and have looked over a number of questions here but can't seem to find the answer to my problem. I am making an app that displays dinners at random from an array. I would like these dinners to be clickable and take the user to a web page but I have no idea how to make that happen so at the moment I have just added the link below the dinner which looks pretty ugly.
Here is the class that contains the recipes:
package me.oak.dinnertime;
import java.util.Random;
public class CookBook {
    public String[] mfood =
            {
                    "Chicago Deep Dish Pizza \n \n http://www.taste.com.au/recipes/28896/chicago+deep+dish+pizza?ref=collections,pizza-recipes",
                    "Spaghetti Bolognese \n \n http://www.bbcgoodfood.com/recipes/1502640/the-best-spaghetti-bolognese",
                    "Bourbon Chicken \n \n http://www.food.com/recipe/bourbon-chicken-45809",
            };
    public String getFood() {
        
        String food = "";
        //Randomly select a dinner
        Random randomGenerator = new Random();  //Construct a new Random number generator
        int randomNumber = randomGenerator.nextInt(mfood.length);
        //Convert random number to text
        food = mfood[randomNumber];
        return food;
    }
}And here is the main activity:
package me.oak.dinnertime;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.RelativeLayout;
import android.widget.TextView;
public class DinnerTimeActivity extends Activity {
    private CookBook mCookBook = new CookBook();
    private ColourWheel mColourWheel = new ColourWheel();
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_dinner_time);
        
        
        final TextView dinnerLabel = (TextView) findViewById(R.id.DinnerTextView);
        final Button showDinnerButton = (Button) findViewById(R.id.showDinnerButton);
        final RelativeLayout relativelayout = (RelativeLayout) findViewById(R.id.relativeLayout);
        View.OnClickListener listener = new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                String food = mCookBook.getFood();
                //Update the label with the dinner
                dinnerLabel.setText(food);
                int colour = mColourWheel.getColour();
                relativelayout.setBackgroundColor(colour);
                showDinnerButton.setTextColor(colour);
            }
        };
        showDinnerButton.setOnClickListener(listener);
    }
}And here is the XML file:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    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=".DinnerTimeActivity"
    android:background="#ff51b46d"
    android:id="@+id/relativeLayout">
    <TextView android:text="What's for dinner?" android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textSize="24sp"
        android:textColor="#80ffffff" />
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/DinnerTextView"
        android:layout_centerVertical="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:textSize="24sp"
        android:textColor="@android:color/white"
        android:text="Click the button to find out!"
        android:autoLink="web" />
    <Button
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="Dinner Time"
        android:id="@+id/showDinnerButton"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        android:background="@android:color/white"
        android:textColor="#ff51b46d" />
</RelativeLayout>Sorry to give you so much, I just hope someone can help me out.
 
     
     
     
     
    