Hi there, When I try to run my android app in the eclipse emulator, I get the following message: Unfortunately, the application has stopped...
Here is the java code: package com.rentokil.ambius; import android.os.Bundle; import android.app.Activity; import android.view.Menu; import android.content.Context; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.BaseAdapter; import android.widget.Gallery; import android.widget.ImageView; import android.widget.TextView; import android.widget.AdapterView.OnItemSelectedListener; public class MainActivity extends Activity { TextView myIntro; TextView mySelection; Gallery myGallery; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); myIntro = (TextView) findViewById(R.id.myIntro); mySelection = (TextView) findViewById(R.id.mySelection); myGallery = (Gallery) findViewById(R.id.myGallery); myGallery.setAdapter(new ImageAdapater()); myGallery.setOnItemSelectedListener(new OnItemSelectedListener() { public void onItemSelected(AdapterView<?> parent, View v, int position, long id) { mySelection.setText(" selected option: " + position ); } public void onNothingSelected(AdapterView<?> parent) { mySelection.setText("Nothing selected"); } }); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.activity_main, menu); return true; } } and here is the xml code: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <TextView android:id="@+id/myIntro" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="#ff000000" android:text="Welcome to Ambius" android:textColor="#ffffffff" android:textSize="15dp" android:textStyle="bold" android:typeface="sans" /> <TextView android:id="@+id/mySelection" android:layout_width="fill_parent" android:layout_height="wrap_content" android:textSize="20dp" android:textStyle="bold"/> <Gallery android:id="@+id/myGallery" android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="bottom" /> </LinearLayout> Thank you, Kevin Davis -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en