I am trying to inflate
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<Item android:id="@+id/ltArr"
android:layout_alignParentLeft="true"
android:icon="@android:drawable/arrow_up_float"/>
<TextView android:id="@+id/ImText"
android:layout_toRightOf="@id/ltArr"/>
<Item android:layout_alignParentRight="true"
android:layout_toRightOf="@id/ImText"
android:icon="@android:drawable/arrow_down_float"/>
</RelativeLayout>
In a procedure I am calling addTextView, and it is in a try catch block
try{
addTextView("Showtext", intID, addtothisLayout);
}catch (Exception ex){}
When inflating the layout above in the addText procedure there is a exception which is caught above, execution gets sent back to the catch in the calling procedure
void addTextView(String showTxt,integer id, ViewGroup addtoparent)
{
View itemview = View.inflate(this, R.layout.itemlayout, addtoparent); //this causes the exception
..
..
}
Why when the exception is thrown can I not see anything in the ex variable?
Am I trying something silly ?
How do I see what the exception says? I have tried inspecting the exception ex variable as teh debugger passes over it but it does not have anything in it. If I was using a SQL in the procedure. I’d specifically throw SQLException and that would allow me to see the error description but here I dont know what to throw … ?
I’ve found reference to a resource not available exception in LogCat by removing the try catch clauses. But how do I catch those descriptions in the try ex var? Do I have to throw specific exceptions?
OK this is my answer, I was trying to inspect the declaration of the variable and needed to put something in the code block. “ex.toString()”
catch (Exception ex){
ex.toString();
}
Thank all for the very prompt replies.
When I run it on an AVD 2.3.3 emulator I’m getting:
That is, “Item” is not recognized as a view.