[Solved] why does findViewById return null?

Put your problem here if it does not fit any of the other categories.

[Solved] why does findViewById return null?

Postby Anil » Wed Jan 16, 2008 7:11 pm

why does findViewById return null?

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.         TextView titleText = (EditText) findViewById(R.id.block_id_field);
Parsed in 0.031 seconds, using GeSHi 1.0.8.4


In the debugger, I find that titleText is null.

In R.java

public static final int block_id_field=0x7f07000c;

In block.xml
Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1.    <TextView id="@+id/block_id_field"
  2.  
  3.         android:background="@android:drawable/box"
  4.  
  5.         android:layout_width="fill_parent"
  6.  
  7.         android:layout_height="wrap_content"
  8.  
  9.         android:text="@string/block_id"/>
Parsed in 0.001 seconds, using GeSHi 1.0.8.4


Any help appreciated.
thanks,
Anil
Anil
Developer
Developer
 
Posts: 44
Joined: Fri Jan 04, 2008 9:15 pm

Top

Postby plusminus » Wed Jan 16, 2008 7:24 pm

Hello Anil,

did you call:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. setContentView(R.layout.main); // or similar
Parsed in 0.031 seconds, using GeSHi 1.0.8.4

before :?:

If it did not yet solve it:
Are you calling findViewById from an Activity or from within a View :?:

Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Postby Anil » Wed Jan 16, 2008 7:31 pm

plusminus wrote:Hello Anil,

did you call:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. setContentView(R.layout.main); // or similar
Parsed in 0.034 seconds, using GeSHi 1.0.8.4

before :?:

If it did not yet solve it:
Are you calling findViewById from an Activity or from within a View :?:

Regards,
plusminus


Thank you for your willingness to help the Android community!

1) I am a bit confused by setContentView(). As I understand, it should be called only to clear the screen and display the top-level gui - am I correct?

2) I am calling findViewById from a View.

My code is below (modified ApiDemos/View/List/List_8.java):


Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. package com.google.android.samples.view;
  2.  
  3. import com.google.android.samples.R;
  4.  
  5. import android.app.ListActivity;
  6. import android.content.Context;
  7. import android.os.Bundle;
  8. import android.view.View;
  9. import android.view.ViewGroup;
  10. import android.view.ViewGroup.LayoutParams;
  11. import android.widget.BaseAdapter;
  12. import android.widget.Button;
  13. import android.widget.EditText;
  14. import android.widget.ImageView;
  15. import android.widget.LinearLayout;
  16. import android.widget.TextView;
  17.  
  18. import java.util.ArrayList;
  19.  
  20.  
  21. /**
  22.  * A list view that demonstrates the use of setEmptyView. This example alos uses
  23.  * a custom layout file that adds some extra buttons to the screen.
  24.  */
  25. public class List8 extends ListActivity {
  26.  
  27.     PhotoAdapter mAdapter;
  28.  
  29.     @Override
  30.     public void onCreate(Bundle icicle) {
  31.         super.onCreate(icicle);
  32.  
  33.         // Use a custom layout file
  34.         setContentView(R.layout.list_8);
  35.  
  36.         // Tell the list view which view to display when the list is empty
  37.         getListView().setEmptyView(findViewById(R.id.empty));
  38.      //   getListView().setHorizontalScrollBarEnabled(true);
  39.        // getListView().setVerticalScrollBarEnabled(true);
  40.        
  41.         // Set up our adapter
  42.         mAdapter = new PhotoAdapter(this);
  43.         setListAdapter(mAdapter);
  44.  
  45.         // Wire up the clear button to remove all photos
  46.         Button clear = (Button) findViewById(R.id.clear);
  47.         clear.setOnClickListener(new View.OnClickListener() {
  48.  
  49.             public void onClick(View v) {
  50.                 mAdapter.clearPhotos();
  51.             } });
  52.  
  53.         // Wire up the add button to add a new photo
  54.         Button add = (Button) findViewById(R.id.add);
  55.         add.setOnClickListener(new View.OnClickListener() {
  56.  
  57.             public void onClick(View v) {
  58.                 mAdapter.addPhotos();
  59.             } });
  60.     }
  61.  
  62.     /**
  63.      * A simple adapter which maintains an ArrayList of photo resource Ids.
  64.      * Each photo is displayed as an image. This adapter supports clearing the
  65.      * list of photos and adding a new photo.
  66.      *
  67.      */
  68.     public class PhotoAdapter extends BaseAdapter {
  69.         int photoIndex = 0;
  70.         private Integer[] mPhotoPool = {
  71.                 R.drawable.sample_thumb_0, R.drawable.sample_thumb_1, R.drawable.sample_thumb_2,
  72.                 R.drawable.sample_thumb_3, R.drawable.sample_thumb_4, R.drawable.sample_thumb_5,
  73.                 R.drawable.sample_thumb_6, R.drawable.sample_thumb_7};
  74.  
  75.         private ArrayList<PhotoView> mPhotos = new ArrayList<PhotoView>();
  76.  
  77.         public PhotoAdapter(Context c) {
  78.             mContext = c;
  79.         }
  80.  
  81.         public int getCount() {
  82.             return mPhotos.size();
  83.         }
  84.  
  85.         public Object getItem(int position) {
  86.             return position;
  87.         }
  88.  
  89.         public long getItemId(int position) {
  90.             return position;
  91.         }
  92.  
  93.         public View getView(int position, View convertView, ViewGroup parent) {
  94.             return mPhotos.get(position);
  95.         }
  96.  
  97.         private Context mContext;
  98.  
  99.         public void clearPhotos() {
  100.             mPhotos.clear();
  101.             notifyDataSetChanged();
  102.         }
  103.  
  104.         public void addPhotos() {
  105.                
  106.             int whichPhoto = (int)Math.round(Math.random() * (mPhotoPool.length - 1));
  107.             int newPhoto = mPhotoPool[whichPhoto];
  108.             mPhotos.add(new PhotoView(mContext,newPhoto, "Hey, Looking good at " + whichPhoto, photoIndex++));
  109.           //  mPhotos.add(R.layout.block);
  110.             notifyChange();
  111.         }
  112.        
  113.         private class PhotoView extends LinearLayout {
  114.                 int offset = 1;
  115.             public PhotoView(Context context, int position, String title, int offset_) {
  116.                 super(context);
  117.                 offset = offset_;                
  118.                 this.setOrientation(VERTICAL);
  119.                LinearLayout.LayoutParams p = new LinearLayout.LayoutParams(
  120.                         LinearLayout.LayoutParams.FILL_PARENT,
  121.                         LinearLayout.LayoutParams.WRAP_CONTENT
  122.                 );
  123.  
  124.                 // Here we build the child views in code. They could also have
  125.                 // been specified in an XML file.
  126.              //  LinearLayout layout = findViewById(R.id.b);
  127.               TextView titleText = (EditText) findViewById(R.id.block_id_field);
  128.               titleText.setText("3.989");
  129.                             int leftMarginOffset = (offset*10);                
  130.                 p.setMargins(leftMarginOffset, 0, 0, 0);
  131.                 addView(titleText, p);
  132.    
  133.             }            
  134.         }
  135.        
  136.     }
  137. }
  138.  
Parsed in 0.053 seconds, using GeSHi 1.0.8.4
Anil
Developer
Developer
 
Posts: 44
Joined: Fri Jan 04, 2008 9:15 pm

Postby plusminus » Wed Jan 16, 2008 8:10 pm

Hello Anil,

Note that either Activity AND View provide an findViewByID-method:

From Activity(looks in XML used within setContentView()):
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. View android.app.Activity.findViewById(int id)
  2.  
  3. public View findViewById(int id)
  4. Finds a view that was identified by the id attribute from the XML THAT WAS PROCESSED in onCreate(Bundle).
Parsed in 0.036 seconds, using GeSHi 1.0.8.4


View (looks only in its children):
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. View android.view.View.findViewById(int id)
  2.  
  3. public final View findViewById(int id)
  4. Look FOR A CHILD VIEW with the given id. If this view has the given id, return this view.
Parsed in 0.036 seconds, using GeSHi 1.0.8.4


So for you sth. similar to this should work:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. // Save context in constructor of View(Activity extends Context!):
  2. Context ctx = null;
  3. public PhotoView(Context context, int position, String title, int offset_) {
  4.                 super(context);
  5.                 this.ctx = context;
  6.                 // ...
  7.  
  8. // AND
  9.  
  10. //added  ctx with cast before findViewById(...)
  11. TextView titleText = (EditText) ((Activity)ctx).findViewById(R.id.block_id_field);
Parsed in 0.037 seconds, using GeSHi 1.0.8.4

(untested!)

Let us know if it helped you. :)

Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Postby Anil » Thu Jan 17, 2008 12:55 am

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. TextView titleText = (TextView)((Activity) mContext).findViewById(R.id.block_id_field);
Parsed in 0.036 seconds, using GeSHi 1.0.8.4


Unfortunately, it did not work; it is still null.

In bin/R$id.class
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. // Field descriptor #6 I
  2.   public static final int block_id_field = 2131165196;
  3.  
  4.  
Parsed in 0.050 seconds, using GeSHi 1.0.8.4

Here is block.xml

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <!--
  3. * Copyright (C) 2007 Google Inc.
  4. *
  5. * Licensed under the Apache License, Version 2.0 (the "License");
  6. * you may not use this file except in compliance with the License.
  7. * You may obtain a copy of the License at
  8. *
  9. *      http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. -->
  17.  
  18. <!-- Demonstrates a simple linear layout. The height of the layout is the sum of its children. -->
  19.  
  20. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  21.    android:orientation="vertical"
  22.    android:layout_width="fill_parent"
  23.    android:layout_height="wrap_content">
  24. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  25.    android:orientation="horizontal"
  26.    android:background="@drawable/blue"
  27.    android:layout_width="fill_parent"
  28.    android:layout_height="wrap_content">
  29.     <!-- view1 goes on top -->
  30.     <TextView id="@+id/block_id_field"
  31.        android:background="@android:drawable/box"
  32.        android:layout_width="fill_parent"
  33.        android:layout_height="wrap_content"
  34.        android:text="@string/block_id"/>
  35.        
  36.         <ImageButton id="@+id/audio_cue"
  37.         android:layout_width="100dip"
  38.         android:layout_height="50dip"
  39.         android:src="@drawable/hasaudio" />
  40.        
  41.   <TextView id="@+id/android:empty"
  42.        android:layout_width="wrap_content"
  43.        android:layout_height="wrap_content"
  44.        android:text="@string/empty_cue"/>
  45.        
  46. </LinearLayout>
  47. </LinearLayout>
Parsed in 0.004 seconds, using GeSHi 1.0.8.4
Anil
Developer
Developer
 
Posts: 44
Joined: Fri Jan 04, 2008 9:15 pm

Postby Anil » Thu Jan 17, 2008 4:31 am

I also tried moving it to onCreate().
still null.

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.   TextView titleText = (TextView)findViewById(R.id.block_id_field);
  2.  
Parsed in 0.036 seconds, using GeSHi 1.0.8.4
Anil
Developer
Developer
 
Posts: 44
Joined: Fri Jan 04, 2008 9:15 pm

Top

Postby plusminus » Thu Jan 17, 2008 7:56 pm

Hello Anil,
Anil wrote:I also tried moving it to onCreate().
still null.

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.   TextView titleText = (TextView)findViewById(R.id.block_id_field);
  2.  
Parsed in 0.036 seconds, using GeSHi 1.0.8.4


that is really strange :!:

Try cleaning up your xml-file, you have LinearLayout with "xmlns:android="http://schemas.android.com/apk/res/android"" twice and simplify it, to exclude any other error:
Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3.    android:orientation="horizontal"
  4.    android:layout_width="fill_parent"
  5.    android:layout_height="fill_parent">
  6.     <!-- view1 goes on top -->
  7.     <TextView id="@+id/block_id_field"
  8.        android:layout_width="fill_parent"
  9.        android:layout_height="wrap_content"
  10.        android:text="TEST"/>
  11. </LinearLayout>
Parsed in 0.002 seconds, using GeSHi 1.0.8.4

Perhaps it helps.

Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Postby Anil » Thu Jan 17, 2008 8:01 pm

I have a basic question.
If I do a
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. setContentView(R.layout.list_8);
Parsed in 0.036 seconds, using GeSHi 1.0.8.4


However block.xml contains my view definition.
Is simply copying block.xml into the layout directory is enough for Android to locate it?

i.e. there is no explicit linking of the two files. no "import" or "include" statement.

thanks,
Anil
Anil
Developer
Developer
 
Posts: 44
Joined: Fri Jan 04, 2008 9:15 pm

Postby plusminus » Thu Jan 17, 2008 8:59 pm

Hello Anil,

I was so blind :!: :!: :!:

Removing this line will fix your issue or bring you ~10 lightyears further :!:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. import com.google.android.samples.R;
Parsed in 0.036 seconds, using GeSHi 1.0.8.4


Doing this typing like: "R.layout.list_8" no more points to the sample's list_8.xml :!:

Regards,
plusminus
Last edited by plusminus on Thu Jan 17, 2008 9:22 pm, edited 1 time in total.
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Postby Anil » Thu Jan 17, 2008 9:06 pm

I wonder if it has something to do with the setContentView() not having a "link" to the block.xml view.

I simplified the program by creating a new minimal project. textView is still null.


---List8.java---------
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. package com.google.android.samples.view;
  2.  
  3.  
  4.  
  5. import android.app.Activity;
  6.  
  7. import android.os.Bundle;
  8.  
  9. import android.widget.TextView;
  10.  
  11.  
  12.  
  13. public class List8 extends Activity {
  14.  
  15.     /** Called when the activity is first created. */
  16.  
  17.     @Override
  18.  
  19.     public void onCreate(Bundle icicle) {
  20.  
  21.         super.onCreate(icicle);
  22.  
  23.         setContentView(R.layout.main);
  24.  
  25.         TextView titleText = (TextView)findViewById(R.id.block_id_field);// ANIL
  26.  
  27.         titleText.setText("HAHA");
  28.  
  29.  
  30.  
  31.     }
  32.  
  33. }
Parsed in 0.040 seconds, using GeSHi 1.0.8.4

---------------R.java---------------
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. /* AUTO-GENERATED FILE.  DO NOT MODIFY.
  2.  
  3.  *
  4.  
  5.  * This class was automatically generated by the
  6.  
  7.  * aapt tool from the resource data it found.  It
  8.  
  9.  * should not be modified by hand.
  10.  
  11.  */
  12.  
  13.  
  14.  
  15. package com.google.android.samples.view;
  16.  
  17.  
  18.  
  19. public final class R {
  20.  
  21.     public static final class attr {
  22.  
  23.     }
  24.  
  25.     public static final class drawable {
  26.  
  27.         public static final int camcorder=0x7f020000;
  28.  
  29.         public static final int delete24=0x7f020001;
  30.  
  31.         public static final int hasaudio=0x7f020002;
  32.  
  33.         public static final int icon=0x7f020003;
  34.  
  35.         public static final int listen33=0x7f020004;
  36.  
  37.         public static final int microphone=0x7f020005;
  38.  
  39.         public static final int new24=0x7f020006;
  40.  
  41.         public static final int play33=0x7f020007;
  42.  
  43.         public static final int stop33=0x7f020008;
  44.  
  45.     }
  46.  
  47.     public static final class id {
  48.  
  49.         public static final int audio_cue=0x7f050001;
  50.  
  51.         public static final int block_id_field=0x7f050000;
  52.  
  53.     }
  54.  
  55.     public static final class layout {
  56.  
  57.         public static final int block=0x7f030000;
  58.  
  59.         public static final int main=0x7f030001;
  60.  
  61.     }
  62.  
  63.     public static final class string {
  64.  
  65.         public static final int anil_block_label=0x7f040002;
  66.  
  67.         public static final int anil_create_button=0x7f040001;
  68.  
  69.         public static final int anil_note_label=0x7f040003;
  70.  
  71.         public static final int app_name=0x7f040000;
  72.  
  73.         public static final int block_id=0x7f040005;
  74.  
  75.         public static final int empty_cue=0x7f040006;
  76.  
  77.         public static final int title=0x7f040004;
  78.  
  79.     }
  80.  
  81. }
Parsed in 0.042 seconds, using GeSHi 1.0.8.4

------------------block.xml-----------------
Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <?xml version="1.0" encoding="utf-8"?>
  2.  
  3. <!-- Demonstrates a simple linear layout. The height of the layout is the sum of its children. -->
  4.  
  5.  
  6.  
  7. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  8.  
  9.    android:orientation="vertical"
  10.  
  11.    android:layout_width="fill_parent"
  12.  
  13.    android:layout_height="wrap_content">
  14.  
  15. <LinearLayout
  16.  
  17.    android:orientation="horizontal"
  18.  
  19.    android:layout_width="fill_parent"
  20.  
  21.    android:layout_height="wrap_content">
  22.  
  23.     <!-- view1 goes on top -->
  24.  
  25.     <TextView id="@+id/block_id_field"
  26.  
  27.        android:background="@android:drawable/box"
  28.  
  29.        android:layout_width="fill_parent"
  30.  
  31.        android:layout_height="wrap_content"
  32.  
  33.        android:text="@string/block_id"/>
  34.  
  35.        
  36.  
  37.         <ImageButton id="@+id/audio_cue"
  38.  
  39.         android:layout_width="100dip"
  40.  
  41.         android:layout_height="50dip"
  42.  
  43.         android:src="@drawable/hasaudio" />
  44.  
  45.        
  46.  
  47. </LinearLayout>
  48.  
  49. </LinearLayout>
  50.  
  51. -------------main.xml-----------------
  52.  
  53. <?xml version="1.0" encoding="utf-8"?>
  54.  
  55. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  56.  
  57.    android:orientation="vertical"
  58.  
  59.    android:layout_width="fill_parent"
  60.  
  61.    android:layout_height="fill_parent"
  62.  
  63.    >
  64.  
  65. <TextView  
  66.  
  67.    android:layout_width="fill_parent"
  68.  
  69.    android:layout_height="wrap_content"
  70.  
  71.    android:text="Hello World, List8"
  72.  
  73.    />
  74.  
  75. </LinearLayout>
Parsed in 0.005 seconds, using GeSHi 1.0.8.4
Anil
Developer
Developer
 
Posts: 44
Joined: Fri Jan 04, 2008 9:15 pm

Postby Anil » Thu Jan 17, 2008 9:26 pm

plusminus wrote:Hello Anil,

I was so blind :!: :!: :!:

Removing this line will fix your issue or bring you ~10 lightyears further :!:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. import com.google.android.samples.R;
Parsed in 0.036 seconds, using GeSHi 1.0.8.4


Doing this typing like: "R.layout.list_8" no more points to the sample's list_8.xml :!:

Regards,
plusminus


Removing it is worse - it wont compile!

The block_id_field is defined in R.id, so that is not the problem.

Also, if you look at the code above in a new project, there is no import of R.
but still it fails.
Anil
Developer
Developer
 
Posts: 44
Joined: Fri Jan 04, 2008 9:15 pm

Postby plusminus » Thu Jan 17, 2008 9:27 pm

Hello Anil,

what is your reason of using "setContentView(R.layout.main);" (is currently just "Hello World"-Style)
instead of "setContentView(R.layout.block);" :?: (There has been something more sophisticated within before simlifying :?:)

Within findViewById(...) you can only refer to what you set as layout within OnCreate(...):
Javadoc:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. public View findViewById(int id)
  2. Finds a View that was identified by the id attribute from the XML that was processed in onCreate(Bundle).
Parsed in 0.036 seconds, using GeSHi 1.0.8.4


Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Postby Anil » Thu Jan 17, 2008 9:44 pm

plusminus,
Thanks for replying.
ok, I see what you are saying.
I shall think some more
thanks,
Anil

plusminus wrote:Hello Anil,

what is your reason of using "setContentView(R.layout.main);" (is currently just "Hello World"-Style)
instead of "setContentView(R.layout.block);" :?: (There has been something more sophisticated within before simlifying :?:)

Within findViewById(...) you can only refer to what you set as layout within OnCreate(...):
Javadoc:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. public View findViewById(int id)
  2. Finds a View that was identified by the id attribute from the XML that was processed in onCreate(Bundle).
Parsed in 0.036 seconds, using GeSHi 1.0.8.4


Regards,
plusminus
Anil
Developer
Developer
 
Posts: 44
Joined: Fri Jan 04, 2008 9:15 pm

Postby Anil » Thu Jan 17, 2008 10:49 pm

I think the answer to my problem was: you can only see a view in the
layout of what is exposed in setContentView().
thanks to plusminus at anddev.org for pointing me to it!
Anil
Developer
Developer
 
Posts: 44
Joined: Fri Jan 04, 2008 9:15 pm

Postby Anil » Fri Jan 18, 2008 8:00 pm

I have a further question.

In Notepadv3.java line 53

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. ArrayAdapter<String> notes = new ArrayAdapter<String>(this, R.layout.notes_row, items);
  2.  
  3.         setListAdapter(notes);
Parsed in 0.036 seconds, using GeSHi 1.0.8.4




However, notes_row.xml is defined in a separate file. In other words, no setContentView() was done on it.

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. setContentView(R.layout.notes_list);
Parsed in 0.036 seconds, using GeSHi 1.0.8.4


So how does the array adapter do it?
How does it use the resource id to get the view - if that is what it is doing?
Anil
Developer
Developer
 
Posts: 44
Joined: Fri Jan 04, 2008 9:15 pm

Top
Next

Return to Other Coding-Problems

Who is online

Users browsing this forum: Google [Bot] and 21 guests