I am new to android. Developing an app on wallpapers. Wallpapers are setting nicely to background. I want to edit a text in it. For example when we click the button to set wallpaper then it should show text on screen that wallpaper has set. Plz help to resolve this problem. Here is main java.
public class Main extends Activity {
private ImageView hImageViewPic;
private Button iButton, gButton;
private int currentImage = 0;
int[] images = { R.drawable.r1, R.drawable.r2, R.drawable.r3, R.drawable.r4, R.drawable.r5, R.drawable.r6, R.drawable.r7, R.drawable.r8, R.drawable.r9, R.drawable.r10 };
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
hImageViewPic = (ImageView)findViewById(R.id.idImageViewPic);
iButton = (Button) findViewById(R.id.bNext);
gButton = (Button) findViewById(R.id.bPrev);
//Just set one Click listener for the image
iButton.setOnClickListener(iButtonChangeImageListener);
gButton.setOnClickListener(gButtonChangeImageListener);
}
View.OnClickListener iButtonChangeImageListener = new OnClickListener() {
public void onClick(View v) {
//Increase Counter to move to next Image
currentImage++;
currentImage = currentImage % images.length;
hImageViewPic.setImageResource(images[currentImage]);
}
};
View.OnClickListener gButtonChangeImageListener = new OnClickListener() {
`public void onClick(View v) {
//Increase Counter to move to next Image
currentImage--;
currentImage = (currentImage + images.length) % images.length;
hImageViewPic.setImageResource(images[currentImage]);
// Button for wallpaper setting
Button bSetWallpaper=(Button) findViewById (R.id.bSet);
imageView imagePreview=(imageView) findViewById(R.id.idImageViewPic);
imagePreview.setOnClickListener (images [currentImage]);
bSetWallper.setOnClickListener (new Button.onClickListener (){
@Override
public void onClick (View arg0){
WallpaperManager myWallpaperManager = WallpaperManager.getInstance (getApplicationContext ());
try {
myWallpaperManager.setResource (images [currentImage]);
} catch (IOException e) {
e.printStackTrace ();
}
}
});
}
};
}
So plz help in showing text. `
You want something like this?