Questions tagged [layout-inflater]

The layout-inflater tag refers to the Android LayoutInflater class which is used to build a view hierarchy from an xml layout file.

The LayoutInflater class will build a view hierarchy from the XML layout, taking care of instantiating the views and setting them with the attributes values present in that layout file. This class can't be used directly, instead a reference to a valid LayoutInflater object can be obtained by using one of the methods of the Activity class or by getting it from the system services.

The usage of the LayoutInflater is simple: just use one of the inflate() methods and provide it the id of the XML layout file (in the form of R.layout.layout_file) along with other desired parameters. More information can be found in the documentation of the class.

1229 questions
0
votes
3 answers

confusion in row position number of custom list-view

Update As suggested i have added data view holder into my code but still i am facing same problem. I have edited my question and my code please take a look at that. I want to display 2 view in my List view according to row number.I want to display…
0
votes
2 answers

Android - Access an object added after the activity has launched

I'm a beginner in Android development and would appreciate your help on this one. I have an android activity that creates a Checkbox and an EditText when the user clicks on a button. The user is free to add as many Checkboxes/EditTexts he…
0
votes
0 answers

Get the id of a Textview from inflated layout

i have a xml like this: item.xml with the below code:
Goofy
  • 6,098
  • 17
  • 90
  • 156
0
votes
1 answer

when to use adapter and when to use inflater

I'm newbie in Android and i learning context menu but after surfing about context menu i have little bit confusion in Adapter and Inflater. I saw 1 program with using adapter and 1 using Inflater. So, please help me how/when to use Adapter and…
0
votes
2 answers

nullpointer exception with a new layout

I am having the next problem: i have an activity with its own layout called camera_layout, when i had all my layout in that file all went ok, now to display some of the views over my extended surfaceview i have added another layout with the…
user1805792
  • 319
  • 1
  • 4
  • 17
0
votes
1 answer

Null Pointer Exception in LayoutInflater

I have made Bean class in which we get & set values for name & image and make two other class . i made MainActivity class and ListAdapterPlay class, in which i want to set images in listView item . But it give NullPointerException in…
0
votes
1 answer

xml layout not showing in another xml layout using LayoutInflater in Android

I am trying to add one xml layout in another xml layout using LayoutInflater. but its not showing. Please check my source code. import android.app.Activity; import android.content.Context; import android.os.Bundle; import…
Ranjitsingh Chandel
  • 1,479
  • 6
  • 19
  • 33
0
votes
1 answer

Gridview using custom adapter not displaying all results

firstly a big thanks to all the experts that answer questions and provide insight into challenges. Your work is appreciated. Now, i'm a newbie and just started using java and Android....but i'm loving it. secondly, do forgive my code. its my very…
0
votes
1 answer

Using LayoutInflator to create a dialog that takes up whole screen

I am designing an "about" menu for an app and have used the following code in an options menu to generate it: case DIALOG_ABOUT: builder = new AlertDialog.Builder(this); Context context = getApplicationContext(); …
Andrew Martin
  • 5,619
  • 10
  • 54
  • 92
0
votes
3 answers

dynamically name textview after inflating android

I m inflating 4 linear layouts multiple times in a scroll view. Each layout has a title in its header. The code snippet is given below. for(int j=0;j
bharath
  • 953
  • 4
  • 17
  • 30
0
votes
2 answers

set OntouchListener of button inflated in a child view

how can I set the Ontouchlistener of PadButton PadSelect PadName in this code? main actyvity: public class Drum extends Activity { boolean loaded = false; int sound; SoundPool soundPool = null; Button PadButton,PadSelect,PadName; …
kosma822
  • 183
  • 1
  • 2
  • 7
0
votes
2 answers

combine 3 relative layouts multiple times

I have 3 relative layouts and i need to create a single setcontetntview which is a combination of these layouts each added 3 times and sharing equal screen space and it needs to be done programatically. I started by creating a new layout adding just…
0
votes
0 answers

ComponentInfo GridLayout error only in emulator

I made an Android App and on every hardware device I tested it, it runs. This goes from 2.1.x to 4.2. But now I wanted to make sure, that it looks good on every screen size, so I tried the app in different emulators. No single emulator configuration…
user2161301
  • 674
  • 9
  • 22
0
votes
3 answers

inflating layout item

i'm sorry if this question is a repeat. I have a problem: I have one main_activity with main_layout.xml. I have a TextView and SeekBar1 in it. I added a menu with a custom_dialog_layout which has a seekbar2. Dialog shows that custom_dialog with…
prashantwosti
  • 980
  • 2
  • 7
  • 17
0
votes
1 answer

Give an event to any button on any tableLayout row?

I want to give an event any button where it is taken from second layout to first layout with LayoutInflater. Here is my code. main.xml
Frkn
  • 157
  • 1
  • 1
  • 9