[android-developers] sent a text message encrypted

2011-05-04 Thread jaafar zbeiba
hello I tried to send a sms encrypted, but the problem is no
exception, but the SMS does not start
code
public void onClick(View arg0) {
sendFeedback(ok);
r=DES.crypting(r+r, TELEPHONY_SERVICE);
EnvoiSms envoisms = new EnvoiSms();
   envoisms.SendMessage(r);
methode for crypto
public class DES{

protected static String crypting(String textToCrypting, String
keyString ) {
// Objet de cette classe offre des fonctionnalités pour
// Chiffrement et le déchiffrement.
Cipher cipher = null;
try {
// Paramètre DES spécifie le type de chiffrement que nous voulons
créer
// Par la méthode de l'usine. Il comprend l'algorithme, le mode et
// Remplissage. Vous pouvez définir seul algorithme et, dans ce cas
par défaut
// Valeurs seront utilisées pour la mode et de rembourrage.
cipher = Cipher.getInstance(DES);
} catch (NoSuchAlgorithmException ex) {
// Algorithme cryptographique demandé n'est pas disponible
ex.printStackTrace();
} catch (NoSuchPaddingException ex) {
// Demande un mécanisme de remplissage n'est pas disponible dans
l'environnement.
ex.printStackTrace();
}


// La longueur de keystring est de 8. Il est caractéristique
importante
// Pour le chiffrement

byte[] keyData = keyString.getBytes();

// Objet clé spécifie une clé secrète
// On utilise pour construire la clé secrète pour notre moteur de
chiffrement à partir d'un octet
// Tableau
SecretKeySpec key = new SecretKeySpec(keyData, 0, keyData.length,
DES);
try {
// Initialisation de la mise en place le type d'opération, c'est pour
être
// Utilisé pour. Dans ce cas - pour le chiffrement.
cipher.init(Cipher.ENCRYPT_MODE, key);
} catch (InvalidKeyException ex) {
// Donnée objet clé est inapproprié pour l'initialisation de ce
chiffre
ex.printStackTrace();
}


int cypheredBytes = 0;


byte[] inputBytes = textToCrypting.getBytes();
byte[] outputBytes = new byte[100];
try {
// Méthode doFinal crypte les données au tableau outputBytes.
//Chiffres pour inconnu ou grandes quantités de données mise à jour
méthode plus recommandé
// Nombre d'octets cryptés sauvegardés dans cypheredBytes variable
cypheredBytes = cipher.doFinal(inputBytes, 0, inputBytes.length,
outputBytes, 0);
} catch (IllegalStateException ex) {
ex.printStackTrace();
} catch (ShortBufferException ex) {
ex.printStackTrace();
} catch (IllegalBlockSizeException ex) {
ex.printStackTrace();
} catch (BadPaddingException ex) {
ex.printStackTrace();
}


String str = new String(outputBytes, 0, cypheredBytes);
inputBytes = str.getBytes();
return str;
}
// Changement d'état de l'objet de chiffrement pour le déchiffrement

protected static String decrypting(String textCrypting, String
keyString ) {
//Object of this class provides the functionality for
//encryption and decryption.
Cipher cipher = null;
try {
//parameter DES specifies type of cipher we want to create
//through the factory method. It includes algorithm, mode and
//padding. You can define only algorithm and in that case default
//values will be used for mode and padding.
cipher = Cipher.getInstance(DES);
} catch (NoSuchAlgorithmException ex) {
ex.printStackTrace();
} catch (NoSuchPaddingException ex) {
ex.printStackTrace();
}


//The lenght of keyString is 8. It's important characteristic
//for encryption

byte[] keyData = keyString.getBytes();

//key object specifies a secret key
//it uses to construct the secret key for our cipher object from a
byte
//array
SecretKeySpec key = new SecretKeySpec(keyData, 0, keyData.length,
DES);

try {
//change state of the cipher object for decrypting
cipher.init(Cipher.DECRYPT_MODE, key);
} catch (InvalidKeyException ex) {
ex.printStackTrace();

}
int cypheredBytes = 0;
byte[] inputBytes = textCrypting.getBytes();
byte[] outputBytes = new byte[1000];
try {
//decrypts data
cypheredBytes = cipher.doFinal(inputBytes, 0, inputBytes.length,
outputBytes, 0);
} catch (IllegalStateException ex) {

} catch (ShortBufferException ex) {

} catch (IllegalBlockSizeException ex) {

} catch (BadPaddingException ex) {

}

String str = new String(outputBytes, 0, cypheredBytes);
return str;
}

}

-- 
You received this message because you are subscribed to the Google

Re: [android-developers] Re: sent a text message encrypted

2011-05-04 Thread jaafar zbeiba
I myself doubt on this line  r=DES.crypting(r+r, TELEPHONY_SERVICE);

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] problem for send sms

2011-04-28 Thread jaafar zbeiba
I realize a sublist for example when a user clicks on an available
balance message will be sent to the server in the background but the
problem it gives me the sms application
appel function
if (position==4){
Boitedialog.bloc=8;
i1 =new Intent(this, EnvoiSms.class);
startActivity(i1);
}
function sms
import android.app.Activity;
import android.os.Bundle;
import  android.telephony.SmsManager;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

public class EnvoiSms extends Activity {

public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.sms);

Button btnEnvoie = (Button)findViewById(R.id.envoyer);

final EditText numero =(EditText)findViewById(R.id.numero);
final EditText message = (EditText)findViewById(R.id.message);

btnEnvoie.setOnClickListener(new OnClickListener() {

public void onClick(View v) {

String num =sms:// + 87012;
String msg =S;

if(num.length()= 4  msg.length()  0){



SmsManager.getDefault().sendTextMessage(num, null, msg, null,
null);

numero.setText();
message.setText();
}else{

Toast.makeText(EnvoiSms.this, Enter le 
numero et/ou le message,
Toast.LENGTH_SHORT).show();
}

}
});
}
}

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: problem for send sms

2011-04-28 Thread jaafar zbeiba
help me please

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] problem for send sms

2011-04-28 Thread jaafar zbeiba
I realize a sublist for example when a user clicks on an available
balance message will be sent to the server in the background but the
problem it gives me the sms application

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] problem for button

2011-04-13 Thread jaafar zbeiba
when I click ok nothing works
herre is my code
import android.app.Activity;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnKeyListener;
import android.widget.Button;
import android.widget.EditText;

public class main extends Activity implements OnClickListener,
OnKeyListener {

EditText editText1;
Button ok ;
String C ;

public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
   editText1= (EditText)findViewById(R.id.editText1);
ok= (Button)findViewById(R.id.ok);
editText1.setOnClickListener(this);
ok.setOnClickListener(this);
}

public void sendFeedback(View button) {

C = editText1.getText().toString();
}



@Override
public boolean onKey(View arg0, int arg1, KeyEvent arg2) {
// TODO Auto-generated method stub
return false;
}


@Override
public void onClick(View arg0) {
sendFeedback(ok);

}
}

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] problem for button

2011-04-13 Thread jaafar zbeiba
it's just a user types an amount

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] problem for button

2011-04-13 Thread jaafar zbeiba
c'est bon c est résolu

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] ListActivitiy

2011-04-06 Thread jaafar zbeiba
i wanna make an option on my account list that i block person(make it
disable) my problem is that i need a warning message to confirm the
operation;For example if I click it gives me a block account dialog
 !! O.o how to do it
code
import android.app.ListActivity;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class MainListActivity extends ListActivity  {

private static final int ITEM_VIEW_TYPE_VIDEO = 0;
private static final int ITEM_VIEW_TYPE_SEPARATOR = 1;
private static final int ITEM_VIEW_TYPE_COUNT = 2;

private static class Video {
public String title;
public String description;

public Video(String title) {
this(title, ok);
}

public Video(String title, String description) {
this.title = title;
this.description = description;
}
}

private static final Object[] OBJECTS = { Compte,
new Video(bloquer compte), new Video(débloquer le 
compte ),
new Video(changer code de sécurité par sms ),
new Video(Virement par SMS ),
new Video(Annuler Virement par SMS ),
new Video(consulter votre solde  ),





 opération fiançiére,
new Video(paipement par sms ), new Video(recharge 
fix et GSM),

new Video(chargement), new Video(Transfer Spécial 
par SMS),
 suvie
 };

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.liste);

setListAdapter(new VideoAdapter());
}

private class VideoAdapter extends BaseAdapter {

@Override
public int getCount() {
return OBJECTS.length;
}

@Override
public Object getItem(int position) {
return OBJECTS[position];
}

@Override
public long getItemId(int position) {
return position;
}

@Override
public int getViewTypeCount() {
return ITEM_VIEW_TYPE_COUNT;
}

@Override
public int getItemViewType(int position) {
return (OBJECTS[position] instanceof String) ?
ITEM_VIEW_TYPE_SEPARATOR
: ITEM_VIEW_TYPE_VIDEO;
}

@Override
public boolean isEnabled(int position) {
// A separator cannot be clicked !
return getItemViewType(position) != 
ITEM_VIEW_TYPE_SEPARATOR;
}

@Override
public View getView(int position, View convertView, ViewGroup
parent) {

final int type = getItemViewType(position);

// First, let's create a new convertView if needed. You 
can also
// create a ViewHolder to speed up changes if you want 
;)
if (convertView == null) {
final LayoutInflater inflater =
LayoutInflater.from(MainListActivity.this);
final int layoutID = type == 
ITEM_VIEW_TYPE_SEPARATOR ?
R.layout.separator_list_item : R.layout.video_list_item;
convertView = inflater.inflate(layoutID, 
parent, false);
}

// We can now fill the list item view with the 
appropriate data.
if (type == ITEM_VIEW_TYPE_SEPARATOR) {
((TextView) convertView).setText((String) 
getItem(position));
} else {
final Video video = (Video) getItem(position);
((TextView) 
convertView.findViewById(R.id.title))
.setText(video.title);
((TextView) 
convertView.findViewById(R.id.description))
.setText(video.description);
}

return convertView;
}

}
}

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this 

[android-developers] Re: ListActivitiy

2011-04-06 Thread jaafar zbeiba
i wanna make an option on my account list that i block person(make it
disable) my problem is that i need a warning message to confirm the
operation !! [image: O.o] how to do the link between my list of account and
this message

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] ListActivitiy

2011-04-06 Thread jaafar zbeiba
its clear

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] how to create a sublist?

2011-03-31 Thread jaafar zbeiba
I create a list but I don't know how to create a sublist it mean when
the user taps on such account there is another list
here is my list
package com.tutomobile.android.listView;

import java.util.ArrayList;
import java.util.HashMap;

import com.tutomobile.android.listView.R;

import android.app.Activity;
import android.app.AlertDialog;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;


import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.AdapterView.OnItemClickListener;

public class Tutoriel5_Android extends Activity {

private ListView maListViewPerso;


/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.liste);


maListViewPerso = (ListView) findViewById(R.id.listviewperso);


ArrayListHashMapString, String listItem = new
ArrayListHashMapString, String();


HashMapString, String map;


map = new HashMapString, String();

map.put(titre, compte);
map.put(description, information sur compte  );


listItem.add(map);



map = new HashMapString, String();
map.put(titre, opération);
map.put(description, les opérations );

listItem.add(map);

map = new HashMapString, String();
map.put(titre, suvui );
map.put(description, suvui de compte );

listItem.add(map);




SimpleAdapter mSchedule = new SimpleAdapter
(this.getBaseContext(), listItem, R.layout.affichageitem,
   new String[] {img, titre, description}, new int[]
{R.id.img, R.id.titre, R.id.description});


maListViewPerso.setAdapter(mSchedule);


maListViewPerso.setOnItemClickListener(new
OnItemClickListener() {
@Override
@SuppressWarnings(unchecked)
public void onItemClick(AdapterView? a, View v, int
position, long id) {

HashMapString, String map = (HashMapString, String)
maListViewPerso.getItemAtPosition(position);

AlertDialog.Builder adb = new
AlertDialog.Builder(Tutoriel5_Android.this);

adb.setTitle(Sélection Item);

adb.setMessage(Votre choix : +map.get(titre));

adb.setPositiveButton(Ok, null);

adb.show();
}
 });

}
}

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] how to create a sublist?

2011-03-31 Thread jaafar zbeiba
seek forgiveness but of example but I have not found a good example

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] how to create a sublist?

2011-03-31 Thread jaafar zbeiba
ok thank you for your help

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] sublist

2011-03-30 Thread jaafar zbeiba
thx but it just a list and I do not know or square sublist

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] problem for button

2011-03-30 Thread jaafar zbeiba
hello I have a problem in my code when I type the password and I click
enter it shows me an exception message
1 class main for password
package com.tutomobile.android.listView;




import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;

import android.app.Activity;

import android.os.Bundle;

import android.view.KeyEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnKeyListener;

import android.widget.Button;
import android.widget.EditText;


import android.widget.Toast;



public class main extends Activity implements OnClickListener,
OnKeyListener {
/** Called when the activity is first created. */
   /*Display display=null;*/
EditText password;
Button ok;


public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
password= (EditText)findViewById(R.id.password);
ok= (Button)findViewById(R.id.ok);

ok.setOnClickListener(this);
password.setOnClickListener(this);

final String TESTSTRING = new String(1234);

  // # Write a file to the disk #
  /* We have to use the openFileOutput()-method
   * the ActivityContext provides, to
   * protect your file from others and
   * This is done for security-reasons.
   * We chose MODE_WORLD_READABLE, because
   *  we have nothing to hide in our file */
  FileOutputStream fOut;
  try {
 fOut = openFileOutput(fichier.txt,
MODE_WORLD_READABLE);

  OutputStreamWriter osw = new OutputStreamWriter(fOut);

  // Write the string to the file
  osw.write(TESTSTRING);
  /* ensure that everything is
   * really written out and close */
  osw.flush();
  osw.close();
  } catch (FileNotFoundException e) {
 // TODO Auto-generated catch block
 e.printStackTrace();
  }
  // # Read the file back in #
  catch (IOException e) {
 // TODO Auto-generated catch block
 e.printStackTrace();
  }



}
   /*final EditText nameField = (EditText)
findViewById(R.id.editText);  */


   public void sendFeedback(View button) {


String name1 =password.getText().toString();
   /* System.out.print(name1=+name1);*/
 //nameField.getText().toString();
try {
FileInputStream fIn = openFileInput(fichier.txt);
 InputStreamReader isr = new InputStreamReader(fIn);
 /* Prepare a char-Array that will
  * hold the chars we read back in. */
 char[] inputBuffer = new char[name1.length()];
 // Fill the Buffer with data from the file

isr.read(inputBuffer);


String readString = new String(inputBuffer);


 if (readString.equals(name1)){
 Toast.makeText(this,Mot de passe
correct,Toast.LENGTH_SHORT).show();
  Tutoriel5_Android aa=new Tutoriel5_Android();
  aa.showDialog(BIND_AUTO_CREATE);
 } else{
  Toast.makeText(this,Mot de passe
Incorrect,Toast.LENGTH_SHORT).show();

 // Do click handling here
  }
 } catch (IOException e) {
  Toast.makeText(this,Une erreur est
survenue,Toast.LENGTH_SHORT).show();

e.printStackTrace();
 }
}


   @Override
   public boolean onKey(View arg0, int arg1, KeyEvent arg2) {
  // TODO Auto-generated method stub
  return false;
   }


   @Override

  public void onClick(View v) {
sendFeedback(ok);
}
}

public class Tutoriel5_Android extends Activity {

   private ListView maListViewPerso;

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);

//Récupération de la listview créée dans le fichier
main.xml
maListViewPerso = (ListView)
findViewById(R.id.listviewperso);

//Création de la ArrayList qui nous permettra de remplire
la listView
ArrayListHashMapString, String listItem = new
ArrayListHashMapString, String();

//On déclare la HashMap qui contiendra les informations
pour un item
HashMapString, String map;

//Création d'une HashMap pour insérer les informations du
premier item de notre listView
map = new HashMapString, 

[android-developers] encryption and decryption DES

2011-03-29 Thread jaafar zbeiba
hello I tried encryption of any errors I ecplise but the problem when
I run the emulator I get error message on exception
here is the code
[Code] package example.com.cryptage;

import java.security .*;
import javax.crypto .*;

/ /
/ / Encrypt and decrypt using private key algorithm THE DES

public class IN {

public static void main (String [] args) throws Exception {
/ /
/ / Check args and get plaintext
if (args.length! = 1) {
System.out.println (Usage: java PrivateExample text);
System.exit (1);
}

/ / Byte [] plainText = args [0]. GetBytes (UTF8);
String ss = Hello world, haris is here!
byte [] plainText ss.getBytes = ();
/ /
/ / Get private key OF
System.out.println (\ nStart OF Generating key);
KeyGenerator keygen = KeyGenerator.getInstance (DES);
keyGen.init (56);
Key key = keyGen.generateKey ();
System.out.println (Generating the Key Finish);
/ /
/ / Get cipher object and print OF The Provider
Cipher cipher = Cipher.getInstance (DES/ECB/PKCS5Padding);
System.out.println (\ n + cipher.getProvider (). GetInfo ());
/ /
/ / Encrypt using The Key And The plaintext
System.out.println (\ nStart encryption);
cipher.init (Cipher.ENCRYPT_MODE, key);
byte [] ciphertext = cipher.doFinal (plaintext);
System.out.println (Finish encryption:);
System.out.println (new String (ciphertext, UTF8));

/ /
/ / Decrypt ciphertext using the Same The key
System.out.println (\ nStart decryption);
cipher.init (Cipher.DECRYPT_MODE, key);
byte [] newPlainText cipher.doFinal = (ciphertext);
System.out.println (Finish decryption:);

System.out.println (new String (newPlainText, UTF8));
}
}
[/ Code]
here is the error in java
[Code] #
# A fatal error has Been Detected By The Java Runtime Environment:
#
# Internal Error (classFileParser.cpp: 3375), pid = 376, tid = 3568
# Error: ShouldNotReachHere ()
#
# JRE version: 6.0_24-b07
# Java VM: Java HotSpot (TM) 64-Bit Server VM (19.1-b02 mixed mode
windows-amd64 oops compressed)
# An error report File with more information is saved as:
# C: \ Users \ hp \ Encryption \ hs_err_pid376.log
#
# If You Would Like to submit a bug report, please visit:
# Http://java.sun.com/webapps/bugreport/crash.jsp
#
[/ Code]

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Re: encryption and decryption DES

2011-03-29 Thread jaafar zbeiba
sorry I'm still a beginner so what's the solution ?

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] crypto DES File

2011-03-29 Thread jaafar zbeiba
What is the encryption and decryption DES of file

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] sublist

2011-03-29 Thread jaafar zbeiba
how to create sublist android

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] sublist

2011-03-29 Thread jaafar zbeiba
what ?

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] sublist

2011-03-29 Thread jaafar zbeiba
yes you right i made a list but i don't know how to do or the sublist

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] sublist

2011-03-29 Thread jaafar zbeiba
here is my class but I placed or subliste exactly

public class List extends Activity {

private ListView maListViewPerso;

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.liste);


maListViewPerso = (ListView) findViewById(R.id.listviewperso);


ArrayListHashMapString, String listItem = new
ArrayListHashMapString, String();


HashMapString, String map;


map = new HashMapString, String();

map.put(titre, compte);



listItem.add(map);



map = new HashMapString, String();
map.put(titre, opération);
map.put(description, les opérations );

listItem.add(map);

map = new HashMapString, String();
map.put(titre, suvui );
map.put(description, suvui de compte );

listItem.add(map);




SimpleAdapter mSchedule = new SimpleAdapter (this.getBaseContext(),
listItem, R.layout.affichageitem,
   new String[] {img, titre, description}, new int[]
{R.id.img, R.id.titre, R.id.description});


maListViewPerso.setAdapter(mSchedule);


maListViewPerso.setOnItemClickListener(new OnItemClickListener() {
@Override
@SuppressWarnings(unchecked)
 public void onItemClick(AdapterView? a, View v, int position,
long id) {

HashMapString, String map = (HashMapString, String)
maListViewPerso.getItemAtPosition(position);

AlertDialog.Builder adb = new
AlertDialog.Builder(Tutoriel5_Android.this);

adb.setTitle(Sélection Item);

adb.setMessage(Votre choix : +map.get(titre));

adb.setPositiveButton(Ok, null);

adb.show();
}
 });

}
}

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] problem for button

2011-03-28 Thread jaafar zbeiba
I wanted to make a small application when client types their password
it has acceded list but the problem I find when I run list and
password at the same time
here is the code for two classes
Code: one class

public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
password= (EditText)findViewById(R.id.password);
ok= (Button)findViewById(R.id.ok);

ok.setOnClickListener(this);
password.setOnClickListener(this);

final String TESTSTRING = new String(1234);

FileOutputStream fOut;
try {
fOut = openFileOutput(fichier.txt,

MODE_WORLD_READABLE);

OutputStreamWriter osw = new OutputStreamWriter(fOut);


osw.write(TESTSTRING);


osw.flush();
osw.close();
} catch (FileNotFoundException e) {

e.printStackTrace();
}

catch (IOException e) {

e.printStackTrace();
}



}


public void sendFeedback(View button) {


 String name1 =password.getText().toString();

 try {
 FileInputStream fIn = openFileInput(fichier.txt);
InputStreamReader isr = new InputStreamReader(fIn);

char[] inputBuffer = new char[name1.length()];


isr.read(inputBuffer);


String readString = new String(inputBuffer);


if (readString.equals(name1)){
 Toast.makeText(this,Mot de passe
correct,Toast.LENGTH_SHORT).show();
 Tutoriel5_Android aa=new Tutoriel5_Android();
 aa.showDialog(BIND_AUTO_CREATE);
} else{
 Toast.makeText(this,Mot de passe
Incorrect,Toast.LENGTH_SHORT).show();


}
} catch (IOException e) {
 Toast.makeText(this,Une erreur est
survenue,Toast.LENGTH_SHORT).show();

e.printStackTrace();
}
}


@Override
public boolean onKey(View arg0, int arg1, KeyEvent arg2) {
// TODO Auto-generated method stub
return false;
}

code two class List

public class Tutoriel5_Android extends Activity {

private ListView maListViewPerso;

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);

//Récupération de la listview créée dans le fichier main.xml
maListViewPerso = (ListView) findViewById(R.id.listviewperso);

//Création de la ArrayList qui nous permettra de remplire la
listView
ArrayListHashMapString, String listItem = new
ArrayListHashMapString, String();

//On déclare la HashMap qui contiendra les informations pour
un item
HashMapString, String map;

//Création d'une HashMap pour insérer les informations du
premier item de notre listView
map = new HashMapString, String();
//on insère un élément titre que l'on récupérera dans le
textView titre créé dans le fichier affichageitem.xml
map.put(titre, compte);
//on insère un élément description que l'on récupérera dans le
textView description créé dans le fichier affichageitem.xml
map.put(description, opération de compte);
//on insère la référence à l'image (convertit en String car
normalement c'est un int) que l'on récupérera dans l'imageView créé
dans le fichier affichageitem.xml

//enfin on ajoute cette hashMap dans la arrayList
listItem.add(map);

//On refait la manip plusieurs fois avec des données
différentes pour former les items de notre ListView

map = new HashMapString, String();
map.put(titre, opération financière);
map.put(description, trasfert de solde);

listItem.add(map);

map = new HashMapString, String();
map.put(titre, Suvie);
map.put(description, partie wap);

listItem.add(map);



//Création d'un SimpleAdapter qui se chargera de mettre les
items présent dans notre list (listItem) dans la vue affichageitem
SimpleAdapter mSchedule = new SimpleAdapter
(this.getBaseContext(), listItem, R.layout.affichageitem,
   new String[] {img, titre, description}, new int[]
{R.id.img, R.id.titre, R.id.description});

//On attribut à notre listView l'adapter que l'on vient de
créer
maListViewPerso.setAdapter(mSchedule);

//Enfin on met un écouteur d'évènement sur notre listView

Re: [android-developers] problem for button

2011-03-28 Thread jaafar zbeiba
help me pleaseee

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Encrypt Files

2011-03-26 Thread jaafar zbeiba
hello I tried this code but I have a problem with the exception
code
import java.security.*;
import javax.crypto.*;

//
// encrypt and decrypt using the DES private key algorithm

public class PrivateExample {

   public static void main(String[] args) throws Exception {
  //
  // check args and get plaintext
  if (args.length != 1) {
 System.err.println(Usage: java PrivateExample text);
 System.exit(1);
  }

//byte[] plainText = args[0].getBytes(UTF8);
  String ss = Hello world, haris is here!;
  byte[] plainText = ss.getBytes();
  //
  // get a DES private key
  System.out.println(\nStart generating DES key);
  KeyGenerator keyGen = KeyGenerator.getInstance(DES);
  keyGen.init(56);
  Key key = keyGen.generateKey();
  System.out.println(Finish generating DES key);
  //
  // get a DES cipher object and print the provider
  Cipher cipher = Cipher.getInstance(DES/ECB/PKCS5Padding);
  System.out.println(\n + cipher.getProvider().getInfo());
  //
  // encrypt using the key and the plaintext
  System.out.println(\nStart encryption);
  cipher.init(Cipher.ENCRYPT_MODE, key);
  byte[] cipherText = cipher.doFinal(plainText);
  System.out.println(Finish encryption: );
  System.out.println(new String(cipherText, UTF8));

  //
  // decrypt the ciphertext using the same key
  System.out.println(\nStart decryption);
  cipher.init(Cipher.DECRYPT_MODE, key);
  byte[] newPlainText = cipher.doFinal(cipherText);
  System.out.println(Finish decryption: );

  System.out.println(new String(newPlainText, UTF8));
   }

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Re: Encrypt Files

2011-03-26 Thread jaafar zbeiba
which ?

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: Encrypt Files

2011-03-26 Thread jaafar zbeiba

logcat
03-26 13:25:57.117: INFO/DEBUG(27): debuggerd: Nov 24 2009 14:48:45
03-26 13:25:57.167: INFO/vold(26): Android Volume Daemon version 2.0
03-26 13:25:57.247: ERROR/vold(26): Error opening switch name path '/
sys/class/switch/test2' (No such file or directory)
03-26 13:25:57.247: ERROR/vold(26): Error bootstrapping switch '/sys/
class/switch/test2' (No such file or directory)
03-26 13:25:57.247: ERROR/vold(26): Error opening switch name path '/
sys/class/switch/test' (No such file or directory)
03-26 13:25:57.247: ERROR/vold(26): Error bootstrapping switch '/sys/
class/switch/test' (No such file or directory)
03-26 13:25:57.247: DEBUG/vold(26): Bootstrapping complete
03-26 13:25:57.357: DEBUG/qemud(34): entering main loop
03-26 13:25:57.567: DEBUG/qemud(34): fdhandler_accept_event: accepting
on fd 10
03-26 13:25:57.567: DEBUG/qemud(34): created client 0xe078 listening
on fd 8
03-26 13:25:57.597: DEBUG/qemud(34): client_fd_receive: attempting
registration for service 'boot-properties'
03-26 13:25:57.597: DEBUG/qemud(34): client_fd_receive:- received
channel id 1
03-26 13:25:57.607: DEBUG/qemud(34): client_registration: registration
succeeded for client 1
03-26 13:25:57.607: INFO/qemu-props(43): connected to 'boot-
properties' qemud service.
03-26 13:25:57.617: INFO/qemu-props(43): received:
dalvik.vm.heapsize=24m
03-26 13:25:57.617: INFO/qemu-props(43): received:
qemu.sf.lcd_density=160
03-26 13:25:57.617: INFO/qemu-props(43): received:
03-26 13:25:57.617: INFO/qemu-props(43): invalid format, ignored.
03-26 13:25:58.168: DEBUG/AndroidRuntime(29): 
AndroidRuntime START 
03-26 13:25:58.168: DEBUG/AndroidRuntime(29): CheckJNI is ON
03-26 13:25:58.387: DEBUG/qemud(34): fdhandler_accept_event: accepting
on fd 10
03-26 13:25:58.387: DEBUG/qemud(34): created client 0xe078 listening
on fd 11
03-26 13:25:58.387: DEBUG/qemud(34): fdhandler_event: disconnect on fd
11
03-26 13:25:58.417: DEBUG/qemud(34): fdhandler_accept_event: accepting
on fd 10
03-26 13:25:58.417: DEBUG/qemud(34): created client 0xe078 listening
on fd 11
03-26 13:25:58.417: DEBUG/qemud(34): client_fd_receive: attempting
registration for service 'gsm'
03-26 13:25:58.417: DEBUG/qemud(34): client_fd_receive:- received
channel id 2
03-26 13:25:58.427: DEBUG/qemud(34): client_registration: registration
succeeded for client 2
03-26 13:25:58.877: INFO/(30): ServiceManager: 0xac38
03-26 13:25:58.898: INFO/AudioFlinger(30): AudioFlinger's thread ready
to run for output 0
03-26 13:25:58.907: INFO/CameraService(30): CameraService started:
pid=30
03-26 13:25:58.927: DEBUG/AndroidRuntime(29): --- registering native
functions ---
03-26 13:25:59.307: INFO/Zygote(29): Preloading classes...
03-26 13:25:59.318: DEBUG/dalvikvm(29): GC freed 800 objects / 44048
bytes in 12ms
03-26 13:25:59.587: DEBUG/dalvikvm(29): GC freed 240 objects / 13920
bytes in 5ms
03-26 13:25:59.647: DEBUG/dalvikvm(29): GC freed 228 objects / 14376
bytes in 6ms
03-26 13:25:59.817: DEBUG/dalvikvm(29): GC freed 505 objects / 31896
bytes in 7ms
03-26 13:25:59.907: DEBUG/dalvikvm(29): Trying to load lib /system/lib/
libexif.so 0x0
03-26 13:25:59.918: DEBUG/dalvikvm(29): Added shared lib /system/lib/
libexif.so 0x0
03-26 13:25:59.918: DEBUG/dalvikvm(29): Trying to load lib /system/lib/
libFFTEm.so 0x0
03-26 13:25:59.927: DEBUG/dalvikvm(29): Added shared lib /system/lib/
libFFTEm.so 0x0
03-26 13:25:59.927: DEBUG/dalvikvm(29): Trying to load lib /system/lib/
libmedia_jni.so 0x0
03-26 13:26:00.107: DEBUG/dalvikvm(29): Added shared lib /system/lib/
libmedia_jni.so 0x0
03-26 13:26:00.107: DEBUG/dalvikvm(29): Trying to load lib /system/lib/
libmedia_jni.so 0x0
03-26 13:26:00.107: DEBUG/dalvikvm(29): Shared lib '/system/lib/
libmedia_jni.so' already loaded in same CL 0x0
03-26 13:26:00.107: INFO/dalvikvm(29): threadid=3: recursive native
library load attempt (/system/lib/libmedia_jni.so)
03-26 13:26:00.107: DEBUG/dalvikvm(29): Trying to load lib /system/lib/
libmedia_jni.so 0x0
03-26 13:26:00.107: DEBUG/dalvikvm(29): Shared lib '/system/lib/
libmedia_jni.so' already loaded in same CL 0x0
03-26 13:26:00.107: INFO/dalvikvm(29): threadid=3: recursive native
library load attempt (/system/lib/libmedia_jni.so)
03-26 13:26:00.107: DEBUG/dalvikvm(29): Trying to load lib /system/lib/
libmedia_jni.so 0x0
03-26 13:26:00.107: DEBUG/dalvikvm(29): Shared lib '/system/lib/
libmedia_jni.so' already loaded in same CL 0x0
03-26 13:26:00.107: INFO/dalvikvm(29): threadid=3: recursive native
library load attempt (/system/lib/libmedia_jni.so)
03-26 13:26:00.137: DEBUG/dalvikvm(29): GC freed 323 objects / 20144
bytes in 8ms
03-26 13:26:00.637: DEBUG/dalvikvm(29): GC freed 3536 objects / 168944
bytes in 21ms
03-26 13:26:00.687: DEBUG/dalvikvm(29): GC freed 133 objects / 8640
bytes in 15ms
03-26 13:26:00.768: DEBUG/dalvikvm(29): GC freed 518 objects / 31504
bytes in 20ms
03-26 13:26:00.827: DEBUG/dalvikvm(29): GC freed 175 objects / 9456
bytes in 15ms
03-26 13:26:00.867: DEBUG/dalvikvm(29): GC freed 222 objects / 

Re: [android-developers] Re: Encrypt Files

2011-03-26 Thread jaafar zbeiba
when I run the emulator it gives me an error message (the application
(process com.example )has stopped unexpectedly
but I gave me the code and also logcat

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] create password

2011-03-23 Thread jaafar zbeiba
I will like making a small application for
authentication
when launching the program a message display
type your
password

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] help me pleaseeeeee

2011-03-22 Thread jaafar zbeiba
no its not working that can help me I have more time for my project and
frankly I am not of this but still try dommaine

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] help me pleaseeeeee

2011-03-22 Thread jaafar zbeiba
thank you for your advice but I ask you for help and not a council

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] help me pleaseeeeee

2011-03-22 Thread jaafar zbeiba
I have not asked for the impossible

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] help me pleaseeeeee

2011-03-19 Thread jaafar zbeiba
hello I just created a code to input area password c is to say in
dermarage of the android must put his onscreen user password but the
problem in the code that I have no errors when I type in the edit text
area and I click ok nothing happens AC that can help me thank you
here is the code
ublic void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
editText= (EditText)findViewById(R.id.editText);
ok= (Button)findViewById(R.id.ok);
ok.setOnClickListener(this);
editText.setOnClickListener(this);

public void sendFeedback(View button) {
String name=1234;

 String name1 =chaine;
  //nameField.getText().toString();


if(name.equals(name1))
  Toast.makeText(this,Mot de passe
orrect,Toast.LENGTH_SHORT).show();
  else
 Toast.makeText(this,Mot de passe
Incorrect,Toast.LENGTH_SHORT).show();

   // Do click handling here
}

@Override
public boolean onKey(View arg0, int arg1, KeyEvent arg2) {
// TODO Auto-generated method stub
return false;
}

@Override
public void onClick(View v) {
// TODO Auto-generated method stub

}
}

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] JPasswordField under android

2011-03-11 Thread jaafar zbeiba
hello I use a JPasswordField but I have a problem with java.awt.event
and java.swing

package com.example.tuto;

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class  Password()  extends JFrame implements ActionListener {

JPasswordField pass;
JButton test = new JButton(get);

public Password(){
JPanel pane = new JPanel();
test.addActionListener(this);
pane.setLayout(new FlowLayout());
pane.add(pass = new JPasswordField(15));
pane.add(test);
setContentPane(pane);
setVisible(true);
}

public void actionPerformed(ActionEvent evt) {
Object source = evt.getSource();
if(source == test) {
char[] tet = pass.getPassword();
System.out.println(new String(tet));
}
}

public static void main(String[] args) {
Saisir p = new Saisir();
}

}
help me please thxx

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] the program made ​​the application will have a password

2011-03-11 Thread jaafar zbeiba
hello please i need help it's true I'm just starting my project in
addition to end of study and already I'm playing against the clock I
have more time thank you
I actually like making a small application that will allow me
authentication
when launching the program made ​​the application will have a
password, for example
password: test

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] How to use Native Activity and View from Java

2011-03-11 Thread jaafar zbeiba
I use a JPasswordField but I have a problem with java.awt.event java.swing
and that can help me
com.example.tuto package;

import javax.swing .*;
import java.awt .*;
import java.awt.event .*;

public class Input extends JFrame implements ActionListener {

JPasswordField pass;
JButton test = new JButton (get);

public Password () {
JPanel pane = new JPanel ();
test.addActionListener (this);
pane.setLayout (new FlowLayout ());
pane.add (pass = new JPasswordField (15));
pane.add (test);
setContentPane (pane);
setVisible (true);
}

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en