Re: [android-developers] Help about the query which i encountered while coding.

2015-12-24 Thread TreKing
On Sat, Dec 5, 2015 at 7:26 AM, Gaurav Rane  wrote:

> how to add images from camera as well as from gallery in a listview and
> the limit of images in list must be 10 and also image can be deleted from
> the particular list,how i can achieve it in android? pls help me iam new
> to android development.
>

You would start by reading solid book on Android and / or going through the
official docs at developer.android.com.
Do some sample projects to get your feet wet, learn about ListView (and now
RecyclerView) and Intents and you'll be on your way. Then come back and ask
SPECIFIC questions if and when you get stuck.

Good luck.

-
TreKing  - Chicago
transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
To post to this group, send email to android-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/CANCScgiRk1vZMFLb-sYzD9zDRAuFK_Sj9DpqVuYfzUc5OAO6TA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[android-developers] Help raw socket

2015-12-24 Thread ignaciocarlos1685
*socket raw not work. Error in creation socket. how to make a raw socket in 
android?*







public class MainActivity extends Activity implements OnClickListener {
public native String InvokeNativeFunction();
static {
System.loadLibrary("Cping");
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
View button=findViewById(R.id.button2);
button.setOnClickListener(this);
}

@Override
public void onClick(View v) {
TextView texto=(TextView)findViewById(R.id.textView1);
String textoAmostrar="";
textoAmostrar=InvokeNativeFunction();
if (v.getId()==findViewById(R.id.button2).getId()){
texto.setText(textoAmostrar);
}
}
}



#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 

#define DEFAULT_INIT_PORT 1 /* puerto inicial del escaneo por defecto */
#define DEFAULT_END_PORT 1024 /* puerto final del escaneo por defecto  */
#define DEFAULT_ICMP_PORT 8765 /* puerto por defecto para mandar los 
paquetes ICMP */

 extern "C" {
 JNIEXPORT jstring JNICALL
Java_com_exadddmple_pingconc_MainActivity_InvokeNativeFunction(JNIEnv * 
env, jobject obj);
 };

 JNIEXPORT jstring JNICALL
  Java_com_exadddmple_pingconc_MainActivity_InvokeNativeFunction(JNIEnv * 
env, jobject obj)

{
int sockfd,numbytes,flags,listen; //descriptor del socket, número de bytes 
enviados, flags y resultado del connect()
int init_port, end_port; //variables de inicio y fin del escaneo
int result,fromlen; //resultado del select, y tamaño del ICMP de respuesta
struct hostent *he; //variable de tipo hostent donde se guardará 
información del Host a escanear
struct sockaddr_in their_addr; // almacenarán la direccion IP del Host 
objetivo, y sus datos 
static u_char paquete_salida[64]; //paquete de salida ICMP
register struct icmp *cabecera_icmp = (struct icmp *) paquete_salida; 
//formato de paquete ICMP 
fd_set fd_leer,fd_escribir; //descriptores a controlar por select
struct timeval tv; //temporizador para el uso de select
char recv_ICMP[512],shost[100];
struct servent *bar; //guardará el nombre del servicio que corre en cada 
puerto
int i,val,len=sizeof(val); //contador, resultado getsockopt

init_port= DEFAULT_INIT_PORT;
end_port= DEFAULT_END_PORT;

if ((sockfd = socket(AF_INET, SOCK_RAW,1)) < 0)
{

return env->NewStringUTF("Error socket");
//exit(1);
}

if ((he= gethostbyname("www.google.com")) == NULL)
{
return env->NewStringUTF("Error gethostbyname");
//exit(1);
}

/* Creamos el socket */


their_addr.sin_family = AF_INET; // host byte order 
their_addr.sin_port = htons(DEFAULT_ICMP_PORT); /* network byte order */
their_addr.sin_addr = *((struct in_addr *)he->h_addr); // dirección IP
bzero(&(their_addr.sin_zero), 8);
sprintf(shost,"%d.%d.%d.%d",(unsigned char)he->h_addr_list[0][0],(unsigned 
char)he->h_addr_list[0][1],(unsigned char)he->h_addr_list[0][2],\
(unsigned char)he->h_addr_list[0][3]);

/* configuración cabecera mensaje ICMP */
cabecera_icmp->icmp_type = ICMP_ECHO; // Tipo de mensajes ICMP
cabecera_icmp->icmp_code = 0; // Código de mensaje ICMP
cabecera_icmp->icmp_cksum = 0; // Checksum del paquete ICMP
cabecera_icmp->icmp_seq =1; // Numero de secuencia
cabecera_icmp->icmp_id = 0x; // ID de paquete

/* Transmitimos el paquete ICMP */
if ((numbytes=sendto(sockfd, _salida, 64, 0, (struct sockaddr 
*)_addr, sizeof(struct sockaddr))) == -1)
{
return env->NewStringUTF("Error sendto");
 }

do {
   FD_ZERO(_leer); // pone a 0 todos los bits de fd_var. 
   FD_SET(sockfd, _leer); //activa en fd_leer el bit correspondiente al 
descriptor sockfd
   tv.tv_sec=2; // 2 segundos de tiempo de espera para recibir la respuesta 
al ICMP
   tv.tv_usec=0;
   result = select(sockfd +1, _leer, NULL, NULL, );
} while (result == -1 && errno == EINTR);



if (result > 0) {
   if (FD_ISSET(sockfd, _leer)) {
  /* El socket tiene datos para leer */
  result = recvfrom(sockfd, recv_ICMP, sizeof recv_ICMP, 0, NULL, 
);
  if (result == 0) {
 /* Conexión cerrada por el host */
close(sockfd);

return env->NewStringUTF("El host ha cerrado la conexión.");
  
  }
  else {
  close(sockfd);

  return env->NewStringUTF("El host está activo,procederemos a chequear los 
servicios...");


}

}//FIN_MAIN

}
}

-- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
To post to this group, send email to android-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/a1d89005-fb8d-4e26-bd13-f415b020c124%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[android-developers] Re: Lost Keystore and want to update apk

2015-12-24 Thread VISHAL TIKKU
There is no way you can update the apk with other keystore.
Did you created any keystore certificate or you used default certificate of 
android studio or eclipse? 
On Wednesday, December 23, 2015 at 3:37:03 PM UTC+5:30, sourabh wrote:
>
> Dear All,
>
> I have lost my Keystore, Now I want to update my APK.
>
> I tried lot of file recovery software but not able to get it. Now I dont 
> want to publish a new app due to large number of downloads.
>
> Please suggest any other way to update app.
>
> Regards,
> Sourabh
>

-- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
To post to this group, send email to android-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/a8bfe8c9-0753-4b8a-a79a-81610b68d586%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[android-developers] Android For Work | How to download DPC while NFC activation from Google Play / Google Play For Work?

2015-12-24 Thread Andrey Egorov
Can I download DPC apk while NFC activation from Google Play/Google Play 
For Work instead of direct link for the apk?

-- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
To post to this group, send email to android-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/6c75e037-daf6-4ece-bddc-a81df3594c5c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[android-developers] Help!Help! Issue about using the alarm in android

2015-12-24 Thread xuzhang2015



I have set three repeat daily alarm as  time 12:00,16:00 and 20:00. But I 
found that the first alarm would present at 11:59:34, 12:00:12 and 
12:00:56. I have checked many documents, no one gives me an answer. Please 
help me!

Here are my code:


//set PendingIntent.
Intent alarmIntent = new Intent(context, AlarmReceiver.class);
alarmIntent.putExtra("alarmType", 3);
PendingIntent pendingIntentMoring = PendingIntent.getBroadcast(context, 51, 
alarmIntent, PendingIntent.FLAG_UPDATE_CURRENT);
PendingIntent pendingIntentAfternoon = PendingIntent.getBroadcast(context, 
52, alarmIntent, PendingIntent.FLAG_UPDATE_CURRENT);
PendingIntent pendingIntentEvening = PendingIntent.getBroadcast(context, 
53, alarmIntent, PendingIntent.FLAG_UPDATE_CURRENT);


//clear the alarm manager before set the new alarm
managerMorning.cancel(pendingIntentMoring);
managerAfternoon.cancel(pendingIntentAfternoon);
managerEvening.cancel(pendingIntentEvening);


//set new alarm
managerMorning.setRepeating(AlarmManager.RTC_WAKEUP, 
cal1.getTimeInMillis(),AlarmManager.INTERVAL_DAY, pendingIntentMoring);
managerAfternoon.setRepeating(AlarmManager.RTC_WAKEUP, 
cal2.getTimeInMillis(),AlarmManager.INTERVAL_DAY, pendingIntentAfternoon);
managerEvening.setRepeating(AlarmManager.RTC_WAKEUP, 
cal3.getTimeInMillis(),AlarmManager.INTERVAL_DAY, pendingIntentEvening);


//set Receiver 
public void onReceive(Context context, Intent intent) {
Intent myMessageintent = new Intent(context, UpDateDiaryMessage.class);
myMessageintent.putExtra("alarmType", 3);
context.startService(myMessageintent);
}


I have test it many times. I cannot get the alarm at 12:00:00, but I got 
two or three alarm around at 12:00:00. I dont know why this happened.



-- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
To post to this group, send email to android-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/7fb1708e-c331-4569-97bb-607bdeb918e1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.