When I redid the recipe class I did not change much, but now when I click the recipe button on the main menu,
the screen will not display the activity. There are no errors in the log cat and I put in some breakpoints and the activity fully runs, just the new screen will not display. I cannot figure this out for the life of me.
The only thing I can find are these messages in the log cat:
"07-14 03:31:51.089: WARN/InputManagerService(59): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@44ffbe20"
"07-14 03:31:36.940: WARN/WindowManager(59): No window to dispatch pointer action 0"
menu class
import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.View;
import android.view.View.onclickListener;
import android.widget.Button;
public class Menu extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.menu);
SharedPreferences preferences = getSharedPreferences("settings", MODE_PRIVATE);
String token = preferences.getString("cookies", "false"); // gets the user token stored from a cached login to pass to subsequent activities
Button wall = (Button)findViewById(R.id.wall);
Button recipebook = (Button)findViewById(R.id.recipebook);
Button lists = (Button)findViewById(R.id.lists);
Button pantry = (Button)findViewById(R.id.pantry);
wall.setonclickListener(new onclickListener() {
@Override
public void onclick(View arg0) {
}
});
recipebook.setonclickListener(new onclickListener() {
@Override
public void onclick(View arg0) {
Intent intent = new Intent(Menu.this, RecipeTypeSelection.class);
startActivity(intent);
}
});
lists.setonclickListener(new onclickListener() {
@Override
public void onclick(View arg0) {
// TODO Auto-generated method stub
}
});
pantry.setonclickListener(new onclickListener() {
@Override
public void onclick(View arg0) {
// TODO Auto-generated method stub
}
});
}
}
recipe class
import java.util.ArrayList;
import java.util.List;
import com.foodal.android.Database.Meals;
import android.app.Activity;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.view.View;
import android.view.View.onclickListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.Spinner;
import android.widget.Toast;
public class RecipeTypeSelection extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.recipespinner);
List<String> mealTypes = new ArrayList<String>(); // an array to store the meal types for display in the activity spinner
DatabaseHelper helper = new DatabaseHelper(this);
SQLiteDatabase db = helper.getWritableDatabase();
Cursor cursor = db.query(true, Meals.MEALS_TABLE, new String[] { Meals.MEAL_TYPE }, null,
null, null, null, null, null);
startManagingCursor(cursor); // query the database for all the distinct meal types
int count = cursor.getCount();
if(count <= 0 || cursor == null) {
Toast.makeText(this, "You don't have any recipes in your recipe book!", Toast.LENGTH_SHORT);
finish();
} else {
mealTypes.add("All"); // add the ability to select "all" meals from the recipe book
int counter = 0;
cursor.moveToFirst();
while(cursor.isAfterLast() == false) { // add meal types to the array
String value = cursor.getString(counter);
mealTypes.add(value);
cursor.moveToNext();
}
}
final Spinner spinner = (Spinner) findViewById(R.id.spinner);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
android.R.layout.simple_spinner_item, mealTypes);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner.setAdapter(adapter);
Button button = (Button)findViewById(R.id.launchsearch);
button.setonclickListener(new onclickListener() {
@Override
public void onclick(View v) {
// TODO Auto-generated method stub
}
});
}
}
view for the recipe class that contains a spinner
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:padding="10dp"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#FFFFFF" >
<Spinner android:id="@+id/spinner"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
<Button android:id="@+id/launchsearch"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" />
</RelativeLayout>

New Topic/Question
Reply



MultiQuote







|