grazie,ora è un'ora che non riesco a trovare l'errore in questo codice,il sistema va in crash quando dovrebbe lanciare la schermata con layout sensibile al tocco
codice:
package progetto.gruppo0506;
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
import android.os.Handler;
import android.os.Message;
import android.content.Intent;
import android.widget.*;
import android.content.Context;
public class LocalizzazioneActivity extends Activity {
protected static final int FINISH_LOAD = 0 ;
protected static final int START_LOAD = 1 ;
protected static final int ABORT_LOAD = 2 ;
private Handler mHandler;
//private Localizzazione loc = new Localizzazione(this);
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
switch (msg.what) {
case FINISH_LOAD:
AbsoluteLayout LayoutMain=(AbsoluteLayout)findViewById(R.id.LayoutMain);
// Tocco
LayoutMain.setOnTouchListener(new OnTouchListener() {
public boolean onTouch(View view, MotionEvent event) {
Toast t=Toast.makeText(LocalizzazioneActivity.this, "Click ottenuto", Toast.LENGTH_LONG);
t.show();
Intent intent=new Intent(LocalizzazioneActivity.this,VisualizzaPoiActivity.class);
startActivity(intent);
return true;
}
});
//TextView text= (TextView)findViewById(R.id.citta);
setContentView(R.layout.main);
//text.setText(loc.getPosizione().getCitta());
AvvioActivity.sendMessage(AvvioActivity.CLOSE_SPLASH);
break;
case START_LOAD:
initializing();
break;
case ABORT_LOAD:
finish();
}
}
};
startSplash();
}
private void startSplash() {
Intent intent = new Intent(LocalizzazioneActivity.this, AvvioActivity.class);
AvvioActivity.setMainHandler(mHandler);
startActivity(intent);
}
private void initializing() {
new Thread() {
@Override
public void run() {
for (int i = 0; i < 10000; i++) {
Message msg = new Message();
msg.what = AvvioActivity.SET_PROGRESS;
msg.arg1 = i;
AvvioActivity.sendMessage(msg);
}
mHandler.sendEmptyMessage(FINISH_LOAD);
}
}.start();
}
@Override
public boolean onCreateOptionsMenu(Menu menu){
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.menu, menu);
return true;
}
/* public boolean onTouch(View v,MotionEvent event) {
Toast t=Toast.makeText(LocalizzazioneActivity.this, "Click ottenuto", Toast.LENGTH_LONG);
t.show();
Intent intent=new Intent(LocalizzazioneActivity.this,VisualizzaPoiActivity.class);
startActivity(intent);
return true;
}
*/
}