android,android-layout,relativelayout,layout-inflaterView the original page-Collection of common programming errors

UnKnown Error


  • Waqleh
    android android-layout notifications icons 2014-2-17 2:44:23
    I would like to make an icon counter for andoid just like the Email and the Samsung Apps applications i have seen such requests from other developers, but you all say it can’t be done.if so how come those 2 apps and other apps can do it? do i have to make like more than one icon image and swap them or something? is it really cant be done and why?thanks.

  • Elad Benda
    java android 2014-2-17 1:08:19
    This question already has an answer here:Calling a Java method with no name [duplicate]8 answersI have encountered the following code:public final class MainActivity extends ActivityBase{static{Logger.create(); } …}what does static area like this means?What’s the advantage using this syntax?

  • Nightly Nexus
    android searchview android-searchmanager android-search 2014-2-17 0:34:33
    I am trying to make my app consist a SINGLE activity. This activity should be able to create a search and also receive a search. Unfortunately, I am getting a “double” search bar in my SearchView when I click on the search button in the action bar. I mean that there is a search bar (dark– SearchView) that appears for a second in the action bar, and then a second one (white) appears OVER the action bar. Any help? What am I doing wrong? Sorry, this search thing is all new and confusing to me

  • Romain Piel
    android activity phone tablet 2014-2-17 0:14:55
    Is there a way to have two different Java code for one Android app? One targeting phone devices and the other targeting tablet devices.For example, something like HomeActivity.java and HomeActivity-large.javaBasically I would like to make an Android app that has different layout following its resolution.I know I can use layout-large to have a specific layout for large devices. I’m not sure how to have a specific logic for tablets and another one for phone targets.The reason I want to do that is

  • ssk
    android screen-orientation 2014-2-17 0:13:13
    I have a Table containing a number of images per row. The number of images per row is decided on the fly based on the image width and screen width. When I use the phone normally, images are spaced on the phone screen. When the phone orientation changes, all the images appear on the same row. Should I explicitly handle the orientation changes for this case?// get the number of images per column based on the screen // resolution Display display = getWindowManager().getDefaultDisplay(); int screenW

  • Software Sainath
    android google-play android-manifest nexus-7 android-compatibility 2014-2-17 0:10:46
    Hii i have submitted an app to playstore but it isn’t compatible with Nexus here is my Manifest My App is on List of supported Devices in the Google Play and when i check the same in the nexus device it is not at all visible on Search<uses-sdk android:minSdkVersion=”14″ android:targetSdkVersion=”14″/><supports-screensandroid:anyDensity=”true”android:largeScreens=”true”android:normalScreens=”true”android:resizeable=”true”android:smallScreens=”true”android:xlargeScreens=”true”/> <us

  • foobarometer
    android jar dex dx 2014-2-17 0:09:21
    I have a jar file created out of an android application, because I marked it as “Is library” in eclipse at creation time. Now the DexClassLoader is not able to load this file because it doesn’t have an entry marked classes.dex. This looks like a standard jar. How can I convert such a jar into a dexed jar with dx that DexClassLoader can load? Any help appreciated!

  • caps lock
    android textview orientation 2014-2-16 20:29:15
    I’m trying for hours to save & restore TextView and Buttons but it seems that i’m not good enough… I made a TicTacToe game but I want to save all the stuffs when orientation is “landscape”Here is a part of what I’m trying to do :private Button lesBoutons[]; private Button rejouer; private Jeu jeu; private TextView leTexte; private int[] tabGagne; public boolean fini;@Override public void onSaveInstanceState(Bundle outState) {super.onSaveInstanceState(outState);outState.PutString(“savText”,

  • Purush
    android 2014-2-16 20:27:52
    I wrote new example similar to WebView Demo and registered my Java object with addJavascriptInterface() to webview. and in Java script I am able to call java methods. Later, I modified android browser code and tried to add Object to javascript,in a same way. but object members are not accessible in javascript and I get runtime error like “Uncaught TypeError: Object com.android.browser.BrowserActivity$MyJavaScriptInterface@43bf7eb8 has no method ‘launchPlayer’ “Where as launchPlayer method is ava

  • Wilfred Springer
    android 2014-2-16 19:23:52
    I get the impression that Android supports reflection. But does it really? How sensible would it be to rely on reflection heavily? What’s the penalty?

  • Waqleh
    android android-layout notifications icons 2014-2-17 2:44:23
    I would like to make an icon counter for andoid just like the Email and the Samsung Apps applications i have seen such requests from other developers, but you all say it can’t be done.if so how come those 2 apps and other apps can do it? do i have to make like more than one icon image and swap them or something? is it really cant be done and why?thanks.

  • Wayne
    android android-widget android-layout 2014-2-16 16:23:28
    I have a ListView with an ArrayList adapter. The rows are not very complex (an Image on the left, a LinearLayout with TextViews inside, and a CheckBox on the right … the layout is copied in below.) The goal is to have a QuickAction bar come up if the user clicks on the image or text, and have the CheckBox change state if the user clicks on the CheckBox. I have each part working independently, but not when they’re together in the layout – somehow, I’m losing the onItemClick event. The “QuickAct

  • Bill the Lizard
    java android android-layout android-manifest 2014-2-15 3:33:34
    I’m wondering if it is possible to create an Android app with only Java. No XML, no other things.In Eclipse, when I create a new Android Project, the Manifest xml-file and the main layout xml-file is automatically generated. Can I delete those files and replace them by a Java-file?

  • EGHDK
    android android-layout android-manifest 2014-2-14 16:33:28
    I’ve been trying to set a holo theme in Android, but I haven’t been able to get it to recognize it. Any ideas?Posted is my manifest:<?xml version=”1.0″ encoding=”utf-8″?> <manifest xmlns:android=”http://schemas.android.com/apk/res/android”package=”com.test.test”android:versionCode=”1″android:versionName=”1.0″ ><uses-sdk android:minSdkVersion=”7″ android:targetSdkVersion=”15″/><applicationandroid:icon=”@drawable/ic_launcher”android:label=”@string/app_name” android:theme=”@and

  • luckysing_noobster
    java android android-layout android-view android-progressbar 2014-2-13 12:24:37
    I have made a transparent custom progress bar.I want to move the progress bar to a certain location on the screen programatically.But every time the custom progress bar get drawn at the middle of the screen.public class CustomProgressBar extends Dialog { ProgressBar mProgressBar; TextView mTextMessage;public CustomProgressBar(Context context, int id) {super(context, R.style.ProgressDialogTheme);LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);V

  • Xylian
    android android-layout android-linearlayout 2014-2-13 8:11:44
    I’m adding a new views to my LinearLayout on a runtime. I’d like them to be stacked on the right side of the layout.On the picture clock icon gets stacked on the left, so it’s oposite to what I want. Is it possible to make them stack on the right of the higlited LinearLayout? (It can be any other layout, not just Linear if it gives what I want)

  • Anviksha
    android android-layout mdpi 2014-2-13 7:43:53
    Both my device and Google nexus have 320 dpi display, but when I am building the same source code(VideoEditor app), for Nexus, it chooses icons from xhdpi folder while when I build it for my device, it chooses mdpi folder. Can anyone tell why is this happening? Where exactly in the source code it takes this decision of icon set selection?Also, when an app gets built for a particular device, what all configuration files it uses? bcoz same source code is giving different results when built for bo

  • EGHDK
    android android-layout android-actionbar 2014-2-13 7:09:20
    So I have a few questions about implementing the Android action bar. Up to this point I haven’t really made any apps that were (in my opinion) good enough to put on the market. This really seems to be my inability to understand how the layouts and action bar will work in different versions of Android.Of course Google seems to be the best bet for this, but I come across a few grey areas that maybe someone can clear up. I can see that the Action bar was implemented in API level 11, but then what h

  • DonGru
    android android-layout android-imageview 2014-2-13 3:52:05
    I am referring to the photo detail view where it looks likeGoogle+ header ——— Photo transparent background meta data (user, description, etc) comments ——— Add comment text input that is always on screen bottomThe Photo, transparent background meta data, and comments all scroll while the Add comment text input remains fixed at the bottom of the screen.  Is this just a ListView with a special zooming ImageView that has the photo size set at runtime?

  • beachboy2009
    android android-layout android-ui 2014-2-13 0:02:08
    I have following myRec.xml<?xml version=”1.0″ encoding=”utf-8″?> <selector xmlns:android=”http://schemas.android.com/apk/res/android” ><item><shape><corners android:radius=”1dp”android:bottomRightRadius=”0dp”android:bottomLeftRadius=”4dp”android:topLeftRadius=”4dp”android:topRightRadius=”0dp”/><stroke android:color=”@color/my_button_border”android:width=”1dp” /><solid android:color=”@android:color/transparent” /></shape></item> </selector&

  • user3043062
    android layout view relativelayout 2014-2-1 0:40:44
    I would like to replace an item “A” in a Relativelayout with another one, item “B”, in the same position of the item “A”. I try with layout.addView(view, index) but the item “B” is not in the same position of the item “A”. How can i solve this problem?

  • Laksh
    android android-layout relativelayout classcastexception framelayout 2014-1-27 0:58:59
    In my application, I have a layout which has a RelativeLayout to which I want to set margins at runtime programmatically. But when I do that, it gives me ClassCastException saying FrameLayout can not cast to RelativeLayout. I don’t have any FrameLayout used, also there are no imports for FrameLayout. Still the problem persists. The xml I am using is:<?xml version=”1.0″ encoding=”utf-8″?> <RelativeLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:id=”@+id/rl_root”

  • MartinS
    android android-layout relativelayout 2014-1-25 11:16:24
    I have a relative layout which works fine at runtime but in the Eclipse graphical layout designer I receive the exceptionCouldn’t resolve resource @id/imgSessionOutcome_Product1_IconThe resource of the imageview is defined and is before the references to it, so I can’t quite see what the issue is ? The exception is listed twice so both references to it fail.I’ve saved/cleaned project to make sure resources rebuilt, still same error.Eclipse Version: Helios Service Release 2 running on OSX with l

  • Magakahn
    android scrollview relativelayout 2014-1-21 15:27:22
    I am devloping an app with a ScrollView were most of the Views in it is added to a RelativeLayout at onCreate. Like this:I also want to add Views during runtime. These are added to the current position at the image above. What I want to do is add Views in the wanted position during runtime. How can I achieve this?

  • J-P

  • Daniel L.
    android relativelayout android-custom-view layout-inflater 2014-1-18 17:16:43
    In general, I want to know how should I inflate custom layout defined in XML at runtime without having a redundant layout in my views hierarchy.Now, in particular:I have a custom layout which is declared in an xml, my_relative_layout.xml and its root element is a RelativeLayout. I have also defined a class which extends RelativeLayout called MyRelativeLayout.java.How can I inflate my_relative_layout.xml in my MyRelativeLayout.java in a way that I won’t have a redundant RelativeLayout in the hier

  • slhck

  • WildBill
    android relativelayout 2014-1-13 21:01:49
    I’m trying to use a RelativeLayout to produce two rows of items, one row of three buttons up top with a scrollview below them. I want the scrollView to occupy as much of the space as possible. I believe a RelativeLayout is the best approach here. I’m trying to do this at runtime and not via an xml layout file. My code is as follows:RelativeLayout.LayoutParams exitparams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.FILL_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT); exit

  • Chris
    android rendering relativelayout 2014-1-13 18:51:16
    I have an ImageView and 3 TextViews inside a relative layout, and need to position the text views at run time depending on the size of the image. At the moment I’m using a ViewTreeObserver on the image so that I can use it’s width/height to position the text boxes.Everything works fine except that the TextViews jump to the correct location on load, making it appear like there’s a flicker. Is there a way to reposition the TextViews before the screen renders but once the ImageView has it’s widt

  • Hasslarn
    java android relativelayout 2014-1-13 5:50:42
    I got 3 textviews which i want to move on swipe. How do i change position of a textview thats in a relative layout on runtime?Example:

  • user2486655
    android layout-inflater xmlpullparser 2014-2-1 7:53:24
    I want to use external(like /storage/sdcard0/main.xml) xml as Layout by LayoutInflater. So I found use external xml by XmlPullParser. But It didn’t work!!How to write xml source which is operating on XmlPullParser and LayoutInflater?

  • Vinod Maurya
    android android-layout layout-inflater 2014-2-1 3:51:41
    Is it possible to add a XML layout to custom extended ViewGroup at runtime?I tried adding the layout using LayoutInflator.inflate(…) method but it only returns the root node of the xml layout. Is there any way to inflate the full layout and add it to the ViewGroup?Thanks

  • hotveryspicy
    android layout-inflater 2014-1-23 8:01:51
    I created mainLayout with two buttonsadd: to add other layoutremove : to remove other layout.<Buttonandroid:id=”@+id/btnAdd”android:textStyle=”bold”android:layout_width=”fill_parent”android:layout_height=”wrap_content”android:layout_gravity=”center_horizontal”android:text=”Add View”android:onClick=”addView” /><Buttonandroid:id=”@+id/btnRemove”android:textStyle=”bold”android:layout_width=”fill_parent”android:layout_height=”wrap_content”android:layout_gravity=”center_horizontal”android:t

  • user2431541
    android layout-inflater 2014-1-19 20:11:26
    ¿What is the meaning of the layout inflater?¿Could you explain me in your own words? Thank youmLayoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);view = mLayoutInflater.inflate(R.layout.list_item, null);

  • Daniel L.
    android relativelayout android-custom-view layout-inflater 2014-1-18 17:16:43
    In general, I want to know how should I inflate custom layout defined in XML at runtime without having a redundant layout in my views hierarchy.Now, in particular:I have a custom layout which is declared in an xml, my_relative_layout.xml and its root element is a RelativeLayout. I have also defined a class which extends RelativeLayout called MyRelativeLayout.java.How can I inflate my_relative_layout.xml in my MyRelativeLayout.java in a way that I won’t have a redundant RelativeLayout in the hier

  • zohreh
    android layout xml-parsing layout-inflater 2014-1-17 23:56:32
    I want display received layout file from server to user.after googling I find out I cant place my file in raw/asset folder and can’t use android’s LayoutInflater for inflat my file .one existing way is use Defaulthandler and processing it for creating views and viewgroups.please help me with represent other ways that I can use for this problem with example.thanks

  • Orlymee
    java android xml layout-inflater 2014-1-16 9:28:41
    I’ve been reading a lot of similar questions to try and find the solution for this but with no luck.MainActivity.javapublic class MainActivity extends Activity {@Override public void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);requestWindowFeature(Window.FEATURE_NO_TITLE);getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);setContentView(R.layout.game); }game.xml<RelativeLayout xmlns:android=”http://schemas.a

  • dierre
    android gui layout-inflater android-inflate 2014-1-15 9:54:58
    This is my main layout:<RelativeLayout style=”@style/StandardFillWrap” ><TableLayoutandroid:id=”@+id/match_tab”style=”@style/StandardFillWrap”android:stretchColumns=”*” ><TableRow ><TextView android:id=”@+id/match_home_name” /><TextView android:id=”@+id/match_home_score” /></TableRow><TableRow ><TextView android:id=”@+id/match_away_name” /><TextView android:id=”@+id/match_away_score” /></TableRow></TableLayout><Buttonandroid:id

  • barmaley
    java android xml user-interface layout-inflater 2014-1-14 11:18:44
    I plan to create XML layouts of my UI runtime (not as usual R.layout.* files), saving them to temp storage (either in filesystem or in SQLite).Reading docs I have found confusing statement to public View inflate (XmlPullParser parser, ViewGroup root):Important For performance reasons, view inflation relies heavily onpre-processing of XML files that is done at build time. Therefore, itis not currently possible to use LayoutInflater with an XmlPullParserover a plain XML file at runtime.Does some

  • keyboardsurfer
    android activity android-fragments layout-inflater 2014-1-9 0:29:24
    I am a beginner about android. For the past 6 months, I have been using the following code to display the layout in listview, fragment and add custom header.(ViewGroup) inflater.inflate(layout,view, false);LayoutInflater.from(getActivity()).inflate(layout, null);But i do not understand the functionality, and what it describes, and how it is working. Please kindly explain those if you know. Sorry for my bad English.