layout-inflater

NPE while inflating layout (Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference)

浪尽此生 提交于 2019-12-16 22:50:12
问题 I keep getting a java.lang.NullPointerException when I try to use ScrollView in an activity. The weird thing is that I've used the exact same Scrollview setup in other activities. And all of a sudden I'm getting errors. I've tried cleaning the project and rebuilding. And I've tried the good old restart the program. I learned a lot about Null Pointer Exceptions today, but I haven't been able to figure out why I keep getting Rendering Problems . This is the java.lang.NullPointerException that

WebView appears as plain white box after the second time it's been initialised

戏子无情 提交于 2019-12-14 01:47:02
问题 EDIT: tl;dr: WebView appears as white box, even though I appear to be setting it up correctly, and indeed it does work the first two times, but fails subsequently) EDIT: Video showing the problem in action... I have the following bit of code which inflates a view (Which contains a WebView) from the xml which defines it: private void createCard(ViewGroup cvFrame, Card card) { //... setup vairables... cvFrame.clearDisappearingChildren(); cvFrame.clearAnimation(); try { View cv = LayoutInflater

fragments and onConfigurationChanged

北战南征 提交于 2019-12-14 00:16:09
问题 I'm trying to do something I do with activities, but within a fragment. What I do is using activities: First stop the activity restarts when rotating the device android:configChanges="keyboardHidden|orientation|screenSize" in my activity add: @Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); setContentView(R.layout.main); } So get the activity does not restart, but reloading the main.xml, to use the layout-land Now I have an

How to store edit text data from an Android dialog?

半城伤御伤魂 提交于 2019-12-13 16:18:45
问题 I've set up an alert dialog with multiple edit texts but I'm not sure how to store the values being entered in the alert dialog. Usually I could just do something along the lines of this: final EditText input = new EditText(this); alert.setView(input); Editable value = input.getText(); But my MessageDialog is a separate class being called from SearchResult.java like this, so I don't know how to access instances of the edit texts in the MyMessageDialog.java: MyMessageDialog.displayMessage

Dynamic inflating gives me a nullexception

≯℡__Kan透↙ 提交于 2019-12-13 10:41:09
问题 I'm making a layout with a LinearLayout. This layout will have another layout inflated inside. Currently, I'm getting problems (nullexceptions) with that. My inflating code is the next: private void addLayoutInvoices() { LinearLayout ll_invoices = new LinearLayout(getActivity()); ll_invoices.setGravity(Gravity.CENTER); ll_invoices.setOrientation(LinearLayout.VERTICAL); LinearLayout.LayoutParams llp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout

Unable to inflate a layout on button click

断了今生、忘了曾经 提交于 2019-12-13 08:22:36
问题 Hi I am trying to show a layout when a button is pressed but the layout is never shown. No exception is thrown for some reason. The button is located inside an activity. The button is called and declared and it works. The calling of the layout is just additional action to the button. Here is my code to inflate the layout: LayoutInflater layoutInflater = (LayoutInflater)getApplicationContext().getSystemService(LAYOUT_INFLATER_SERVICE); View error = layoutInflater.inflate(R.layout.error_search

Android Adding view from inflate layout and how to update particular textview value in layout

元气小坏坏 提交于 2019-12-13 08:11:42
问题 I have created view from inflating separate layout. I used for loop to create view more than 5 view like an ListView. Here I want call balance check. Inside view, I will click balance button and once receive response from server, I want to update particular TextView in an existing created view. Any help? I am expecting same for phonepe app balance checking page. while scrolling also, it should not hide the updated balance. My Ref stack link: Updating a textview in different layout xml from

Android inflate view multiple time depending on button state - optimisation

拈花ヽ惹草 提交于 2019-12-13 07:56:23
问题 StackOverflow community, I need your help (again) ! I created a custom class to quickly create View object (basically it's just a question displayed). Exemple : Title : Home Message : Are you living with a cat ? [BtnYes] ------------------------ [BtnNo] So here is my custom class "QuestionHelper" to create question programmatically : public List<LinearLayout> addQuestion(ViewGroup rootView, String title, String message, int id) { List<LinearLayout> mButtons = new ArrayList<>(); // Inflate une

Issue Filling Parent View When Inflating Linear Layout

自作多情 提交于 2019-12-13 05:31:33
问题 The LinearLayoutOutlined class I'm using is from this answer with only a few small edits for color. This is what my current activity looks like. There is a horizontal scroll view in the center that I want to fill with items by putting them in the layout_holder . This is the xml layout for the page: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:configChanges="keyboardHidden|orientation|screenSize" android:layout

AutoCompleteTextView over MapsFragment

≯℡__Kan透↙ 提交于 2019-12-13 04:38:15
问题 In my app I have a RelativeLayout->fragment(SupportMapFragment)|Relativelayout->AutoCompleteTextView The search should do what Google Maps' search bar should do and return a dropdown list of locations from my search keyword. After I finish typing and a few second delay, my app crashes with the error: 12-12 21:59:13.138 25010-25010/com.hudsoncorp.zahudson.roadtrip E/AndroidRuntime: FATAL EXCEPTION: main 12-12 21:59:13.138 25010-25010/com.hudsoncorp.zahudson.roadtrip E/AndroidRuntime: Process: