Skip to content

Instantly share code, notes, and snippets.

View barmgeat's full-sized avatar

Mustafa Hazim barmgeat

  • Berlin, Germany
View GitHub Profile
<?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 class WordCursorAdapter extends CursorAdapter{
Context context;
Cursor cursor;
public WordCursorAdapter(Context x, Cursor c){
super(x, c,0);
this.context = x;
this.cursor = c;
}
..
@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 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.
@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,
@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");
}
function welcom(){
console.log("hi");
}
welcom();
------------------------
var welcom = function (){
console.log("hi");
...
// we can call befor the defined
welcom();
// once we defined the function we can call it where we want
function welcom(){
console.log("hi");
const http = require('http');
const hostname = '127.0.0.1';
const port = 3000;
const server = http.createServer((req, res) => {
res.statusCode = 200;
res.setHeader('Content-Type', 'text/plain');
res.end('Hello, World!\n');
});
// we need this module to create the server and handel the request from the user
const http = require('http');
// here is the host where the server will work
const hostname = '127.0.0.1';
// you can use any port but the likely for node.js is 3000
const port = 3000;
// here is a call back function we will talk about it later but this function called when the user requset the server URL
const server = http.createServer((req, res) => {