tuto Posted April 11, 2012 Share Posted April 11, 2012 package com.android.activate; import android.app.Activity; import android.app.AlertDialog; import android.content.DialogInterface; import android.os.Bundle; import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.widget.ImageButton; public class ActivateApplicationActivity extends Activity implements OnClickListener { /** Called when the activity is first created. */ // action id private static final int ID_UP = 1; private static final int ID_DOWN = 2; private static final int ID_SEARCH = 3; QuickAction quickAction; private ImageButton b; private ImageButton a; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); //setContentView(R.layout.main1); b = (ImageButton) this.findViewById(R.id.stop); b.setOnClickListener(this); a = (ImageButton) this.findViewById(R.id.start); ActionItem appel = new ActionItem(ID_DOWN, "Appeler", getResources() .getDrawable(R.drawable.call)); ActionItem sms = new ActionItem(ID_UP, "Envoyer message", getResources().getDrawable(R.drawable.sms)); ActionItem fermer = new ActionItem(ID_SEARCH, "Arreter application", getResources().getDrawable(R.drawable.ferme)); final QuickAction quickAction = new QuickAction(this,QuickAction.VERTICAL); // add action items into QuickAction quickAction.addActionItem(appel); quickAction.addActionItem(sms); quickAction.addActionItem(fermer); /*b.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { quickAction.show(v); } });*/ } /* /*a.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub quickAction.show(v); } });*/ /*a.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { quickAction.show(v); } });*/ @Override public void onClick(final View v) { // TODO Auto-generated method stub AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setMessage("Voulez vous activer Offolowme") .setCancelable(false) .setPositiveButton("oui", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { setContentView(R.layout.main1); } }) .setNegativeButton("Non", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }); // AlertDialog dialog = builder.create(); builder.show(); } public void clicker(View v) { //Log.i("message","message"); quickAction.show(v); /* a.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { quickAction.show(v); } });*/} } action. Link to comment Share on other sites More sharing options...
rubixcube Posted April 12, 2012 Share Posted April 12, 2012 C'est pas la bonne section, On ne met pas "svp aidé [color=red]mwa[/color] c urjent" dans son titre C'est illisible. De rien Link to comment Share on other sites More sharing options...
2beta Posted April 12, 2012 Share Posted April 12, 2012 https://forum.frandroid.com/forum/7-developpement/ Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.