[android-developers] Android apps soon to be runnable on RIM's Blackberrys
Just thought I would let everyone know about this press release. http://press.rim.com/release.jsp?id=4935 Think of the new user base *drools* I would not be surprised if in the long term we start to see Blackberrys running skinned android... -- 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
[android-developers] Amazon Appmarket is now open!
Zsolt Vasvari zvasv...@gmail.com Mar 22 03:47AM -0700 I have one word to sum it up as: Hooray!! It is only open for US of A customers though :( -- 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
Re: [android-developers] Force close after adding resources and textview
Hey everyone, thanks for taking the time time to reply. It really is appreciated! Implementing my initialization in onCreate() worked, fantastic stuff. Thanks again Mark On 11 March 2011 06:17, Dianne Hackborn hack...@android.com wrote: Don't implement a constructor and do stuff in it. Implement your initialization in onCreate(). On Thu, Mar 10, 2011 at 6:25 PM, Mark Sharpley m.c.sharp...@gmail.comwrote: I was playing around with the galleryview and image switcher, and I decided to implement a textview that describes my images as I scroll through them. I created a string array, and added a text view in my layout xml. I then added the string and textview to my code. I thought I could reuse the position int from the images to get the right string from my array. However, this addition causes my app to force close when I try to run it. I have a feeling that I have totally butchered my working java code and you may very well cringe at what you are about to see. Apologies. I am learning :) If anyone could help me out, I would be most grateful. I have attached my java code, some probably not relevant xml and my logcat. Regards, Mark (Java Abuser) package com.markopolo.test; import android.app.Activity; import android.content.Context; import android.content.res.Resources; import android.content.res.TypedArray; import android.os.Bundle; import android.view.View; import android.view.ViewGroup; import android.view.animation.AnimationUtils; import android.widget.AdapterView; import android.widget.BaseAdapter; import android.widget.Gallery; import android.widget.TextView; import android.widget.Gallery.LayoutParams; import android.widget.ViewSwitcher.ViewFactory; import android.widget.ImageSwitcher; import android.widget.ImageView; import android.widget.AdapterView.OnItemClickListener; public class MainMenuActivity extends Activity implements ViewFactory { //---the images to display-- Integer[] imageIDs = { R.drawable.swan1, R.drawable.swan2, R.drawable.swan3, R.drawable.swan4, R.drawable.swan5, R.drawable.swan6 }; Resources res = getResources(); String[] swans = res.getStringArray(R.array.swan); private ImageSwitcher imageSwitcher; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.displayview); imageSwitcher = (ImageSwitcher) findViewById(R.id.switcher1); imageSwitcher.setFactory(this); imageSwitcher.setInAnimation(AnimationUtils.loadAnimation(this, android.R.anim.fade_in)); imageSwitcher.setOutAnimation(AnimationUtils.loadAnimation(this, android.R.anim.fade_out)); Gallery gallery = (Gallery) findViewById(R.id.gallery1); gallery.setAdapter(new ImageAdapter(this)); gallery.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView parent, View v, int position, long id) { imageSwitcher.setImageResource(imageIDs[position]); } }); } public View makeView() { ImageView imageView = new ImageView(this); imageView.setBackgroundColor(0xFF00); imageView.setScaleType(ImageView.ScaleType.FIT_CENTER); imageView.setLayoutParams(new ImageSwitcher.LayoutParams( LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); return imageView; } public class ImageAdapter extends BaseAdapter { private Context context; private int itemBackground; public ImageAdapter(Context c) { context = c; //---setting the style--- TypedArray a = obtainStyledAttributes(R.styleable.Gallery1); itemBackground = a.getResourceId( R.styleable.Gallery1_android_galleryItemBackground, 0); a.recycle(); } //---returns the number of images--- public int getCount() { return imageIDs.length; } //---returns the ID of an item--- public Object getItem(int position) { return position; } public long getItemId(int position) { return position; } //---returns an ImageView and TextView view--- public View getView(int position, View convertView, ViewGroup parent) { ImageView imageView = new ImageView(context); imageView.setImageResource(imageIDs[position]); imageView.setScaleType(ImageView.ScaleType.FIT_XY); imageView.setLayoutParams(new Gallery.LayoutParams(150, 120)); imageView.setBackgroundResource
[android-developers] Force close after adding resources and textview
I was playing around with the galleryview and image switcher, and I decided to implement a textview that describes my images as I scroll through them. I created a string array, and added a text view in my layout xml. I then added the string and textview to my code. I thought I could reuse the position int from the images to get the right string from my array. However, this addition causes my app to force close when I try to run it. I have a feeling that I have totally butchered my working java code and you may very well cringe at what you are about to see. Apologies. I am learning :) If anyone could help me out, I would be most grateful. I have attached my java code, some probably not relevant xml and my logcat. Regards, Mark (Java Abuser) package com.markopolo.test; import android.app.Activity; import android.content.Context; import android.content.res.Resources; import android.content.res.TypedArray; import android.os.Bundle; import android.view.View; import android.view.ViewGroup; import android.view.animation.AnimationUtils; import android.widget.AdapterView; import android.widget.BaseAdapter; import android.widget.Gallery; import android.widget.TextView; import android.widget.Gallery.LayoutParams; import android.widget.ViewSwitcher.ViewFactory; import android.widget.ImageSwitcher; import android.widget.ImageView; import android.widget.AdapterView.OnItemClickListener; public class MainMenuActivity extends Activity implements ViewFactory { //---the images to display-- Integer[] imageIDs = { R.drawable.swan1, R.drawable.swan2, R.drawable.swan3, R.drawable.swan4, R.drawable.swan5, R.drawable.swan6 }; Resources res = getResources(); String[] swans = res.getStringArray(R.array.swan); private ImageSwitcher imageSwitcher; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.displayview); imageSwitcher = (ImageSwitcher) findViewById(R.id.switcher1); imageSwitcher.setFactory(this); imageSwitcher.setInAnimation(AnimationUtils.loadAnimation(this, android.R.anim.fade_in)); imageSwitcher.setOutAnimation(AnimationUtils.loadAnimation(this, android.R.anim.fade_out)); Gallery gallery = (Gallery) findViewById(R.id.gallery1); gallery.setAdapter(new ImageAdapter(this)); gallery.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView parent, View v, int position, long id) { imageSwitcher.setImageResource(imageIDs[position]); } }); } public View makeView() { ImageView imageView = new ImageView(this); imageView.setBackgroundColor(0xFF00); imageView.setScaleType(ImageView.ScaleType.FIT_CENTER); imageView.setLayoutParams(new ImageSwitcher.LayoutParams( LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); return imageView; } public class ImageAdapter extends BaseAdapter { private Context context; private int itemBackground; public ImageAdapter(Context c) { context = c; //---setting the style--- TypedArray a = obtainStyledAttributes(R.styleable.Gallery1); itemBackground = a.getResourceId( R.styleable.Gallery1_android_galleryItemBackground, 0); a.recycle(); } //---returns the number of images--- public int getCount() { return imageIDs.length; } //---returns the ID of an item--- public Object getItem(int position) { return position; } public long getItemId(int position) { return position; } //---returns an ImageView and TextView view--- public View getView(int position, View convertView, ViewGroup parent) { ImageView imageView = new ImageView(context); imageView.setImageResource(imageIDs[position]); imageView.setScaleType(ImageView.ScaleType.FIT_XY); imageView.setLayoutParams(new Gallery.LayoutParams(150, 120)); imageView.setBackgroundResource(itemBackground); TextView textview = (TextView) findViewById(R.id.textview1); textview.setText(swans[position]); return imageView; } } } And arrays.xml: ?xml version=1.0 encoding=utf-8? resources string-array name=swan itemswan_1/item itemswan_2/item itemswan_3/item itemswan_4/item itemswan_5/item itemswan_6/item itemswan_7/item /string-array /resources My layout xml: ?xml version=1.0 encoding=utf-8? FrameLayout
[android-developers] Force close after adding resources and textview
Line 36: Resources res = getResources(); -- 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
[android-developers] Preparing an app for the small screen.
Hello Android Developers: I have developed a simple app which I am now testing on various phones. One of these is a HTC wildfire. On this phone I get the error cannot parse the package. I have support for small screens and low densities in the manifest, and I can't work out what else I need to do to resolve this. The app has been built for 2.1, min sdk 4. Will I need to borrow my friends wildfire to generate a log output? Regards Mark -- 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