The application simply closes when I press TextView
.
It should move to another Activity
.
I've tried it in many ways and it keeps crashing.
package com.example.evellyn.auris;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
public class ListOfEpisodesActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_list_of_episodes);
TextView episode1 = (TextView)findViewById(R.id.episode1);
episode1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent playEpisode = new Intent(ListOfEpisodesActivity.this,PlayingEpisodeActivity.class);
startActivity(playEpisode);
}
});
}
}
Here is the Activity xml code
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="com.example.evellyn.auris.ListOfEpisodesActivity">
<ImageView
android:id="@+id/imagemPodcast"
android:layout_width="200dp"
android:layout_height="200dp"
android:src="@drawable/nossalingua"
android:layout_centerHorizontal="true"/>
<LinearLayout
android:layout_below="@id/imagemPodcast"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="70dp"
android:orientation="horizontal">
<ImageView
android:layout_width="50dp"
android:layout_height="50dp"
android:src="@drawable/example"/>
<TextView
android:id="@+id/episode1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/nossaLinguaEp1"
android:gravity="center_vertical" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<ImageView
android:layout_width="50dp"
android:layout_height="50dp"
android:src="@drawable/example"/>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/nossaLinguaEp2"
android:gravity="center_vertical"/>
</LinearLayout>
</LinearLayout>
</RelativeLayout>