- Shows s JPEG image.
- Display a button over the image that allows the user to set the image to their wallpaper.
- Auto resizes the image to the users specific Android phone display size.
- Removes the wallpaper if the app is uninstalled.
I can do step 1 and 2 pretty easy i'm just stuck with the other two steps can anyone point me in the right direction. here is the code so far
public class MainActivity extends Activity implements OnClickListener {
ImageView iv;
Button b;
Intent i;
Bitmap bmp;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
initialize();
InputStream is = getResources().openRawResource(R.drawable.image);
bmp = BitmapFactory.decodeStream(is);
}
private void initialize(){
iv = (ImageView) findViewById(R.id.ivReturnedPic);
b = (Button) findViewById(R.id.bSetWallpaper);
b.setOnClickListener(this);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
switch(v.getId()){
case R.id.bSetWallpaper:
try {
getApplicationContext().setWallpaper(bmp);
} catch (IOException e) {
e.printStackTrace();
}
break;
}
}
}