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. How to add buttons in StatusBar..

hi..

we're making the PMP on Android platform..

,, our PMP don't have hard buttons...

so, I want to add soft buttons in Statusbar...

buttons that we want are 'HOME','MENU' and 'BACK' keys... They are always
visible even any Activities are running..

For example....  ARCHOS5 (Android Tablet) has that function. it has a
buttons in Statusbar...


My Development Env is.. Ubuntu 9.04 and  Downloaded Android 2.1 Eclair..

Please Give me HINTs....

I studied Frameworks and StatusBarPolicy.java.... StatusBarService......
Icons.....  but, I can't find the solution...

Help me.... Plz.....

Thanks...

-- 

2. "You do not have permission to open this page"

I am developing a MySpace app on android and I'm using the sample from
OpenSocial java SDK. Using the various OAuth and OpenSocial API's I am
getting the log on page for MySpace. However when I log in to my
account, I am getting the below message:
 "You do not have permission to open this page"

img210.imageshack . us/img210/4938/devicena.png (remove spaces)

I'm not sure what this means.

I have created a server and placed the RelayReceiver.html file at the
root and given the URL in theMySpaceId edit details page. Still
getting the same error above. Any idea what this error is about?

 Thanks,

3. How to store and retrieve email id and password using SharedPreferences?

4. Some application / market questions

5. InCallScreen activity failed to start when an MT call was received while BT headset is connected.

6. gears and android 2.X

7. Layout issues for multiple screen sizes and API versions