Resize The inflated view does not work

I am trying to resize the inflated view but not working I am adding this view to AlertDialog LayoutInflater inflater = getActivity().getLayoutInflater(); View view = inflater.inflate(R.layout.popup_util, null,false); view.setLayoutParams(new Relative

The fastest way to get LayoutInflater

I can get the LayoutInflater with: inflater = LayoutInflater.from(context); or inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); Which way is faster and recommended?The second version will be (marginally) faster,

How to know the elements of view after the loading of a layout?

I am trying to write code , where after loading the Layout , i want to know which are the view elements are related to the layout like TextView, EditText , Checkbox etc. MyCode : package com.example.myview; import android.os.Bundle;

RelativeLayout escape adjusting by inflating

In this piece of code I tried to set background for my relative layout, then I added a text view to the layout(in center of it), but when I run the application the text is not centered! here is the java code: RelativeLayout mainLayout; @Override prot

Edit a particular view in Fragment

I am new to android developing and I am currently stumped at this situation. Is there a way to change a particular child view of a fragment? For example, I have a TextView and Button in a Fragment. Now after inflating this fragment and committing it,

need to display images from a URL in a list view filled by JSON

I need to show images from a URL on a list view populated by JSON. This is the main piece of code used to inflate the layout for each JSON object. It is working fine for text and integer values, but I am not able to show any of the images. Each objec

Android memory inflator layout

I'm getting this error only sometimes and only in one device: 04-09 16:05:22.016: E/AndroidRuntime(31843): FATAL EXCEPTION: main 04-09 16:05:22.016: E/AndroidRuntime(31843): android.view.InflateException: Binary XML file line #11: Error inflating cla

App crash when using fragments

Im working with fragments and.. Ive got a problem in my code that I just cant find. The logcat points at this piece of code, in one of my fragments: @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstance

Creating bitmaps from the background view

In my android application, on a certain activity I need to create screenshots of views without actually displaying them. I have been successful in achieving this by inflating the views and saving them as bitmaps. But in some scenarios the number of t

android: inflated view with a different focus of the activity

The orientation of my activity is fixed to be landscape. I am inflating 3 different layouts in this activity over an GLsurface view Only one of this will be visible at a time depending on user actions. One of this layout is a video view. I would like

Android - Access an added object after launching the activity

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 likes. This

onCreateOptionsMenu inside fragments

I have placed setHasOptionsMenu(true) inside onCreateView, but I still can't call onCreateOptionsMenu inside fragments. @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { setHasOptionsMenu(tr

Save the state of a container (LinearLayout)

I have two fragments. In first fragment I have a container static (LinearLayout) that to the view of fragment. In this container i do a inflation of several views. I change to a second fragment, but when i return to the first fragment the views infla

Better to inflate or instantiate controls in Android?

I'm wondering if anyone can shed some insight as to the best practice for dynamically creating controls (inflate vs instantiate). Inflate: TextView styledText = (TextView)inflater.inflate(R.layout.styledTextView); Instantiate: TextView styledText = n

setImageResource in GridView creates holes

Hello everyone I have a problem. I want to do a GridView with a Custom Loyout so i used the layoutInflater and i did this: private ImageView prima; private ImageView seconda; public View getView(int position, View convertView, ViewGroup parent) { Vie

How to access views from inflated layouts?

I have a simple Activity with its main.xml attached. main.xml has a custom layout (customLinearLayout) and a simple TextView. The custom layout also have its own layout-file (linearlayout.xml) with a simple Button. The layout is inflated by the class

When should I inflate the layout of my custom view?

I made a custom view which is used in several Fragments of an viewpager. The view is always stored as a field of the Fragment. I inflate the layout in the constructor and everything works fine flipping through the pages. Because always the next Fragm

Android New problem of intention; startActivity ();

Anyone have any idea why this don't works ? the startActivity(i); Not Working public class UiHelper { /** * About Dialog */ public static void showAboutDialog(Activity activity) { AlertDialog.Builder builder = new AlertDialog.Builder(activity); build

How do you inflate an XML layout in Android?

I'm writing an android application which starts of as a listview, for which I've written a class that extends ArrayAdapter, populating each row from a database. When an Item in the list is clicked, it fires an intent to another class which I want to

Change the background color of the android menu

This question already has an answer here: Android: customize application's menu (e.g background color) 6 answers I'm trying to change the standard light grey to a light green. Seems that there is not a simple way to do this (through Android Themes, f