What is causing my app to crash on button press? - android

My manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.rufflez.pagertabstriplistview.pagertabstriplistview" >
<application
android:allowBackup="true"
android:icon="#drawable/icon"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.rufflez.pagertabstriplistview.pagertabstriplistview.FirstScreen"
android:label="#string/app_name"
android:theme="#style/AppTheme.Base">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
On the Launch screen (FirstScreen):
<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:background="#drawable/bg">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/img_logo"
android:src="#drawable/logo2"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true" />
<ImageView
android:visibility="invisible"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/img_title"
android:layout_centerVertical="false"
android:layout_centerHorizontal="true"
android:layout_marginTop="230dp"
/>
<TextView
android:visibility="visible"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/desc"
android:id="#+id/description"
android:textColor="#ffffffff"
android:textSize="24dp"
android:typeface="sans"
android:gravity="center"
android:layout_marginTop="375dp"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:textStyle="italic" />
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/btn_start"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:src="#drawable/start"
android:background="#null"
android:layout_marginBottom="16dp" />
</RelativeLayout>
My FirstScreen.java:
package com.rufflez.pagertabstriplistview.pagertabstriplistview;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.ImageButton;
public class FirstScreen extends Activity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.first_screen);
setupMessageButton();
}
private void setupMessageButton() {
//1. Get reference to button
ImageButton messageButton = (ImageButton) findViewById(R.id.btn_start);
//2. Set the click listener to run code.
messageButton.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
Log.i("DemoButtonApp", "Clicked Begin");
startActivity(new Intent(FirstScreen.this, MainActivity.class));
finish();
}
});
}
}
When I tap the ImageButton (btn_start) It crashes and says "Unfortunately, Video Game Historium has stopped" It doesn't seem to want to load the next screen. I looked in Logcat (which keeps going and going and never stopping) it's spitting out a few red errors:
EnterpriseContainerManager﹕ ContainerPolicy Service is not yet ready!!!
E/SMD﹕ DCD ON
CameraController﹕ handleMessage signal: 0
CameraController﹕ handleMessage(0) before let go!{ when=-506ms what=0 target=com.sec.android.smartface.CameraController$EventHandler }
just to name a few. Any ideas? It was working until I took the screen from one project and imported it into this one. I imported the xml, java and drawables.
Edit: Added Crash Report:
11-18 10:04:47.683 9690-9690/com.rufflez.pagertabstriplistview.pagertabstriplistview
E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.rufflez.pagertabstriplistview.pagertabstriplistview, PID: 9690
java.lang.RuntimeException: Unable to start activity
ComponentInfo{com.rufflez.pagertabstriplistview.pagertabstriplistview/com.rufflez.pagertabstriplistview.pagertabstriplistview.MainActivity}: java.lang.IllegalStateException: This Activity already has an action bar supplied by the window decor. Do not request Window.FEATURE_ACTION_BAR and set windowActionBar to false in your theme to use a Toolbar instead.

This Activity already has an action bar supplied by the window decor.
Do not request Window.FEATURE_ACTION_BAR and set windowActionBar to false in your theme
to use a Toolbar instead
This is the important part here. So, check your themes.xml and set `
<item name="windowActionBar">false</item>
Alternatively, you should be able to use as parent
parent="Theme.AppCompat.Light.NoActionBar"
and it should work.

Solved my issue. I had to change the order of my themes.xml around a little and add
<item name="windowActionBar">false</item>

Related

Android Splash Screen Center Image

I have an app with a splash screen view that looks like this:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#android:color/black">
<ImageView android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="#drawable/splash2"
android:scaleType="centerInside"
android:adjustViewBounds="true"
/>
<TextView
android:id="#+id/txtVersion"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#android:color/white"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_marginRight="10dp"
android:textSize="20dip"
android:visibility="invisible"
android:text="Version "/>
<LinearLayout
android:id="#+id/lvSplashInfo"
android:layout_width="fill_parent"
android:layout_height="120dp"
android:layout_marginRight="40dp"
android:layout_marginLeft="40dp"
android:layout_alignParentBottom="true"
android:orientation="vertical"
android:visibility="invisible"
android:background="#android:color/black">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="bleh"
android:layout_margin="5dp"
android:layout_gravity="center_horizontal"
android:textColor="#android:color/white"/>
<TextView
android:id="#+id/txtPercent"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="0% of the total"
android:layout_margin="5dp"
android:textSize="18sp"
android:gravity="center_horizontal"
android:textColor="#9DBA32"/>
<TextView
android:id="#+id/txtFilename"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="File name: xxxxx"
android:layout_margin="5dp"
android:textSize="18sp"
android:visibility="invisible"
android:gravity="center_horizontal"
android:textColor="#android:color/white"/>
</LinearLayout>
</RelativeLayout>
It renders an image scaled and centered into the screen. Unfortunately, this isn't working well for us. It causes a slight flash of white before it loads the view. My solution was to use an activity style. That works great, except I can't seem to center AND scale the image. I can center it easily, but it is wider than the screen. Here is my xml drawable:
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="#android:color/black"/>
<item>
<bitmap
android:gravity="center|bottom|clip_vertical"
android:src="#drawable/splash2"
/>
</item>
</layer-list>
How do I scale and center that splash2 image?
You can make the image in Photoshop, put it in the xml then center the whole thing, but I would recommend having a Splash screen while loading the app, because if you have it with a timer it wastes user's time...
So that's what I did to have a splash screen like this one:
First, you have to add a new Java class, let's call it SplashActivity.java
You don't have to add much to it:
package YOUR-PACKAGE-NAME;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
public class SplashActivity extends AppCompatActivity {
#Override
protected void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
Intent i = new Intent(SplashActivity.this, MainActivity.class);
startActivity(i);
finish();
}
}
After that, you have to have a drawable for the splash screen, because if you have a layout it will appear when the app is already loaded, so there won't be any sense in the Splash...
Go to the drawable folder and create a file named background_splash.xml.
There you add
<?xml version="1.0" encoding="utf-8"?>
<layer-list
xmlns:android="http://schemas.android.com/apk/res/android"
android:gravity="center">
<item>
<bitmap
android:src="#drawable/ic_splash"
/>
</item>
</layer-list>
where ic_splash is the image I created with Photoshop with resolution 1280x720 and then created a 9-patch image... (You have to have the 9-patch image, not to have normal, small and cropped image on different devices..) So go here and generate yours... Create it, download it and copy all the folders (mdpi, hdpi etc) to your res folder...
Now, go to your values/styles.xml and add the NoActionBar style
<style name="SplashTheme" parent="Theme.AppCompat.NoActionBar">
<item name="android:windowBackground">#drawable/background_splash</item>
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
THEN open your Manifest.xml and edit the activity with intent-filter.
Yours should be
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:icon="#drawable/ic_launcher"
android:theme="#style/AppTheme"
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
so replace the .MainActivity with .SplashActivity and the .MainActivity as another activity, so in the end you should have at least two activities declared at the Manifest.xml:
<activity
android:name=".SplashActivity"
android:theme="#style/SplashTheme"
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".MainActivity"
android:label="#string/app_name"
android:icon="#drawable/ic_launcher" or "#mipmap/ic_launcher"
android:theme="#style/AppTheme">
</activity>
Good luck! :)
If there are any troubles, ask :)

Button ClickListener crashes app

I'm trying to make an application that has multiple tabs, and for now I only have the tabs to worry about. The problem I have is that, when I uncomment the button setOnClickListener it gives me an error when trying to run it on the AVD.
Here is my main function
`
#Override
public void onCreate(Bundle Bgilca) {
Button blade;
super.onCreate(Bgilca);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.main);
launchMusic = MediaPlayer.create(main.this, R.raw.powerup);
launchMusic.start();
Thread launchTime = new Thread(){
public void run(){
try{
sleep(5000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
finally{
launchMusic.pause();
}
}
};launchTime.start();
}
Button blade = (Button)findViewById(R.id.fantab);
}`
when trying to execute in the AVD, the app crashes giving the message"unfortunately app_name has stopped"
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.bgilcag60"
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=".main"
android:label="#string/app_name"
android:screenOrientation ="portrait"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".ventscreen"
android:label="#string/app_name"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="com.example.bgilag60.ventscreen" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
</manifest>
'
here is my Layout.xml
<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:background="#drawable/background"
android:keepScreenOn="true"
android:paddingLeft="0dp"
android:paddingRight="0dp"
android:paddingTop="0dp"
android:paddingBottom="0dp"
tools:context="com.example.bgilcag60.main" >
<Button
android:id="#+id/scaunstg"
android:layout_width="170dp"
android:layout_height="70dp"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:background="#drawable/scaunstg"
android:baselineAlignBottom="true"
android:clickable="true" />
<Button
android:id="#+id/scaundr"
android:layout_width="170dp"
android:layout_height="70dp"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:background="#drawable/scaundr"
android:baselineAlignBottom="true"
android:clickable="true" />
<Button
android:id="#+id/home"
android:layout_width="160dp"
android:layout_height="80dp"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:background="#drawable/corrado_home"
android:clickable="true" />
<Button
android:id="#+id/head"
android:layout_width="66dp"
android:layout_height="80dp"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:background="#drawable/head_tab"
android:clickable="true" />
<Button
android:id="#+id/navi"
android:layout_width="66dp"
android:layout_height="70dp"
android:layout_alignParentTop="true"
android:layout_marginRight="95dp"
android:layout_toLeftOf="#+id/head"
android:background="#drawable/navi_tab"
android:clickable="true" />
<Button
android:id="#+id/fantab"
android:layout_width="66dp"
android:layout_height="66dp"
android:layout_alignParentTop="true"
android:layout_marginRight="95dp"
android:layout_toLeftOf="#+id/navi"
android:background="#drawable/fan_tab"
android:clickable="true" />
</RelativeLayout>
and here is my logcat
http://i.stack.imgur.com/UDUQC.png
any ideas?
You have that findViewById outside the onCreate method and it's not located inside any method.
Also you are defining Button blade twice.
So once you have defined button blade, then while referencing to it, you should not define it again.
So your your line should be -
blade = (Button)findViewById(R.id.fantab);
The error is about a null pointer on this line:
Button blade = (Button)findViewById(R.id.fantab);
Since you have the button in your xml, most likely you are not pointing to the right layout file:
setContentView(R.layout.main);
It means the layout file must be main.xml or you change the code to point to the right layout.
setContentView(R.layout.Layout);//from your post "here is my Layout.xml"
cause by: java.lang.NullPointerException
at android.app...FindviewbyID
at android.app.....main<init>(main.java:48);
the problem is there are object that findviewbyID by wrong reference. check carefull in line 48.
so apparently the problem was that the findViewById was after the bracket of the OnCreate function. Thank you for your answers.

How can I get a multiline custom title on android?

I am working on a xamarin project (has no relevance here as far as I can tell - the android layout properties are the same)
I am using Window.SetFeatureInt (WindowFeatures.CustomTitle, ...) to set the title (2 "columns". I wish to make two rows of text though for my title. Is this possible? I have not had much success. I have an upper left, upper right and lower left and lower right TextViews to set.
My previous attempts have ended up with the TextViews overwriting each other.
Here I am designing a XML file with an image, text for title & button. This is the XML file. U can use it however you want, for a complete application or perticular activity.
In case of activity add this activity's theme tag. For multi line just use text view in side the below linear layout, set it as multline true.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="35dip"
android:gravity="center_vertical"
android:background="#android:color/darker_gray">
<ImageView
android:id="#+id/header"
android:background="#drawable/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Custom Window Text"
android:textColor="#android:color/black"
android:textStyle="bold"/>
<Button
android:id="#+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button" />
Create a theme in Custom_theme.xml,
<resources>
<style name="CustomWindowTitleBarBG">
<item name="android:background">#323331</item>
</style>
<style name="TitleBarTheme" parent="android:Theme">
<item name="android:windowTitleSize">35dip</item>
<item name="android:windowTitleBackgroundStyle"> #style/CustomWindowTitleBarBG</item>
</style>
Modify the AndroidManifest.xml file as follows for applying custom theme
<application
android:icon="#drawable/icon"
android:label="#string/app_name"
android:theme="#style/TitleBarTheme" >
<activity
android:name=".CustomWindowTitle"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
Now in main java file add “requestWindowFeature(Window.FEATURE_CUSTOM_TITLE)” &
“getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.window_title)”
This is the code snippet for CustomWindowTitle.java
package com.example.android;
import android.app.Activity;
import android.os.Bundle;
import android.view.Window;
public class CustomWindowTitle extends Activity
{
#Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
setContentView(R.layout.main);
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.window_title);
}
}

error in running application on android emulator

I have written an app with XML and still I don't write Classes by java code. But the emulator can show my app by its name and after that it says " unfortunately, app has stopped." What I have to do for this problem??!
This is my code:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<Textview
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="#string/hello"/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="#string/TextView2"/>
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="#string/Button"
/>
</LinearLayout>
You must have at least one activity (Java class) in your application so that manifest.xml could recognize that and run it.
You have to use an activity to show this xml :
public class MainActivity extends Activity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
As you can see your xml is called by the setContentView method.
This activity must be declared in your AndroidManifest.xml with
<activity
android:name="YOURPACKAGE.ACTIVITY_NAME"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

Displaying another Activity after clicking a menu item

I am writing my first Android app. I have three Activities: BaseballCardList, BaseballCardDetails, and FilterBaseballCards. BaseballCardList loads as the main Activity. It has a menu with two options to display one of the other two activities. BaseballCardDetails loads just fine. However, when I try to load FilterBaseballCards, I get a "Unfortunately, BBCT for Android has stopped." error message. I am running my app in the Android emulator. Here is the relavant code:
res/layout/card_list.xml:
<?xml version="1.0" encoding="utf-8"?>
<ListView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/card_list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
res/layout/filter_cards.xml:
<?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="wrap_content"
android:orientation="vertical"
>
<TextView android:text="#string/filter_by_label" />
<RadioGroup android:id="#+id/filter_by">
<RadioButton android:id="#+id/year"
android:text="#string/year_radio_button"
/>
<RadioButton android:id="#+id/number"
android:text="#string/number_radio_button"
/>
<RadioButton android:id="#+id/year_and_number"
android:text="#string/year_and_number_radio_button"
/>
<RadioButton android:id="#+id/player_name"
android:text="#string/player_name_radio_button"
/>
</RadioGroup>
<Button android:id="#+id/ok"
android:text="#string/ok_button"
/>
<Button android:id="#+id/cancel"
android:text="#string/cancel_button"
/>
</LinearLayout>
BaseballCardList.java:
package bbct.android;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
public class BaseballCardList extends Activity {
private static final String DEBUG_TAG = "BaseballCardList";
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.card_list);
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
new MenuInflater(this).inflate(R.menu.option, menu);
return super.onCreateOptionsMenu(menu);
}
#Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.add:
Log.d(DEBUG_TAG, "Starting BaseballCardDetails");
this.startActivity(new Intent(this, BaseballCardDetails.class));
return true;
case R.id.filter:
Log.d(DEBUG_TAG, "Starting FilterBaseballCards");
this.startActivity(new Intent(this, FilterBaseballCards.class));
return true;
}
return super.onOptionsItemSelected(item);
}
}
FilterBaseballCards.java:
package bbct.android;
import android.app.Activity;
import android.os.Bundle;
public class FilterBaseballCards extends Activity{
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.filter_cards);
}
}
AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="bbct.android"
android:versionCode="1"
android:versionName="1.0">
<application android:label="#string/app_name" android:icon="#drawable/ic_launcher">
<activity android:name=".BaseballCardList"
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=".BaseballCardDetails" />
<activity android:name=".FilterBaseballCards" />
</application>
</manifest>
BaseballCardDetails.java is nearly identical to FilterBaseballCards.java, so I won't post it.
Why am I getting this error message? More importantly, how do I go about tracking down the problem myself? I am using the Android command-line tools, not Eclipse. I started adding some logging messages, but I don't know how to view the logging output that might help me trace the source of the problem.
Update:
I changed the setContentView() in FilterBaseballCards to setContentView(R.layout.card_details); and the card_details view loads just fine. This narrows down the problem to my filter_cards.xml file.
Another Update:
I simplified filter_cards.xml down to:
<?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="wrap_content"
android:orientation="vertical"
>
<TextView android:text="#string/filter_by_label" />
</LinearLayout>
and continue to get the same error as before.
use
adb logcat
to view logging from command prompt
probably you have not added entries to manifest file for your new activities, for more on starting one activity from another look here:
http://developer.android.com/training/basics/firstapp/starting-activity.html
Ok I think your view is right mostly. Except I didn't like this line
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content" //Here wrap_content? Shouldn't it be fill_parent?
android:orientation="vertical"
>
Other than that your resources might be messed up (not accessing the right ones / names are wrong) #string/name Or #+id/name
EDIT:
I also noticed you don't assign an ID to the TextView probably should do that ;)
Sounds like you forgot to add the activies you are starting to the manifest.
More on Intent Filters: http://developer.android.com/guide/components/intents-filters.html
As #Nate noted, and I verified, the problem was in the view for my FilterBaseballCards activity. In particular, I modified the filter_cards.xml layout to
<?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:orientation="vertical"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="#string/filter_by_label"
/>
</LinearLayout>
Note that I added android:layout_width and android:layout_height attributes to the TextView tag. After doing this, the app compiles and runs correctly in the Android emulator.

Categories

Resources