Hi All,
I am baffling with below issue. Out of three buttons, save button is
not working and its onclick is not hitting. Any idea anyone. below
code and XML i am using.
setContentView(R.layout.myimageview);
mImageView = (ImageView) findViewById(R.id.imageview);
mImageView.setDrawingCacheEnabled(true);
mImageView.setImageResource(param1);
mslideshow = (ImageButton)findViewById(R.id.slideshow);
mSave = (ImageButton)findViewById(R.id.msave);
mslideshow.setOnClickListener(new OnClickListener() {
public void onClick(View view) {
Intent MyIntent = new Intent(myimageview.this,
slideshowview.class);
startActivity(MyIntent);
}
});
mSave.setOnClickListener(new OnClickListener() {
public void onClick(View view) {
saveWallpaperToSD(saveFile+".png");
updateExternalStorageState();
}
});
msetwallpaper = (ImageButton) findViewById(R.id.setwallpaper);
msetwallpaper.setOnClickListener(new OnClickListener() {
public void onClick(View view) {
wallpaperManager.setWallpaperOffsetSteps(0.5f,
0.5f);
wallpaperManager.setWallpaperOffsets(view.getRootView().getWindowToken(),
0.5f, 0.5f);
//wallpaperManager.suggestDesiredDimensions(320,
480);
try {
wallpaperManager.setBitmap(mImageView.getDrawingCache());
} catch (IOException e) {
// TODO Auto-generated catch
block
e.printStackTrace();
}
finish();
}
});
XML:
<?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"
android:background="@drawable/inner_bg"
>
<ImageView
android:layout_width="fill_parent"
android:layout_height="435dp"
android:id="@+id/imageview"
android:adjustViewBounds="true"
android:gravity="center"/>
<ImageButton
android:id="@+id/setwallpaper"
style="@android:style/Widget.Button.Inset"
android:src="@drawable/btn_setwallpaper"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/imageview"
android:layout_alignLeft="@+id/imageview"
/>
<ImageButton
android:id="@+id/msave"
style="@android:style/Widget.Button.Inset"
android:src="@drawable/btn_save"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/imageview"
android:layout_alignLeft="@+id/slideshow"
android:layout_alignRight="@+id/setwallpaper"
android:onClick="selfDestruct"
/>
<ImageButton
android:id="@+id/slideshow"
style="@android:style/Widget.Button.Inset"
android:src="@drawable/btn_slideshow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/imageview"
android:layout_alignRight="@+id/imageview"
/>
</RelativeLayout>
thanks,
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en