Skip to content

Instantly share code, notes, and snippets.

View barmgeat's full-sized avatar

Mustafa Hazim barmgeat

  • Berlin, Germany
View GitHub Profile
...
// we can call befor the defined
welcom();
// once we defined the function we can call it where we want
function welcom(){
console.log("hi");
function welcom(){
console.log("hi");
}
welcom();
------------------------
var welcom = function (){
console.log("hi");
@barmgeat
barmgeat / test.java
Last active June 21, 2019 22:43
some description right here
public static void main (){
System.Out.println("Hello World") ;
sout("Test");
}
@barmgeat
barmgeat / MainActivity.java
Created September 16, 2018 03:47
setup the CursorLoader SQLite CursorLoader in MainActivity
public class MainActivity extends AppCompatActivity implements LoaderManager.LoaderCallbacks<Cursor> {
private static final int URL_LOADER = 0;
WordCursorAdapter mAdapter;
// Define a projection that specifies which columns from the database
// you will actually use after this query.
String[] projection = {
Words._ID,
Words.COLUMN_WORD,
public class MainActivity extends AppCompatActivity {
Cursor cursor;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Define a projection that specifies which columns from the database
// you will actually use after this query.
..
@Override
public View newView(Context context, Cursor cursor, ViewGroup viewGroup) {
return LayoutInflater.from(context).inflate(R.layout.word_item_layout, viewGroup, false);
}
@Override
public void bindView(View view, Context context, Cursor cursor) {
TextView t_word = view.findViewById(R.id.item_word);
TextView t_word_A = view.findViewById(R.id.item_word_a);
public class WordCursorAdapter extends CursorAdapter{
Context context;
Cursor cursor;
public WordCursorAdapter(Context x, Cursor c){
super(x, c,0);
this.context = x;
this.cursor = c;
}
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="8dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
public void insertData() {
ContentValues values = new ContentValues();
values.put(Words.COLUMN_WORD, "Test Word");
values.put(Words.COLUMN_WORD_T, "Test T Word");
values.put(Words.COLUMN_WORD_T2, "Test T2 Word");
values.put(Words.COLUMN_WORD_T3, "Test T3 Word");
values.put(Words.COLUMN_ARTIKEL, Words.ARTIKEL_UNKNOWN);
Uri newURI = getContentResolver().insert(DeutchVContract.CONTENT_URI, values);
if (newURI != null) {
...
@Nullable
@Override
public Uri insert(@NonNull Uri uri, @Nullable ContentValues contentValues) {
final int match = uriMatcher.match(uri);
switch (match){
case WORDS_CODE :
return insertData(uri, contentValues);
default: