setImageResource fails and closes the application unexpectedly !

by Sasikumar Gandhi » Thu, 01 Apr 2010 07:26:06 GMT


Sponsored Links
 Hi-

I am trying to display the image on the ImageView object. But the
setImageResource
fails to display the image.

Here is my XML file looks like:


<?xml version=*"1.0"* encoding=*"utf-8"*?>

<LinearLayout xmlns:android=*" http://schemas.android.com/apk/res/android" ;
*

android:orientation=*"vertical"
*

android:layout_width=*"fill_parent"
*

android:layout_height=*"fill_parent"*>

<FrameLayout

android:orientation=*"vertical"
*

android:layout_width=*"fill_parent"
*

android:layout_height=*"fill_parent"
*

android:layout_weight=*"1"*>

<ImageView

id=*"@+id/batteryLevelview"*

android:layout_width=*"wrap_content"*

android:layout_height=*"wrap_content"*

android:layout_gravity=*"center"*/>

</FrameLayout>

</LinearLayout>

Here is my code:

@Override

*public* *void* onCreate(Bundle savedInstanceState) {

*super*.onCreate(savedInstanceState);

setContentView(R.layout.*main*);

ImageView batteryLevelImage = (ImageView) findViewById(R.id.*
batteryLevelview*);

batteryLevelImage.setImageResource(R.drawable.*notconnected*);

}

I could not find what's wrong. I tried using the LinearLayout and that did
not help. Please help me what's wrong.

thanks,

--



setImageResource fails and closes the application unexpectedly !

by Sasi » Thu, 01 Apr 2010 07:35:23 GMT


 Hi-

I am trying to display the image on the ImageView object. But the
setImageResource fails to display the image. If it succeeds, I would
like to update image on ImageView object based on some criteria.

Here is my XML layout file looks like:

<?
xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android=" http://schemas.android.com/apk/res/ 
android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<FrameLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1">
<ImageView
id="@+id/batteryLevelview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"/>
</FrameLayout>
</LinearLayout>

Here is my code:

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
ImageView batteryLevelImage = (ImageView)
findViewById(R.id.batteryLevelview);
batteryLevelImage.setImageResource(R.drawable.notconnected);
}

I could not find what's wrong. I tried using the LinearLayout and that
did not help. Please help me what's wrong.

thanks,

--


Sponsored Links


setImageResource fails and closes the application unexpectedly !

by madmax » Thu, 01 Apr 2010 15:11:02 GMT


 Can u put the error log here please so that i can know what the actual
error u get is...


   Peace,
    Prafull.




--



setImageResource fails and closes the application unexpectedly !

by nayana urs » Thu, 01 Apr 2010 19:06:54 GMT


 hiiii all
am doing photo editting application am able to edit images but not getting
how to save it can anyone please let me know how to do it
with regards
   Nayana






>



setImageResource fails and closes the application unexpectedly !

by Sasi » Fri, 02 Apr 2010 05:29:04 GMT


 Can you please let me know where can I find the error log? I am new to
android development.

thanks,
Sasi





--



setImageResource fails and closes the application unexpectedly !

by Mark Murphy » Fri, 02 Apr 2010 05:31:37 GMT


 


Use adb logcat, DDMS, or the DDMS perspective in Eclipse to view the
Java stack trace associated with unhandled exceptions.

-- 
Mark Murphy (a Commons Guy)
 http://commonsware.com  |  http://twitter.com/commonsguy 

Android Training...At Your Office:  http://commonsware.com/training 

--



setImageResource fails and closes the application unexpectedly !

by nayana urs » Fri, 02 Apr 2010 23:08:33 GMT


 hiiii all
am doing photo editting application am able to edit images but not getting
how to save it can anyone please let me know how to do it
with regards
   Nayana







>