I’ve created 2 projects. One is to key in personal information and second application is where there’s ListView displayed of the information that’s keyed in. I’ve a spinner in the 1st application. I’m not sure how to pass the values of spinner to a listview in another activity.
Below is the 2nd application.
package main.page;
import android.app.Activity;
import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.AutoCompleteTextView;
import android.widget.Spinner;
import android.widget.TextView;
public class SavedInfo extends ListActivity
{
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.saved_info);
Bundle b = getIntent().getExtras();
String name = b.getString("name");
String date = b.getString("date");
String type = b.getString("type");
String likes = b.getString("likes");
String dislikes = b.getString("dislikes");
Spinner fullName = (Spinner) findViewById(R.id.fName);
TextView da = (TextView) findViewById(R.id.date);
TextView ty = (TextView) findViewById(R.id.type);
TextView like = (TextView) findViewById(R.id.likes);
TextView dislike = (TextView) findViewById(R.id.dislikes);
fullName.setOnItemSelectedListener("Full Name: " + name);
da.setText("Date: " + date);
ty.setText("Type: " + type);
like.setText("Likes: " + likes);
dislike.setText("Dislikes: " + dislikes);
}
}
I’m not sure if I’ve set the spinner right or wrong. I’m not sure how to set it too. Anyone knows how?
Thanks
get the text from the spinner and send it with an intent
then in the onCreate of the other activity