Android studio throws "Too much output to process error" on debug - android

Android studio throws "Too much output to process error" on debug.
I just started working on android development and trying to debug using my nexus 5 as a connected device.
Being a novice, I thought it was a memory issue and even closed all the background applications. In my single activity I am just displaying a background image and a button.
Please have a look at the layout xml...
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/backgroundimage"
android:weightSum="5"
android:orientation="vertical">
<LinearLayout
android:layout_height="0dp"
android:layout_width="match_parent"
android:layout_weight="1"
android:background="#C9BDBD"
android:padding="5dp">
<Button
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textSize="20dp"
android:background="#6C7B8B"
android:textColor="#000000"
android:text="Become An Android Developer"
android:onClick="Congratulations!!! You are now initiated.."/>
</LinearLayout>

your Button's android:onClick should be a method in the Java code.
<Button
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textSize="20dp"
android:background="#6C7B8B"
android:textColor="#000000"
android:text="Become An Android Developer"
android:onClick="Congratulations!!! You are now initiated.."/>
something like
android:onClick="doSomthing"/>
and in the Java code:
public void doSomthing(View v){
...
...
...
}

As far as "too much output..." issue is concerned, you can mostly ignore it. Still it would make sense if you remove some of the really unnecessary Log lines from your code, especially from methods that are called repeatedly and frequently.
Another thing, i believe you want to show a text "Congratulations!!! You are now initiated.." when user clicks on button.
So change your xml's android:onClick to android:onClick= "myButtonClicked"
In the activity, implement this function
public void myButtonClicked(){
}
Finally, show the text "Congratulations!!! You are now initiated.." either via dialog (e.g. alertDialog) or in some textView

You may have selected "No Filters" in android monitor which causes "Too much output to process error", Change it to "Show only selected Application" then all other Log line are filtered and will not show in Logcat.

Related

In Android: How to Force refresh (update) of a TextView that is INSIDE a Dialog Window?

This is probably a basic procedure, and in fact I've been extensively searching for a suitable answer, but I haven't found anything usable or that actually works. Now, the case:
A Dialog window is placed inside a method:
public void method_with_Dialog_code() {
Dialog simpleDialog = new Dialog(this, R.style.FilterDialogTheme);
simpleDialog.setContentView(R.layout.dialog_xml_layout);
simpleDialog.setCancelable(true);
TextView insideTextView = (TextView) simpleDialog.findViewById( R.id.insidetextview );
insideTextView.setText("This text should change when the WiFi is offline");
simpleDialog.show();
}
The respective dialog_xml_layout.xml file is simply:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="#+id/insidetextview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center" />
</LinearLayout>
If the device is for example disconnected from the Internet, it generates a message that should be shown in the insideTextView. But notice that simpleDialog and insideTextView are inside the method, so they are local objects, so the first issue is how to execute:
insideTextView.setText("This device is now offline");
from another part of the code, that is, outside of the method?
If I decide to make simpleDialog and insideTextView as Global variables, I can with no problem, from another part of the program, set the line:
insideTextView.setText("This device is now offline");
But the instruction doesn't work. The TextView is never updated with the new message.
So, any ideas? Maybe with TextView.addTextChangedListener, so insideTextView could be updated when the TextView.setText is executed externally?
Gracias.
make insideTextView a member variable of the class and use it later.

Edit .xml using simple requests

What I need to do is, give the app into hands of a non-programmer and make it simple for him to edit the xml and java files. To do that I thought maybe sending a simple request (such as, add product(name, description, price)) through some portal could edit the xml file and java file. For example, I need to repeat the similar code every time a new product request is posted:
activity_main.xml
<LinearLayout
android:id="#+id/hw5"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:padding="10dp"
android:clickable="true"
android:orientation="vertical">
<ImageView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:src="#mipmap/ic_launcher"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Hardware 5"
android:textColor="#000000"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="$-"/>
</LinearLayout>
MainActivity.java
LinearLayout hw5;
hw5 = (LinearLayout) findViewById(R.id.hw5);
hw5.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
Intent hw5 = new Intent(MainActivity.this, Hw5.class);
startActivity(hw5);
}
});
Thanks!
What you might be looking for here is a domain-specific XML file paired with an appropriate XSL transformation. The XML file that the non-technical person would be editing would define the business entities, relationships with them and potential actions performed on them. The XSL transformation would convert this into application code at build time.
While this is not a common approach, it is rather robust. Keep in mind tho, that such an approach is difficult to maintain and requires that your business logic is mature enough before implementation.

Algolia Android initial search is really slow

I recently implemented Algolia on my app successfully just like the examples.
But the initial search takes about 5 to 7 seconds and I couldn't find a way to make it faster after checking the whole library code and documentation. After the initial search, search becomes very fast.
There is nothing unusual in my implementation but maybe you can see something that I don't. The following code is from the activity where I initialize Algolia:
Searcher searcher = new Searcher(ALGOLIA_APP_ID, ALGOLIA_SEARCH_API_KEY, ALGOLIA_INDEX_NAME);
searcher.setQuery(new Query("word").setExactOnSingleWordQuery(Query.ExactOnSingleWordQuery.ATTRIBUTE));
searcher.addNumericRefinement(new NumericRefinement("CountryId", NumericRefinement.OPERATOR_EQ, 1));
InstantSearch helper = new InstantSearch(this, searcher);
helper.setSearchOnEmptyString(false);
helper.search();
And this is the related xml layout:
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="6dp"
android:paddingRight="10dp"
android:paddingLeft="1dp"
android:paddingTop="6dp">
<com.algolia.instantsearch.ui.views.SearchBox
android:id="#+id/searchBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:queryHint="#string/search_text_hint"
algolia:searchIcon="#drawable/icn_search_big"
algolia:closeIcon="#drawable/icn_clear_filled_big"
android:queryBackground="#drawable/sarch_query_shape"
android:background="#drawable/search_shape"
algolia:autofocus="true"
algolia:submitButtonEnabled="false" />
</FrameLayout>`
<com.algolia.instantsearch.ui.views.Hits
android:id="#+id/hits"
android:layout_width="match_parent"
android:layout_height="match_parent"
algolia:autoHideKeyboard="true"
algolia:hitsPerPage="6"
android:layout_below="#+id/searchBarParentLayout"
algolia:infiniteScroll="false"
algolia:itemLayout="#layout/search_item_algolia_row"/>
Do you have any idea what can be the issue here?
I'm glad that the issue disappeared when you switched to another wifi.
For future readers that may encounter network issues with InstantSearch Android:
First of all, build and run one of our demo applications
If you see no problem running the example application, you can try using a proxy like Charles to investigate what's happening between your app and the network
If your problem persists when running the examples, or if you are following the documentation, send an email to support#algolia.com describing the issue with a sample of your code!

MigLayout for design android Forms

I am on a project. My instructor has told me to use MigLayout to design the forms in android. I am finding it difficult to find proper examples and while Using Eclipse for development its showing errors that android perfix is required to use the attributes.
please help me with some examples..
code that i pasted from the source site,mig4android.
<com.saynomoo.mig4android.MigLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
layout_constraints="wrap 4, debug 1"
column_constraints="[]15[75px]25[min]25[]"
row_constraints="[]15"
>
<TextView android:text="label1" component_constraints="skip"/>
<TextView android:text="label2" />
<TextView android:text="label3" component_constraints="wrap"/>
<TextView android:text="label4" />
<TextView android:text="label5" component_constraints="wmin 30"/>
<TextView android:text="label6" component_constraints="wmin 30"/>
<TextView android:text="label7" component_constraints="wmin 30"/>
</com.saynomoo.mig4android.MigLayout>
The component_constraints gave the error
This error means you forget to add android word before any attribute in xml file.
For example-
id="#+id/my_location"
You need to write android before id like below.
android:id="#+id/my_location"
Your code is perfect. But "skip" in component_constraints appears to be ignored. I had to manually add place holder to the layout to "fill in" empty spots. I tried "skip 1" and that also had no impact.
For more information see following link.
Skip as a constraint is not working

Android XML Error - First App - NetBeans

I've just started this evening into developing my first Android app and have come across an error that for the life of me I can't see where is coming from
When i launch my test app in the emulator it force closes with the error "The application Test App (psrocess Test.App) has stopped unexpectedly. Please try again."
So far I've checked: The Android Development output - nothing untoward,launches fine and locates activity and intent
The Emulator output - nothing reported at all
The TestApp debug - reports BUILD SUCCESSFUL
I proceeded to then examine the main.xml used for the layout and on validation in NetBeans it reports "cvc-elt.1: Cannot find the declaration of element 'LinearLayout'"
My main.xml looks like this:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:orientation="vertical" >
<Button
android:id="#+id/used_cars"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/used_cars" />
<Button
android:id="#+id/used_vans"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/used_vans" />
<Button
android:id="#+id/dealers"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/dealers" />
</LinearLayout>
I've trawled for info on how to fix this and can't find an answer
Could someone be kind enough to please advise if i'm missing something fundamental?
Thanks in advance
Barry
I've went through the logcat info and found nothing so i decided to create a new app from scratch and copy over the info and it runs fine
If i do find any other info on what caused the issue i'll be sure to post it up
I can only put it down to a config error atm
Kind Regards
Barry

Categories

Resources