Skip to content

Instantly share code, notes, and snippets.

Fanadezz

Block or report user

Report or block Fanadezz

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Fanadezz
Fanadezz / java.java
Created Aug 3, 2018
Sending Local Broadcast
View java.java
/*sending local broadcast*/
Intent broadcastIntent = new Intent("custom-intent");
LocalBroadcastManager.getInstance(context).sendBroadcast(broadcastIntent);
@Fanadezz
Fanadezz / java.java
Created Aug 3, 2018
inflating XML Layout
View java.java
/*inflating xml layout*/
LayoutInflater layoutInflater = LayoutInflater.from(MainActivity.this);
layoutInflater.inflate(R.layout.activity_main,parent, false);
@Fanadezz
Fanadezz / java.java
Created Aug 3, 2018
dynamic TextView
View java.java
/*creating a dynamic textview*/
TextView textView = new TextView(MainActivity.this);
@Fanadezz
Fanadezz / java.java
Created Aug 3, 2018
internal File Path
View java.java
File file = new File(context.getFilesDir(), filename);
@Fanadezz
Fanadezz / java.java
Created Aug 3, 2018
getSystem Services
View java.java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
/*getting a notification service*/
NotificationManager notificationManager = (NotificationManager) getSystemService(Context
.NOTIFICATION_SERVICE);
}
View java.java
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
/*this references to the activity's class*/
String [] animal = this.getResources().getStringArray(R.array.animals);
}
}
@Fanadezz
Fanadezz / java.java
Created Aug 3, 2018
Context Start Activity
View java.java
/*provide context if MyActivity is a local activity*/
Intent intent = new Intent(context,MyActivity.class);
startActivity(intent);
@Fanadezz
Fanadezz / java.java
Created Aug 2, 2018
proguard-rules.pro
View java.java
-assumenosideeffects class android.util.Log{
public static boolean isLoggable(java.lang.String, int);
public static int v(...);
public static int i(...);
public static int w(...);
public static int d(...);
public static int e(...);
}
@Fanadezz
Fanadezz / java.java
Created Aug 2, 2018
buildTypes Block
View java.java
buildTypes {
release {
postprocessing {
removeUnusedCode true
removeUnusedResources true
obfuscate true
optimizeCode true
proguardFile 'proguard-rules.pro'
}
}
View java.java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
colorClass = new ColorClass();
factClass = new FactClass();
layout = findViewById(R.id.relativeLayout);
txt = findViewById(R.id.textFact);
btn = findViewById(R.id.btn);
You can’t perform that action at this time.