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







>



Other Threads

1. Android Versus iPhone Silly Comparisons

It's easy to argue this in either direction, but that's silly.  The
best thing that any of us can do is to develop for both of them and
cheer for both of them.  Google wants the iPhone to succeed just as
much as Android.  We need the best convergent devices possible.  As
the good books says "Steel sharpens steel."  If you need to go after
something try Symbian or Windows Mobile, those have been holding us
back.
--~--~---------~--~----~------------~-------~--~----~

2. Error when add an account

Hi


 When i set the acount in Dev Tool.I got error message "The username or
password is not valid"
(Eventhough i give the valid username and password)



Can you please tell me,What is the solution for the problem?


Thanks
judy

--~--~---------~--~----~------------~-------~--~----~

3. How to compute the size of a string in pixel

4. How to draw Bitmap outside of onDraw()

5. About DevTool

6. Look and Feel, Example, Spinner: more parameters or source code?

7. ook and feel, Spinner,... source code or more parameters?