help with the wallpaper app?

Asked

Viewed 50 times

0

I’m having trouble with my app that puts wallpaper on mobile, in my programming I managed to put 1 image and I managed to put the button that adds the app wallpaper on mobile, but I want to put an image galleries with photos I choose, and put the option to open the image and adjust. I’ve tried using the Picasa method but the Picasa is retired and I don’t know how I’m going to do it.

I’ll leave my code below.

Mainactivity

  Button bnt;
ImageView img;


@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    bnt = (Button) findViewById(R.id.setwall);
    img = (ImageView) findViewById(R.id.img);

    bnt.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            WallpaperManager wallmgr = WallpaperManager.getInstance(getApplicationContext());
            try {
                wallmgr.setResource(+ R.drawable.zisa);
            } catch ( IOException e){
                e.printStackTrace();
            }
        }
    });

}

activity_main.xml

   <Button
    android:layout_width="368dp"
    android:text="Ativar papel de parede"
    android:id="@+id/setwall"
    android:layout_height="wrap_content"
    app:layout_constraintRight_toRightOf="parent"
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintTop_toTopOf="parent"
    app:layout_constraintVertical_bias="0.814" />



<ImageView
    android:id="@+id/img"
    android:layout_width="0dp"
    android:layout_height="0dp"
    android:src="@drawable/zisa"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintHorizontal_bias="0.0"
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintRight_toRightOf="parent"
    app:layout_constraintTop_toTopOf="parent"
    app:layout_constraintVertical_bias="0.0" />
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.