Click here to Skip to main content
15,893,790 members

Comments by Member 11420908 (Top 18 by date)

Member 11420908 17-Jul-15 7:02am View    
i am already removed the semicolon
Member 11420908 19-Jun-15 0:45am View    
This is my Code

public class MainActivity extends ActionBarActivity {
String n="";
Timer timer;
TimerTask timerTask;
final android.os.Handler handler = new android.os.Handler();

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
startTimer();
Test2();
}
public void startTimer() {
// Pull();
//set a new Timer
timer = new Timer();

//initialize the TimerTask's job
initializeTimerTask();

//schedule the timer, after the first 5000ms the TimerTask will run every 10000ms
timer.schedule(timerTask,0, 15000); //
}
public void Timer15()
{

timer =new Timer();
initializeTimerTask();
timer.schedule(timerTask,0,5000);
}

public void initializeTimerTask() {

timerTask = new TimerTask() {
public void run() {

//use a handler to run a toast that shows the current timestamp
handler.post(new Runnable() {
public void run() {
Test1();


// Toast.makeText(getApplicationContext(),"hai",Toast.LENGTH_SHORT).show();
}
});
}
};
}
public void Test1()
{
n="vetri";

}
public void Test2()
{
if (n=="vetri")
{
timer.cancel();
Timer15();
Toast.makeText(getApplicationContext(),n,Toast.LENGTH_LONG).show();
}
else
{
Toast.makeText(getApplicationContext(),"Error",Toast.LENGTH_LONG).show();
}

}

}
Member 11420908 19-Jun-15 0:44am View    
This is my Code

public class MainActivity extends ActionBarActivity {
String n="";
Timer timer;
TimerTask timerTask;
final android.os.Handler handler = new android.os.Handler();

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
startTimer();
Test2();
}
public void startTimer() {
// Pull();
//set a new Timer
timer = new Timer();

//initialize the TimerTask's job
initializeTimerTask();

//schedule the timer, after the first 5000ms the TimerTask will run every 10000ms
timer.schedule(timerTask,0, 15000); //
}
public void Timer15()
{

timer =new Timer();
initializeTimerTask();
timer.schedule(timerTask,0,5000);
}

public void initializeTimerTask() {

timerTask = new TimerTask() {
public void run() {

//use a handler to run a toast that shows the current timestamp
handler.post(new Runnable() {
public void run() {
Test1();


// Toast.makeText(getApplicationContext(),"hai",Toast.LENGTH_SHORT).show();
}
});
}
};
}
public void Test1()
{
n="vetri";

}
public void Test2()
{
if (n=="vetri")
{
timer.cancel();
Timer15();
Toast.makeText(getApplicationContext(),n,Toast.LENGTH_LONG).show();
}
else
{
Toast.makeText(getApplicationContext(),"Error",Toast.LENGTH_LONG).show();
}

}

}
Member 11420908 16-May-15 6:43am View    
okay thanks
Member 11420908 16-May-15 5:57am View    
How can i solve this problem