[android-beginners] Re: Background Image for a (semi-transparent) List

2008-09-30 Thread [EMAIL PROTECTED]

Thanks guys for you help. (I've already rated David's answer - was a
big help!)

I also would like to know if this is possible:

A list, which is semi-transparent printed on a background image! That
background image should change when ever the device is rotated to it's
widescreen outfit. You should see the background image and also the
list entrie about it. (65% opacity)

Can someone give me some hints where to start... I've already checked
the API demos...

I'm in the early beginning of a small private project and would like
to know if it's possible to create software that has that UI... ;)

Thanks very much in advance,

Sascha

On Sep 30, 4:21 am, Zachary Becker [EMAIL PROTECTED] wrote:
 Ah ouch, spelt schemas wrong. lol.

 Thanks for the help. Seems to work now =D

 On Mon, Sep 29, 2008 at 5:17 PM, David Farler [EMAIL PROTECTED] wrote:
  Actually, Zach, I pasted everything you sent me and I also got your No
  Items! message. The problem is with your row.xml.
  Try this:

  row.xml:
  TextView xmlns:android=http://schemas.android.com/apk/res/android;
  android:id=@android:id/text1 android:paddingTop=2dip
   android:paddingBottom=3dip android:layout_width=fill_parent
  android:layout_height=wrap_content /
  :

  This is similar to Android's simple_list_item_1 layout.
  Then, remove the line:

  setContentView(R.layout.main);

  The content view is already being set when connecting this class to the
  ArrayAdapter. Resetting it to main will make it blank.

  Hope this helps,
  David

  On Mon, Sep 29, 2008 at 3:43 PM, Zachary Becker [EMAIL PROTECTED] wrote:

  I am having a similar issue.

  I tried you suggestion but my list just shows up empty.

  I think my problem might be in my XML.

  Here is my code

  simplelist.java
  ===
  package zach.test.simplelist;

  import android.app.ListActivity;
  import android.os.Bundle;
  import android.widget.ArrayAdapter;

  public class SimpleList extends ListActivity {
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);

  String[] StringArray = { Hello, World!, Foo Bar, Blah Blah
  Blah };
  ArrayAdapterString StringAdapter = new
  ArrayAdapterString(this, R.layout.row, StringArray);
  // setListAdapter(StringAdapter);// crashes program on startup
  getListView().setAdapter(StringAdapter);// program starts
  fine, but list shows empty

  setContentView(R.layout.main);
  }
  }

  main.xml
  ===
  ?xml version=1.0 encoding=utf-8?
  LinearLayout xmlns:android=http://schemas.android.com/apk/res/android;
android:layout_width=wrap_content
android:layout_height=wrap_content
  ListView android:id=@+id/android:list
android:layout_width=wrap_content
android:layout_height=wrap_content /
  TextView android:id=@+id/android:empty
android:layout_width=wrap_content
android:layout_height=wrap_content
android:text=No Items! /
  /LinearLayout

  row.xml
  =
  ?xml version=1.0 encoding=utf-8?
  TextView xmlns:android=http://schemes.android.com/apk/res/android;
android:id=@+id/text1
android:layout_width=wrap_content
android:layout_height=wrap_content /

  On Mon, Sep 29, 2008 at 11:12 AM, David Farler [EMAIL PROTECTED] wrote:

  Hi Sascha,
  I'm not an expert yet at this, but I did look into your problem. Perhaps
  you are forgetting to use the ListActivity's own ListView? Code below 
  should
  work.

  package com.android.hello;

  import android.app.ListActivity;
  import android.os.Bundle;
  import android.widget.ArrayAdapter;

  public class HelloAndroid extends ListActivity {
 /** Called when the activity is first created. */
 @Override
 public void onCreate(Bundle savedInstanceState) {
 super.onCreate(savedInstanceState);

 String[] someStringArrayThatShouldWork = {Test1, Test2,
  Test3};

 ArrayAdapterString aAdapter = new ArrayAdapterString(this,
  android.R.layout.simple_list_item_1, someStringArrayThatShouldWork);
 getListView().setAdapter(aAdapter);
 }
  }

  Hope this helps,
  David

  On Mon, Sep 29, 2008 at 11:09 AM, [EMAIL PROTECTED] 
  [EMAIL PROTECTED] wrote:

  Hi fellows,

  first of all, please don't hit me for asking stupid question. :) I'm
  quite a novice when it comes to Java (J2EE, J2ME, J2SE), but I'm a
  totally n00b when it comes to android. The tutorials are very helpful
  although I needed several tries to get a ListActivity working (using a
  ListAdapter)... my approach to just display an array of Strings didn't
  work... That should have been the easiest solution, since I have a
  fixed number of items to display in the list...

  This is what I did:

  

[android-beginners] Re: Background Image for a (semi-transparent) List

2008-09-29 Thread David Farler
Hi Sascha,
I'm not an expert yet at this, but I did look into your problem. Perhaps you
are forgetting to use the ListActivity's own ListView? Code below should
work.


package com.android.hello;

import android.app.ListActivity;
import android.os.Bundle;
import android.widget.ArrayAdapter;

public class HelloAndroid extends ListActivity {
   /** Called when the activity is first created. */
   @Override
   public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);

   String[] someStringArrayThatShouldWork = {Test1, Test2, Test3};

   ArrayAdapterString aAdapter = new ArrayAdapterString(this,
android.R.layout.simple_list_item_1, someStringArrayThatShouldWork);
   getListView().setAdapter(aAdapter);
   }
}



Hope this helps,
David






On Mon, Sep 29, 2008 at 11:09 AM, [EMAIL PROTECTED] 
[EMAIL PROTECTED] wrote:


 Hi fellows,

 first of all, please don't hit me for asking stupid question. :) I'm
 quite a novice when it comes to Java (J2EE, J2ME, J2SE), but I'm a
 totally n00b when it comes to android. The tutorials are very helpful
 although I needed several tries to get a ListActivity working (using a
 ListAdapter)... my approach to just display an array of Strings didn't
 work... That should have been the easiest solution, since I have a
 fixed number of items to display in the list...

 This is what I did:

 private String[] someStringArrayThatShouldWork = {Test1, Test2};

 in the onCreate method:

 setListAdapter(new ArrayAdapterString(this,
android.R.layout.simple_list_item_1,
 someStringArrayThatShouldWork));
 getListView().setTextFilterEnabled(true);

 I received an exception whenever I wanted to start the app. Is there
 anything else I need? That exception was something like need ID for
 TextView or something...

 But basically I'd like to have something like that:

 A list, which is semi-transparent printed on a background image! That
 background image should change when ever the device is rotated to it's
 widescreen outfit. You should see the background image and also the
 list entrie about it. (65% opacity)

 Can someone give me some hints where to start... I've already checked
 the API demos... But I didn't even get the simple List (String Array
 example) to work... :)

 Regards and thank you very much in advance,

 Sascha

 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Beginners group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~--~~~~--~~--~--~---



[android-beginners] Re: Background Image for a (semi-transparent) List

2008-09-29 Thread Zachary Becker
I am having a similar issue.

I tried you suggestion but my list just shows up empty.

I think my problem might be in my XML.


Here is my code

simplelist.java
===
package zach.test.simplelist;

import android.app.ListActivity;
import android.os.Bundle;
import android.widget.ArrayAdapter;

public class SimpleList extends ListActivity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

String[] StringArray = { Hello, World!, Foo Bar, Blah Blah
Blah };
ArrayAdapterString StringAdapter = new ArrayAdapterString(this,
R.layout.row, StringArray);
// setListAdapter(StringAdapter);// crashes program on startup
getListView().setAdapter(StringAdapter);// program starts fine,
but list shows empty

setContentView(R.layout.main);
}
}

main.xml
===
?xml version=1.0 encoding=utf-8?
LinearLayout xmlns:android=http://schemas.android.com/apk/res/android;
  android:layout_width=wrap_content
  android:layout_height=wrap_content
ListView android:id=@+id/android:list
  android:layout_width=wrap_content
  android:layout_height=wrap_content /
TextView android:id=@+id/android:empty
  android:layout_width=wrap_content
  android:layout_height=wrap_content
  android:text=No Items! /
/LinearLayout

row.xml
=
?xml version=1.0 encoding=utf-8?
TextView xmlns:android=http://schemes.android.com/apk/res/android;
  android:id=@+id/text1
  android:layout_width=wrap_content
  android:layout_height=wrap_content /

On Mon, Sep 29, 2008 at 11:12 AM, David Farler [EMAIL PROTECTED] wrote:

 Hi Sascha,
 I'm not an expert yet at this, but I did look into your problem. Perhaps
 you are forgetting to use the ListActivity's own ListView? Code below should
 work.


 package com.android.hello;

 import android.app.ListActivity;
 import android.os.Bundle;
 import android.widget.ArrayAdapter;

 public class HelloAndroid extends ListActivity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

String[] someStringArrayThatShouldWork = {Test1, Test2,
 Test3};

ArrayAdapterString aAdapter = new ArrayAdapterString(this,
 android.R.layout.simple_list_item_1, someStringArrayThatShouldWork);
getListView().setAdapter(aAdapter);
}
 }



 Hope this helps,
 David






 On Mon, Sep 29, 2008 at 11:09 AM, [EMAIL PROTECTED] 
 [EMAIL PROTECTED] wrote:


 Hi fellows,

 first of all, please don't hit me for asking stupid question. :) I'm
 quite a novice when it comes to Java (J2EE, J2ME, J2SE), but I'm a
 totally n00b when it comes to android. The tutorials are very helpful
 although I needed several tries to get a ListActivity working (using a
 ListAdapter)... my approach to just display an array of Strings didn't
 work... That should have been the easiest solution, since I have a
 fixed number of items to display in the list...

 This is what I did:

 private String[] someStringArrayThatShouldWork = {Test1, Test2};

 in the onCreate method:

 setListAdapter(new ArrayAdapterString(this,
android.R.layout.simple_list_item_1,
 someStringArrayThatShouldWork));
 getListView().setTextFilterEnabled(true);

 I received an exception whenever I wanted to start the app. Is there
 anything else I need? That exception was something like need ID for
 TextView or something...

 But basically I'd like to have something like that:

 A list, which is semi-transparent printed on a background image! That
 background image should change when ever the device is rotated to it's
 widescreen outfit. You should see the background image and also the
 list entrie about it. (65% opacity)

 Can someone give me some hints where to start... I've already checked
 the API demos... But I didn't even get the simple List (String Array
 example) to work... :)

 Regards and thank you very much in advance,

 Sascha




 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Beginners group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~--~~~~--~~--~--~---



[android-beginners] Re: Background Image for a (semi-transparent) List

2008-09-29 Thread David Farler
Actually, Zach, I pasted everything you sent me and I also got your No
Items! message. The problem is with your row.xml.
Try this:

row.xml:
TextView xmlns:android=http://schemas.android.com/apk/res/android;
android:id=@android:id/text1 android:paddingTop=2dip
 android:paddingBottom=3dip android:layout_width=fill_parent
android:layout_height=wrap_content /
:

This is similar to Android's simple_list_item_1 layout.
Then, remove the line:

setContentView(R.layout.main);

The content view is already being set when connecting this class to the
ArrayAdapter. Resetting it to main will make it blank.

Hope this helps,
David




On Mon, Sep 29, 2008 at 3:43 PM, Zachary Becker [EMAIL PROTECTED] wrote:

 I am having a similar issue.

 I tried you suggestion but my list just shows up empty.

 I think my problem might be in my XML.


 Here is my code

 simplelist.java
 ===
 package zach.test.simplelist;

 import android.app.ListActivity;
 import android.os.Bundle;
 import android.widget.ArrayAdapter;

 public class SimpleList extends ListActivity {
 /** Called when the activity is first created. */
 @Override
 public void onCreate(Bundle savedInstanceState) {
 super.onCreate(savedInstanceState);

 String[] StringArray = { Hello, World!, Foo Bar, Blah Blah
 Blah };
 ArrayAdapterString StringAdapter = new ArrayAdapterString(this,
 R.layout.row, StringArray);
 // setListAdapter(StringAdapter);// crashes program on startup
 getListView().setAdapter(StringAdapter);// program starts fine,
 but list shows empty

 setContentView(R.layout.main);
 }
 }

 main.xml
 ===
 ?xml version=1.0 encoding=utf-8?
 LinearLayout xmlns:android=http://schemas.android.com/apk/res/android;
   android:layout_width=wrap_content
   android:layout_height=wrap_content
 ListView android:id=@+id/android:list
   android:layout_width=wrap_content
   android:layout_height=wrap_content /
 TextView android:id=@+id/android:empty
   android:layout_width=wrap_content
   android:layout_height=wrap_content
   android:text=No Items! /
 /LinearLayout

 row.xml
 =
 ?xml version=1.0 encoding=utf-8?
 TextView xmlns:android=http://schemes.android.com/apk/res/android;
   android:id=@+id/text1
   android:layout_width=wrap_content
   android:layout_height=wrap_content /


 On Mon, Sep 29, 2008 at 11:12 AM, David Farler [EMAIL PROTECTED] wrote:

 Hi Sascha,
 I'm not an expert yet at this, but I did look into your problem. Perhaps
 you are forgetting to use the ListActivity's own ListView? Code below should
 work.


 package com.android.hello;

 import android.app.ListActivity;
 import android.os.Bundle;
 import android.widget.ArrayAdapter;

 public class HelloAndroid extends ListActivity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

String[] someStringArrayThatShouldWork = {Test1, Test2,
 Test3};

ArrayAdapterString aAdapter = new ArrayAdapterString(this,
 android.R.layout.simple_list_item_1, someStringArrayThatShouldWork);
getListView().setAdapter(aAdapter);
}
 }



 Hope this helps,
 David






 On Mon, Sep 29, 2008 at 11:09 AM, [EMAIL PROTECTED] 
 [EMAIL PROTECTED] wrote:


 Hi fellows,

 first of all, please don't hit me for asking stupid question. :) I'm
 quite a novice when it comes to Java (J2EE, J2ME, J2SE), but I'm a
 totally n00b when it comes to android. The tutorials are very helpful
 although I needed several tries to get a ListActivity working (using a
 ListAdapter)... my approach to just display an array of Strings didn't
 work... That should have been the easiest solution, since I have a
 fixed number of items to display in the list...

 This is what I did:

 private String[] someStringArrayThatShouldWork = {Test1, Test2};

 in the onCreate method:

 setListAdapter(new ArrayAdapterString(this,
android.R.layout.simple_list_item_1,
 someStringArrayThatShouldWork));
 getListView().setTextFilterEnabled(true);

 I received an exception whenever I wanted to start the app. Is there
 anything else I need? That exception was something like need ID for
 TextView or something...

 But basically I'd like to have something like that:

 A list, which is semi-transparent printed on a background image! That
 background image should change when ever the device is rotated to it's
 widescreen outfit. You should see the background image and also the
 list entrie about it. (65% opacity)

 Can someone give me some hints where to start... I've already checked
 the API demos... But I didn't even get the simple List (String Array
 example) to work... :)

 Regards and thank you very much in advance,

 Sascha



[android-beginners] Re: Background Image for a (semi-transparent) List

2008-09-29 Thread Zachary Becker
Ah ouch, spelt schemas wrong. lol.

Thanks for the help. Seems to work now =D

On Mon, Sep 29, 2008 at 5:17 PM, David Farler [EMAIL PROTECTED] wrote:

 Actually, Zach, I pasted everything you sent me and I also got your No
 Items! message. The problem is with your row.xml.
 Try this:

 row.xml:
 TextView xmlns:android=http://schemas.android.com/apk/res/android;
 android:id=@android:id/text1 android:paddingTop=2dip
  android:paddingBottom=3dip android:layout_width=fill_parent
 android:layout_height=wrap_content /
 :

 This is similar to Android's simple_list_item_1 layout.
 Then, remove the line:

 setContentView(R.layout.main);

 The content view is already being set when connecting this class to the
 ArrayAdapter. Resetting it to main will make it blank.

 Hope this helps,
 David




 On Mon, Sep 29, 2008 at 3:43 PM, Zachary Becker [EMAIL PROTECTED] wrote:

 I am having a similar issue.

 I tried you suggestion but my list just shows up empty.

 I think my problem might be in my XML.


 Here is my code

 simplelist.java
 ===
 package zach.test.simplelist;

 import android.app.ListActivity;
 import android.os.Bundle;
 import android.widget.ArrayAdapter;

 public class SimpleList extends ListActivity {
 /** Called when the activity is first created. */
 @Override
 public void onCreate(Bundle savedInstanceState) {
 super.onCreate(savedInstanceState);

 String[] StringArray = { Hello, World!, Foo Bar, Blah Blah
 Blah };
 ArrayAdapterString StringAdapter = new
 ArrayAdapterString(this, R.layout.row, StringArray);
 // setListAdapter(StringAdapter);// crashes program on startup
 getListView().setAdapter(StringAdapter);// program starts
 fine, but list shows empty

 setContentView(R.layout.main);
 }
 }

 main.xml
 ===
 ?xml version=1.0 encoding=utf-8?
 LinearLayout xmlns:android=http://schemas.android.com/apk/res/android;
   android:layout_width=wrap_content
   android:layout_height=wrap_content
 ListView android:id=@+id/android:list
   android:layout_width=wrap_content
   android:layout_height=wrap_content /
 TextView android:id=@+id/android:empty
   android:layout_width=wrap_content
   android:layout_height=wrap_content
   android:text=No Items! /
 /LinearLayout

 row.xml
 =
 ?xml version=1.0 encoding=utf-8?
 TextView xmlns:android=http://schemes.android.com/apk/res/android;
   android:id=@+id/text1
   android:layout_width=wrap_content
   android:layout_height=wrap_content /


 On Mon, Sep 29, 2008 at 11:12 AM, David Farler [EMAIL PROTECTED] wrote:

 Hi Sascha,
 I'm not an expert yet at this, but I did look into your problem. Perhaps
 you are forgetting to use the ListActivity's own ListView? Code below should
 work.


 package com.android.hello;

 import android.app.ListActivity;
 import android.os.Bundle;
 import android.widget.ArrayAdapter;

 public class HelloAndroid extends ListActivity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

String[] someStringArrayThatShouldWork = {Test1, Test2,
 Test3};

ArrayAdapterString aAdapter = new ArrayAdapterString(this,
 android.R.layout.simple_list_item_1, someStringArrayThatShouldWork);
getListView().setAdapter(aAdapter);
}
 }



 Hope this helps,
 David






 On Mon, Sep 29, 2008 at 11:09 AM, [EMAIL PROTECTED] 
 [EMAIL PROTECTED] wrote:


 Hi fellows,

 first of all, please don't hit me for asking stupid question. :) I'm
 quite a novice when it comes to Java (J2EE, J2ME, J2SE), but I'm a
 totally n00b when it comes to android. The tutorials are very helpful
 although I needed several tries to get a ListActivity working (using a
 ListAdapter)... my approach to just display an array of Strings didn't
 work... That should have been the easiest solution, since I have a
 fixed number of items to display in the list...

 This is what I did:

 private String[] someStringArrayThatShouldWork = {Test1, Test2};

 in the onCreate method:

 setListAdapter(new ArrayAdapterString(this,
android.R.layout.simple_list_item_1,
 someStringArrayThatShouldWork));
 getListView().setTextFilterEnabled(true);

 I received an exception whenever I wanted to start the app. Is there
 anything else I need? That exception was something like need ID for
 TextView or something...

 But basically I'd like to have something like that:

 A list, which is semi-transparent printed on a background image! That
 background image should change when ever the device is rotated to it's
 widescreen outfit. You should see the background image and also the
 list entrie about it. (65% opacity)

 Can someone give me some hints where to start...