Aller au contenu

Urgent , Aide code java android


Recommended Posts

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.

Lien vers le commentaire
Partager sur d’autres sites

Archivé

Ce sujet est désormais archivé et ne peut plus recevoir de nouvelles réponses.

×
×
  • Créer...