Pessoal, fiz a Thread, porem quando clico no botao replicar, ele nao entra na minha classe ExportarVendasService
e não dá erro no LogCat, só entra aqui :
public void Replicacao_Click(View v) {
startService(new Intent("INICIAR_REPLICACAO"));
}
e não da continuidade a thread
*****Manifest
<service android:name="ExportarVendasService">
<intent-filter >
<action android:name="INICIAR_REPLICACAO"></action>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</service>
****ExportarVendasService
public class ExportarVendasService extends Service implements Runnable{
public void OnCreate() {
new Thread(ExportarVendasService.this).start();
}
@Override
public IBinder onBind(Intent arg0) {
// TODO Auto-generated method stub
return null;
}
@Override
public void run() {
for(int i=0; i < 1000;i++){
try {
Log.d("Exportar",String.valueOf(i));
Thread.sleep(100);
}
catch(Exception ex){
Log.d("Exportar",ex.getMessage());
}
}
}
}
*****Main
public class Main extends Activity {
public void Replicacao_Click(View v) {
startService(new Intent("INICIAR_REPLICACAO"));
}
*****xml
<Button
android:id="@+id/btnReplicar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/Button01"
android:onClick="Replicacao_Click"
android:text="Iniciar Replicacao" />