help in wallpaper application?

0

I'm having problems in my application that puts wallpaper on the phone, in my programming I managed to put 1 image and managed to put the button that adds the wallpaper of the application on the phone, but I want for a galleries of pictures with pictures that I choose, and put the option to open the image and adjust. I have already tried using the picasa method but the picasa is retired and I do not know how I will 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" />
    
asked by anonymous 03.01.2018 / 03:29

0 answers