bouton appli
This commit is contained in:
parent
afdd8ae173
commit
927d2cd19f
1 changed files with 53 additions and 0 deletions
53
Appli/Main2Activity.java
Normal file
53
Appli/Main2Activity.java
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
package com.example.nicolas.myapplication;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.provider.MediaStore;
|
||||||
|
import android.support.v7.app.AppCompatActivity;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.Button;
|
||||||
|
|
||||||
|
public class Main2Activity extends AppCompatActivity {
|
||||||
|
|
||||||
|
Button button_map;
|
||||||
|
Button button_photo;
|
||||||
|
Button button_gallery;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_main2);
|
||||||
|
|
||||||
|
button_gallery = findViewById(R.id.button_gallery);
|
||||||
|
button_map = findViewById(R.id.button_map);
|
||||||
|
button_photo = findViewById(R.id.button_photo);
|
||||||
|
|
||||||
|
button_gallery.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
Intent intent = new Intent(Intent.ACTION_VIEW, null);
|
||||||
|
intent.setType("image/*");
|
||||||
|
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
startActivity(intent);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
button_photo.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
|
||||||
|
if (intent.resolveActivity(getPackageManager()) != null) {
|
||||||
|
startActivityForResult(intent, 0);
|
||||||
|
}
|
||||||
|
}});
|
||||||
|
|
||||||
|
button_map.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.google.com/maps/search/?api=1&query=47.5951518,-122.3316393"));
|
||||||
|
startActivity(intent);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue