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
2 answers

how to hide the keyboard in android when click the edit text in alert dialog box

i m using alertdialog to show my txt file content using edit text. here is the code used for alert dialog File sdcard = Environment.getExternalStorageDirectory(); file = new File(sdcard.getPath() + Constants.USERNOTE_FOLDER +…
neelsnallu
  • 101
  • 7
0
votes
1 answer

Getting Java illegal state Exception when trying to add View by inflating xml

Em getting java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first. Not able to find out which view has to be removed, any help would be really helpful. Here is the Code…
0
votes
1 answer

EditText is null when inflating from custom dialog view

I'm trying get the text from an EditText but i've logged out the EditText and it's null. I've tried to inflate it from a custom view. Am i inflating it incorrectly? I know prompsView is my custom AlertDialog view and within that is my EditText.…
turtleboy
  • 8,210
  • 27
  • 100
  • 199
0
votes
3 answers

Getting Inflate exception inconsistently in Android

I am getting the Inflate exception inconsistently on my emulator and device but sometimes it works fine Its showing that in xml at line -16, i have the problem coz I am using two images one above the other I have a bitmap image and undeneath I kept…
Randroid
  • 3,688
  • 5
  • 30
  • 55
0
votes
1 answer

Android: Button states don't show when using layout inflater

Problem statement I'm trying to implement my own virtual keyboard following example "softkeyboard", found in samples folder of android-sdk. In the onCreateInputView() view is created with layout inflater like this: @Override public View…
0
votes
1 answer

getView Inflater

This may be an elementary question, but I just want to know: When initializing the Inflater inside the getView() method, what's the different between these lines: convertView = inflater.inflate(resource, root); convertView = View.inflate(context,…
Aplit
  • 61
  • 1
  • 6
0
votes
1 answer

android: remove a row from the tablelayout

for adding a row in a tablelayout, the code can be done as follows: private void ToDisplayTagGUI(String Slot, int index) LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); View newTagView =…
pearmak
  • 4,979
  • 15
  • 64
  • 122
0
votes
1 answer

Inflating several same layouts with diffrent data

How can I inflate several same layouts with diffrent texts and images? I tried use this code for (final Tour t : info.tours) { final LinearLayout list = (LinearLayout) findViewById(R.id.tours_list); Log.d(Const.LOG_TAG, "Add…
Yara_M
  • 633
  • 9
  • 29
0
votes
1 answer

Pull to refresh on Android crashes on Inflater

I've downloaded pull to refresh widget for android and now I'm trying to make it work. I copied everything from the plugin and plugin example folder into my project, changed the import reference to R in…
amik
  • 5,613
  • 3
  • 37
  • 62
0
votes
1 answer

Get all edittext values which are inflating in loop in android

Hello I am inflate xml file like.. List allEds3 = new ArrayList(); LayoutInflater inflater = inflater = (LayoutInflater) getApplicationContext() .getSystemService(Context.LAYOUT_INFLATER_SERVICE); for (int hh1 = 57;…
Hardik Joshi
  • 9,477
  • 12
  • 61
  • 113
0
votes
2 answers

Accessing a UI component (Button) inside several other UI components (ExpandableListView - GridView) in Android

In a xml, I am having LinearLayout. Inside that I am using an ExpandableListView. Every expand item contain just one view which is a GridView. A GridView cell compose with three UI components which are ImageView, TextView and a Button. How I have…
AnujAroshA
  • 4,623
  • 8
  • 56
  • 99
0
votes
1 answer

Add Button/EditText to a relative-layout (inflate)

I got a problem with this code: @Override public View getView(int position, View convertView, ViewGroup parent) { LayoutInflater inflater = (LayoutInflater) context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); …
Bigflow
  • 3,616
  • 5
  • 29
  • 52
0
votes
2 answers

Why caching inflated layout in a static variable could be a memory leak?

I need to pre load a complex layout so I can show the activity more quickly the first time: LayoutInflater inflater = (LayoutInflater) mainActivity.getSystemService(Context.LAYOUT_INFLATER_SERVICE); SlowActivity.cachedView =…
Seraphim's
  • 12,559
  • 20
  • 88
  • 129
0
votes
2 answers

Make a inflation and write text in edittext simultaneously

Hy everybody. I need to verify if the content of a string is null or not. If the string is != null I make a performClick in a imageButton. This click make a inflate of layout in another layout. Then I need to write text in the editText that was…
Ricardo Filipe
  • 435
  • 4
  • 8
  • 24
0
votes
1 answer

Remove two LinearLayout's inside a inflater layout

I have a xml file named socio_form_organization.xml that have two layout's. This xml file is inflated in a layout named content how we can see by the code below socio_form_organization.xml