I run my app on the emulator and when I click on the button for Clubs it just crashes and gives the message "Unfortunately app has stopped in Android Emulator". I've looked at the logcat and it says to check its declared in the manifest file which it is. So I'm just not sure what do. I'll put up my code for the layout file, the java file and the manifest file. Any help would be greatly appreciated.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/background"
android:orientation="vertical" >
<ImageView
android:id="@+id/school_icon"
android:layout_width="206dp"
android:layout_height="80dp"
android:layout_gravity="center"
android:contentDescription="@string/logo_desc"
android:src="@drawable/logo" />
<TextView
android:id="@+id/title_socities"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:padding="20dp"
android:textSize="20sp"
android:textColor="#CC0000"
android:text="@string/socities_info" />
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:id="@+id/ace"
android:layout_width="206dp"
android:layout_height="80dp"
android:layout_centerVertical="false"
android:layout_toRightOf="@+id/ace_icon"
android:padding="20dp"
android:text="Ace Society"
android:textColor="#CC0000"
android:textSize="20sp" />
<ImageView
android:id="@+id/ace_icon"
android:layout_width="206dp"
android:layout_height="80dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:src="@drawable/ace" />
<ImageButton
android:id="@+id/ace_fb"
android:layout_width="206dp"
android:layout_height="80dp"
android:layout_centerVertical="true"
android:layout_toRightOf="@+id/ace"
android:src="@drawable/facebook" />
</RelativeLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:id="@+id/anime_manga"
android:layout_width="206dp"
android:layout_height="80dp"
android:layout_centerVertical="false"
android:layout_toRightOf="@+id/anime_manga_icon"
android:padding="20dp"
android:text="Anime Manga"
android:textColor="#CC0000"
android:textSize="20sp" />
<ImageView
android:id="@+id/anime_manga_icon"
android:layout_width="206dp"
android:layout_height="80dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:src="@drawable/anime_manga" />
<ImageButton
android:id="@+id/anime_manga_fb"
android:layout_width="206dp"
android:layout_height="80dp"
android:layout_centerVertical="true"
android:layout_toRightOf="@+id/anime_manga"
android:src="@drawable/facebook" />
</RelativeLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:id="@+id/best_buddies"
android:layout_width="206dp"
android:layout_height="80dp"
android:layout_centerVertical="false"
android:layout_toRightOf="@+id/best_buddies_icon"
android:padding="20dp"
android:text="Best Buddies"
android:textColor="#CC0000"
android:textSize="20sp" />
<ImageView
android:id="@+id/best_buddies_icon"
android:layout_width="206dp"
android:layout_height="80dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:src="@drawable/best_buddies" />
<ImageButton
android:id="@+id/best_buddies_fb"
android:layout_width="206dp"
android:layout_height="80dp"
android:layout_centerVertical="true"
android:layout_toRightOf="@+id/best_buddies"
android:src="@drawable/facebook" />
</RelativeLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:id="@+id/computer_society"
android:layout_width="206dp"
android:layout_height="80dp"
android:layout_centerVertical="false"
android:layout_toRightOf="@+id/computer_society_icon"
android:padding="20dp"
android:text="Computer Society"
android:textColor="#CC0000"
android:textSize="20sp" />
<ImageView
android:id="@+id/computer_society_icon"
android:layout_width="206dp"
android:layout_height="80dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:src="@drawable/computer_socity" />
<ImageButton
android:id="@+id/computer_society_fb"
android:layout_width="206dp"
android:layout_height="80dp"
android:layout_toRightOf="@+id/computer_society"
android:src="@drawable/facebook" />
</RelativeLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:id="@+id/cumann_gaelach"
android:layout_width="206dp"
android:layout_height="80dp"
android:layout_centerVertical="false"
android:layout_toRightOf="@+id/cumann_gaelach_icon"
android:padding="20dp"
android:text="Cumann Gaelach"
android:textColor="#CC0000"
android:textSize="20sp" />
<ImageView
android:id="@+id/cumann_gaelach_icon"
android:layout_width="206dp"
android:layout_height="80dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:src="@drawable/cumann_gaelach" />
<ImageButton
android:id="@+id/cumann_gaelach_fb"
android:layout_width="206dp"
android:layout_height="80dp"
android:layout_centerVertical="true"
android:layout_toRightOf="@+id/cumann_gaelach"
android:src="@drawable/facebook" />
</RelativeLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:id="@+id/dj_society"
android:layout_width="206dp"
android:layout_height="80dp"
android:layout_centerVertical="false"
android:layout_toRightOf="@+id/dj_society_icon"
android:padding="20dp"
android:text="DJ Society"
android:textColor="#CC0000"
android:textSize="20sp" />
<ImageView
android:id="@+id/dj_society_icon"
android:layout_width="206dp"
android:layout_height="80dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:src="@drawable/dj_society" />
<ImageButton
android:id="@+id/dj_society_fb"
android:layout_width="206dp"
android:layout_height="80dp"
android:layout_centerVertical="true"
android:layout_toRightOf="@+id/dj_society"
android:src="@drawable/facebook" />
</RelativeLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:id="@+id/eng_society"
android:layout_width="206dp"
android:layout_height="80dp"
android:layout_centerVertical="false"
android:layout_toRightOf="@+id/eng_society_icon"
android:padding="20dp"
android:text="Engineering Society"
android:textColor="#CC0000"
android:textSize="20sp" />
<ImageView
android:id="@+id/eng_society_icon"
android:layout_width="206dp"
android:layout_height="80dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:src="@drawable/eng_society" />
<ImageButton
android:id="@+id/eng_society_fb"
android:layout_width="206dp"
android:layout_height="80dp"
android:layout_centerVertical="true"
android:layout_toRightOf="@+id/eng_society"
android:src="@drawable/facebook" />
</RelativeLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:id="@+id/equestrain"
android:layout_width="206dp"
android:layout_height="80dp"
android:layout_centerVertical="false"
android:layout_toRightOf="@+id/equestrain_icon"
android:padding="20dp"
android:text="Equestrain"
android:textColor="#CC0000"
android:textSize="20sp" />
<ImageView
android:id="@+id/equestrain_icon"
android:layout_width="206dp"
android:layout_height="80dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:src="@drawable/equestrian" />
<ImageButton
android:id="@+id/equestrain_fb"
android:layout_width="206dp"
android:layout_height="80dp"
android:layout_centerVertical="true"
android:layout_toRightOf="@+id/equestrain"
android:src="@drawable/facebook" />
</RelativeLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:id="@+id/fianna_fail"
android:layout_width="206dp"
android:layout_height="80dp"
android:layout_centerVertical="false"
android:layout_toRightOf="@+id/fianna_fail_icon"
android:padding="20dp"
android:text="Fianna Fail"
android:textColor="#CC0000"
android:textSize="20sp" />
<ImageView
android:id="@+id/fianna_fail_icon"
android:layout_width="206dp"
android:layout_height="80dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:src="@drawable/fianna_fail" />
<ImageButton
android:id="@+id/fianna_fail_fb"
android:layout_width="206dp"
android:layout_height="80dp"
android:layout_centerVertical="true"
android:layout_toRightOf="@+id/fianna_fail"
android:src="@drawable/facebook" />
</RelativeLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:id="@+id/film_society"
android:layout_width="206dp"
android:layout_height="80dp"
android:layout_centerVertical="false"
android:layout_toRightOf="@+id/film_society_icon"
android:padding="20dp"
android:text="Film Society"
android:textColor="#CC0000"
android:textSize="20sp" />
<ImageView
android:id="@+id/film_society_icon"
android:layout_width="206dp"
android:layout_height="80dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:src="@drawable/film_society" />
<ImageButton
android:id="@+id/film_society_fb"
android:layout_width="206dp"
android:layout_height="80dp"
android:layout_centerVertical="true"
android:layout_toRightOf="@+id/film_society"
android:src="@drawable/facebook" />
</RelativeLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
Java file
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
public class Clubs extends Activity
{
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.socities);
Button aces = (Button) findViewById(R.id.ace_fb);
Button anime_manga = (Button) findViewById(R.id.anime_manga_fb);
Button best_buddies = (Button) findViewById(R.id.best_buddies_fb);
Button computer_society = (Button) findViewById(R.id.computer_society_fb);
Button cumann_gaelach = (Button) findViewById(R.id.cumann_gaelach_fb);
Button dj_society = (Button) findViewById(R.id.dj_society_fb);
Button eng_society = (Button) findViewById(R.id.eng_society_fb);
Button equestrian = (Button) findViewById(R.id.equestrain_fb);
Button fianna_fail = (Button) findViewById(R.id.fianna_fail_fb);
Button film_society = (Button) findViewById(R.id.film_society_fb);
Button foiroige = (Button) findViewById(R.id.foiroige_fb);
Button games = (Button) findViewById(R.id.games_fb);
Button wish_makers_on_campus = (Button) findViewById(R.id.wish_makers_on_campus_fb);
Button heritage = (Button) findViewById(R.id.heritage_fb);
Button internationl_society = (Button) findViewById(R.id.internationl_society_fb);
Button letterfrack = (Button) findViewById(R.id.letterfrack_fb);
Button lgbt = (Button) findViewById(R.id.lgbt_fb);
Button living_history = (Button) findViewById(R.id.living_history_fb);
Button mature_students = (Button) findViewById(R.id.mature_students_fb);
Button photography = (Button) findViewById(R.id.photography_fb);
Button robotics = (Button) findViewById(R.id.robotics_fb);
Button science = (Button) findViewById(R.id.science_fb);
Button sinnfein = (Button) findViewById(R.id.sinnfein_fb);
aces.setOnClickListener(new OnClickListener()
{
public void onClick(View v)
{
Intent myWebLink = new Intent(android.content.Intent.ACTION_VIEW);
myWebLink.setData(Uri.parse("https://www.facebook.com/aceofclubsgmit?fref=ts"));
startActivity(myWebLink);
}
});
anime_manga.setOnClickListener(new OnClickListener()
{
public void onClick(View v)
{
Intent myWebLink = new Intent(android.content.Intent.ACTION_VIEW);
myWebLink.setData(Uri.parse("https://www.facebook.com/gmitanimemangasoc"));
startActivity(myWebLink);
}
});
best_buddies.setOnClickListener(new OnClickListener()
{
public void onClick(View v)
{
Intent myWebLink = new Intent(android.content.Intent.ACTION_VIEW);
myWebLink.setData(Uri.parse("https://www.facebook.com/pages/Best-Buddies-GMIT/305305566158422?fref=ts"));
startActivity(myWebLink);
}
});
computer_society.setOnClickListener(new OnClickListener()
{
public void onClick(View v)
{
Intent myWebLink = new Intent(android.content.Intent.ACTION_VIEW);
myWebLink.setData(Uri.parse("https://www.facebook.com/GMITComputerSociety"));
startActivity(myWebLink);
}
});
cumann_gaelach.setOnClickListener(new OnClickListener()
{
public void onClick(View v)
{
Intent myWebLink = new Intent(android.content.Intent.ACTION_VIEW);
myWebLink.setData(Uri.parse("https://www.facebook.com/gmitcumannnagaeilge?fref=ts"));
startActivity(myWebLink);
}
});
dj_society.setOnClickListener(new OnClickListener()
{
public void onClick(View v)
{
Intent myWebLink = new Intent(android.content.Intent.ACTION_VIEW);
myWebLink.setData(Uri.parse("https://www.facebook.com/GmitDjSociety"));
startActivity(myWebLink);
}
});
eng_society.setOnClickListener(new OnClickListener()
{
public void onClick(View v)
{
Intent myWebLink = new Intent(android.content.Intent.ACTION_VIEW);
myWebLink.setData(Uri.parse("https://www.facebook.com/pages/EngSoc-GMIT/196642613742557"));
startActivity(myWebLink);
}
});
equestrian.setOnClickListener(new OnClickListener()
{
public void onClick(View v)
{
Intent myWebLink = new Intent(android.content.Intent.ACTION_VIEW);
myWebLink.setData(Uri.parse("https://www.facebook.com/gmit.ridingclub"));
startActivity(myWebLink);
}
});
fianna_fail.setOnClickListener(new OnClickListener()
{
public void onClick(View v)
{
Intent myWebLink = new Intent(android.content.Intent.ACTION_VIEW);
myWebLink.setData(Uri.parse("https://www.facebook.com/sean.mulroycumann"));
startActivity(myWebLink);
}
});
film_society.setOnClickListener(new OnClickListener()
{
public void onClick(View v)
{
Intent myWebLink = new Intent(android.content.Intent.ACTION_VIEW);
myWebLink.setData(Uri.parse("https://www.facebook.com/pages/GMIT-Film-Making-Society/1376699195883960?fref=ts"));
startActivity(myWebLink);
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
============================================================================
Manifest File
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="ie.gmit.pleasework"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="19" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="ie.gmit.pleasework.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="ie.gmit.pleasework.Sponsors"
android:label="@string/airsoft" >
</activity>
<activity
android:name="ie.gmit.pleasework.Societies"
android:label="@string/airsoft" >
</activity>
<activity
android:name="ie.gmit.pleasework.Clubs"
android:label="@string/airsoft" >
</activity>
</application>
</manifest>
=================================================================================
logcat
04-29 11:50:28.660: E/AndroidRuntime(1642): FATAL EXCEPTION: main
04-29 11:50:28.660: E/AndroidRuntime(1642): Process: ie.gmit.pleasework, PID: 1642
04-29 11:50:28.660: E/AndroidRuntime(1642): android.content.ActivityNotFoundException: Unable to find explicit activity class {ie.gmit.pleasework/ie.gmit.pleasework.Societies}; have you declared this activity in your AndroidManifest.xml?
04-29 11:50:28.660: E/AndroidRuntime(1642): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1628)
04-29 11:50:28.660: E/AndroidRuntime(1642): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1424)
04-29 11:50:28.660: E/AndroidRuntime(1642): at android.app.Activity.startActivityForResult(Activity.java:3424)
04-29 11:50:28.660: E/AndroidRuntime(1642): at android.app.Activity.startActivityForResult(Activity.java:3385)
04-29 11:50:28.660: E/AndroidRuntime(1642): at android.app.Activity.startActivity(Activity.java:3627)
04-29 11:50:28.660: E/AndroidRuntime(1642): at android.app.Activity.startActivity(Activity.java:3595)
04-29 11:50:28.660: E/AndroidRuntime(1642): at ie.gmit.pleasework.MainActivity$8.onClick(MainActivity.java:101)
04-29 11:50:28.660: E/AndroidRuntime(1642): at android.view.View.performClick(View.java:4438)
04-29 11:50:28.660: E/AndroidRuntime(1642): at android.view.View$PerformClick.run(View.java:18422)
04-29 11:50:28.660: E/AndroidRuntime(1642): at android.os.Handler.handleCallback(Handler.java:733)
04-29 11:50:28.660: E/AndroidRuntime(1642): at android.os.Handler.dispatchMessage(Handler.java:95)
04-29 11:50:28.660: E/AndroidRuntime(1642): at android.os.Looper.loop(Looper.java:136)
04-29 11:50:28.660: E/AndroidRuntime(1642): at android.app.ActivityThread.main(ActivityThread.java:5017)
04-29 11:50:28.660: E/AndroidRuntime(1642): at java.lang.reflect.Method.invokeNative(Native Method)
04-29 11:50:28.660: E/AndroidRuntime(1642): at java.lang.reflect.Method.invoke(Method.java:515)
04-29 11:50:28.660: E/AndroidRuntime(1642): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
04-29 11:50:28.660: E/AndroidRuntime(1642): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
04-29 11:50:28.660: E/AndroidRuntime(1642): at dalvik.system.NativeStart.main(Native Method)
Main Activity
public class MainActivity extends Activity
{
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button contact = (Button) findViewById(R.id.btnContact);
Button fixturesAndResults = (Button) findViewById(R.id.btnFixtureandResults);
Button newsFeed = (Button) findViewById(R.id.btnNewsFeed);
Button sponsors = (Button) findViewById(R.id.btnSponsors);
Button scholarships = (Button) findViewById(R.id.btnScholarships);
Button facilites = (Button) findViewById(R.id.btnFacilities);
Button clubs = (Button) findViewById(R.id.btnClubs);
Button societies = (Button) findViewById(R.id.btnSocieties);
Button about = (Button) findViewById(R.id.btnAbout);
contact.setOnClickListener(new OnClickListener()
{
public void onClick(View v)
{
Intent i = new Intent(v.getContext(), Contact.class);
startActivity(i);
}
});
fixturesAndResults.setOnClickListener(new OnClickListener()
{
public void onClick(View v)
{
Intent i = new Intent(v.getContext(), FixturesAndResults.class);
startActivity(i);
}
});
newsFeed.setOnClickListener(new OnClickListener()
{
public void onClick(View v)
{
Intent i = new Intent(v.getContext(), NewsFeed.class);
startActivity(i);
}
});
sponsors.setOnClickListener(new OnClickListener()
{
public void onClick(View v)
{
Intent i = new Intent(v.getContext(), Sponsors.class);
startActivity(i);
}
});
scholarships.setOnClickListener(new OnClickListener()
{
public void onClick(View v)
{
Intent i = new Intent(v.getContext(), Scholarships.class);
startActivity(i);
}
});
facilites.setOnClickListener(new OnClickListener()
{
public void onClick(View v)
{
Intent i = new Intent(v.getContext(), Facilites.class);
startActivity(i);
}
});
clubs.setOnClickListener(new OnClickListener()
{
public void onClick(View v)
{
Intent i = new Intent(v.getContext(), Clubs.class);
startActivity(i);
}
});
societies.setOnClickListener(new OnClickListener()
{
public void onClick(View v)
{
Intent i = new Intent(v.getContext(), Societies.class);
startActivity(i);
}
});
about.setOnClickListener(new OnClickListener()
{
public void onClick(View v)
{
Intent i = new Intent(v.getContext(), About.class);
startActivity(i);
}
});
}
}