Ex:
echo("Linha1 <br />\n Linha2");
new Handler().postDelayed(new Runnable() {
public void run() {
openOptionsMenu();
}
}, 1000);
import android.app.AlertDialog;
import android.content.DialogInterface;
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage("Are you sure?");
builder.setTitle("Warning");
builder.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,int which) {
dialog.cancel();
}});
builder.setNegativeButton("No", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,int which) {
dialog.cancel();
}}).create().show();
Sub navega_cartola_fc()
Dim navegador As Object
Dim time As String
Set navegador = New InternetExplorer
time = "chupinsco-fc" 'Digite aqui o time
navegador.Navigate "http://cartolafc.globo.com/#!/time/" + time
While navegador.Busy
Wend
Dim r, c As Integer
Dim elemCol as object
Set elemCol= navegador.Document.getElementsByTagName("tbody")
Application.Wait TimeSerial(Hour(Now()), Minute(Now()), Second(Now()) + 3)
For r = 0 To elemCol(0).Rows.Length - 1
For c = 0 To elemCol(0).Rows(r).Cells.Length - 1
ActiveSheet.Cells(r + 1, c + 1) = _
elemCol(0).Rows(r).Cells(c).innerText
Next c
Next r
Set elemCol = Nothing
Set navegador = Nothing
End Sub
void Espera (int Segundos){
long Tempo = System.currentTimeMillis(); //Inicializa com a hora do sistema
while(System.currentTimeMillis() < Tempo+(Segundos*1000));
}
Para chamar a função basta Espera (2); Neste caso a aplicação fica parada ou dormindo por 2 segundos. Uri uri = Uri.parse("http://www.brandi-info.blogspot.com");
Intent it = new Intent(Intent.ACTION_VIEW, uri);
startActivity(it);
Quando precisamos chamar outra tela (activity), neste caso, é passado como parâmetro a classe correspondente:
Intent it = new Intent(this, OutraClasseActivity.class);
startActivity(it);
Para iniciar uma ligação com o número definido podemos utilizar o seguinte exemplo:
Uri uri = uri.parse("tel:98725432");
Intent it = new Intent(Intent.ACTION_CALL, uri);
startActivity(it);
List<Integer> numeros = new ArrayList<Integer>();
Inserir valores de 1 até 10 na lista e embaralhar: for (int i = 1; i <= 10; i++) numeros.add(i); // Inserir valores na lista "numeros"
Collections.shuffle(numeros); // Embaralhar os números da lista:
Para retornar os valores embaralhados:
Integer a = numeros.get(0); // Retorna o primeiro número aleatório não repetido da lista
Integer b = numeros.get(1); // Retorna o segundo número aleatório não repetido da lista
=(B5-INT(B5))*24*C5Neste caso a célula com o formato hora é a "B5", e a célula com o valor da hora é a "C5". Caso o valor da célula "B5" seja "03:30" e o valor da célula "C5" seja "R$ 20,00" o resultado será "R$ 70,00" (da conta "3,5*20").
Stack<Integer> pilha = new Stack<Integer>(); //Declaração de uma pilha de inteiros
Os principais comandos para manipulação de uma pilha são:pilha.push(10); //Insere o número 10 na pilha
pilha.pop(); //Remove e retorna o último elemento da pilha
pilha.lastElement(); // Retorna o valor do último elemento da pilha
pilha.empty(); // Retorna positivo se a pilha está vazia
pilha.clear(); // Remove todos os elementos inseridos na pilha
A biblioteca necessária para declaração de uma pilha é java.util.Stack