Skip to content

Instantly share code, notes, and snippets.

View fatorx's full-sized avatar
💭
Learning and learning.

Fabio de Souza fatorx

💭
Learning and learning.
View GitHub Profile
@fatorx
fatorx / gist:8b22ddb64b045af79e49
Created May 22, 2015 15:20
Problemas com visualização do Logcat
Checar esses passos
http://stackoverflow.com/questions/25968542/please-check-the-confirmation-dialog-on-your-device
@fatorx
fatorx / layout_edit_text
Last active August 29, 2015 14:21
EditText Multiline - Iniciar texto no topo
<EditText
android:layout_width="match_parent"
android:layout_height="180dp"
android:textColor="#000000"
android:hint="Text Hint Info..."
android:textColorHint="#CCCCCC"
android:textSize="20dp"
android:elegantTextHeight="true"
android:id="@+id/edDescription"
android:background="#FFF"
@fatorx
fatorx / not-reload-activity
Last active August 29, 2015 14:22
Não atualizar os dados uma tela, ao ser acessada novamente
Em uma activity ou fragment, verificar o life cycle para evitar executar código a cada acesso.
Por exemplo:
- Acessar uma lista de itens
- Acessar um dos itens da lista
- Voltar para lista
Dependendo do método executado (em relação a Activity e ao Fragment), a cada acesso a tela pode
ser atualizada ou também uma nova consulta ao webservice é executada.
@fatorx
fatorx / activity_main.xml
Created June 2, 2015 15:10
Estilos para Widgets - Toolbar como exemplo
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="match_parent"
tools:context=".MainActivityFragment">
<include layout="@layout/toolbar_main" />
</LinearLayout>
@fatorx
fatorx / layout.xml
Created June 2, 2015 19:46
Linear Layout - alinhar um elemento no centro
<LinearLayout
android:layout_width="270dp"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center_vertical"
android:background="#993366">
<TextView
android:id="@+id/tvTitleActivity"
android:layout_gravity="center"
@fatorx
fatorx / dex-compiler.txt
Last active August 29, 2015 14:22
Remover completamente um aplicativo do Android
http://badlogicgames.com/forum/viewtopic.php?t=19301&p=81023
So I appear to have solved this now...Even though the application was uninstalled from the device for all users, uninstalled via the ADB and did not appear on the list of packages from the ADB, it was still present on the device. On the device, under "Settings -> Apps -> All", at the very bottom was an entry for my application. It was tagged as "Not installed for all users", after selecting it and opening the top-right menu, I could select "Uninstall for all users". For some reason, this fixes the issue.
--------------------------------
Quando ocorrer o erro de não ser possível reinstalar o aplicativo via APK.
@fatorx
fatorx / note
Created June 15, 2015 12:30
Meu primeiro contato com threads
final Handler handler = new Handler(){
@Override
public void handleMessage(Message msg) {
switch(msg.what){
case 0:
nextActivity();
progress.dismiss();
}
super.handleMessage(msg);
}
@fatorx
fatorx / note
Created June 15, 2015 13:30
Problemas com escopo de execução de Threads
http://stackoverflow.com/questions/3875184/cant-create-handler-inside-thread-that-has-not-called-looper-prepare
http://stackoverflow.com/questions/5009816/cant-create-handler-inside-thread-which-has-not-called-looper-prepare
@fatorx
fatorx / gist:1826e9acedf4ec269e4b
Created June 17, 2015 13:35
Java Math - Return point float number between two integers
int seconds = 88200;
int secHour = 3600;
float val = ( (float) seconds / (float) secHour);
System.out.println( val );
@fatorx
fatorx / recycler-view-note
Created June 23, 2015 19:35
Recycler View - recado a comunidade
Sempre setar o Layout Manager
recyclerView.setLayoutManager(new LinearLayoutManager(getApplicationContext()));
não esquecer nunca.