[Android Software Development] kabluey:
I'm creating an app to keep track of all the messier objects in the sky. I have made a list view in the main activity that holds all the objects, when clicked it should open my other activity and display the objects info.

The program now goes to my second activity no matter what item i choose but doesn't change any of the TextView text without foreclosing.

also how can I recognize what object was clicked and change the information displayed for each object

The main Activity Java looks like this:

package com.kabluey.messier;

import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;

public class MessierCatalog extends ListActivity
{
/** Called when the activity is first created. */

@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);

// Set string array
setListAdapter(new ArrayAdapter<String>(this, R.layout.main, objects));

ListView lv = getListView();
lv.setTextFilterEnabled(true);

lv.setOnItemClickListener(new OnItemClickListener()
{
public void onItemClick(AdapterView<?> parent, View view,
int position, long id)
{
// When clicked, change text in object info to clicked object name
TextView objText = (TextView) findViewById(R.id.txtObjName);
objText.setText(((TextView) view).getText());

Intent i = new Intent(MessierCatalog.this,Objectinfo.class);
startActivity(i);
}
});
}

static final String[] objects = new String[]
{
"m1", "m2","m3","m4","m5", "m6","m7","m8","m9","m10","m11","m12","m13","m14"
,"m15","m16","m17","m18","m19","m19","m20","m21","m22","m23","m24","m25","m26","m27","m28","m29","m30","m31","m32","m33"
,"m34","m35","m36","m37","m38","m39","m40","m41","m42","m43","m44","m45","m46","m47","m48","m49","m50","m51","m52","m53"
,"m54","m55","m56","m57","m58","m59","m60","m61","m62","m63","m64","m65","m66","m67","m68","m69","m70","m71","m72","m73"
,"m74","m75","m76","m77","m78","m79","m80","m81","m82","m83","m84","m85","m86","m87","m88","m89","m90","m91","m92","m93"
,"m94","m95","m96","m97","m98","m99","m100","m101","m102","m103","m104","m105","m106","m107","m108","m109","m110"
};

}

The second activity has no code in it now and is just an xml layout:

<?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"
>

<ImageView
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:src="@drawable/crab"
/>
<TableLayout
android:layout_width="fill_parent"
android:id="@+id/tableLayout1"
android:layout_height="wrap_content"
android:stretchColumns="1">

<TableRow>

<TextView
android:text="Name of Object:"
android:padding="3dip"/>

<TextView
android:id="@+id/txtObjName"
android:text="Object name here"
android:padding="3dip"
android:paddingLeft="5dip" />

android:id="@+id/tableRow1"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</TableRow>

<TableRow>
<TextView
android:text="Apparent Magnitude:"
android:padding="3dip"/>

<TextView
android:id="@+id/txtMagnitude"
android:paddingLeft="5dip"
android:text="9.0"/>

android:id="@+id/tableRow1"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</TableRow>
</TableLayout>

</LinearLayout>