content_copy
dashboard

#android #java

// IntendedActivity - the file you wish to open
// CurrentActivity - the file where this code is placed  

Intent intent = new Intent (this, IntendedActivity.class);
    CurrentActivity.this.startActivity(intent);
content_copy
dashboard

#android #java

int i = textString.lastIndexOf("target");
content_copy
dashboard

#android #java

public class LocalDatabase extends SQLiteOpenHelper {
         
    private static final String mDatabaseName = "LocalDatabase";
    private static final int mDatabaseVersion = 1;

public LocalDatabase(Context context) {
        super(context, mDatabaseName, null, mDatabaseVersion);
        SQLiteDatabase db = this.getWritableDatabase();
    }      

}
> More steps
content_copy
dashboard

#android

public class MainActivity extends AppCompatActivity{ 
    private Button mButton;

   protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        mButton = findViewById(R.id.mButton);

       
   }
}
> More steps
content_copy
dashboard

#android #java

    private ArrayList<String> arrayList;
    ListAdapter listAdapter;

   String[] array = new String[5];
                array[0] = "optn 1";
                array[1] = "optn 2";
                array[2] = "optn 3";
// in on create method

        arrayList = new ArrayList<>();
        listAdapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1 , array);
        mAvailableProfilesList.setAdapter(listAdapter);
        
> More steps
content_copy
dashboard

#android #java

allprojects {
    repositories {
      google()
      jcenter()
    }
  }
> More steps
content_copy
dashboard

#android #java

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/backgroundgradient"
    tools:context=".ui.Signup">

    <ImageView
            android:layout_width="130dp"
            android:layout_height="100dp"
            android:layout_centerInParent="true"
            android:src="@drawable/logosp" />

</RelativeLayout>
> More steps
content_copy
dashboard

#android #java

    AlarmManager alarmManager;
> More steps
content_copy
dashboard

#android #java

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    >
    <ImageView
        android:id="@+id/app_icon"
        android:layout_width="48dp"
        android:layout_height="48dp"
        android:focusable="false"
        android:clickable="false"
        android:contentDescription="@string/app_name"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:layout_marginLeft="16dp"
        android:layout_marginTop="16dp"
        android:paddingBottom="8dp"/>

    <TextView
        android:id="@+id/list_app_name"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textStyle="bold"
        android:textIsSelectable="false"
        android:textSize="16dp"
        android:textColor="#000000"
        android:layout_toEndOf="@+id/app_icon"
        android:layout_alignTop="@+id/app_icon"
        android:layout_marginStart="16dp"
        android:layout_marginTop="2dp"
        android:text="@string/app_name"/>
    <CheckBox
        android:id="@+id/list_app_checkbox"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentEnd="true"
        android:layout_marginEnd="12dp"
        android:checked="false"
        android:focusable="false"
        android:focusableInTouchMode="false"
        android:clickable="false"
        android:layout_alignTop="@id/list_app_name"

        />

</RelativeLayout>

> More steps
content_copy
dashboard

#android #java

public class User {

    public String mUsername;

    public User(){
        // Default constructor required for calls to DataSnapshot.getValue(User.class)
    }

    public User( String userName){
        this.mUsername = userName;
    }
}
> More steps
content_copy
dashboard

#android #java

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    >
    <ImageView
        android:id="@+id/app_icon"
        android:layout_width="48dp"
        android:layout_height="48dp"
        android:focusable="false"
        android:clickable="false"
        android:contentDescription="@string/app_name"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:layout_marginLeft="16dp"
        android:layout_marginTop="16dp"
        android:paddingBottom="8dp"/>

    <TextView
        android:id="@+id/list_app_name"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textStyle="bold"
        android:textIsSelectable="false"
        android:textSize="16dp"
        android:textColor="#000000"
        android:layout_toEndOf="@+id/app_icon"
        android:layout_alignTop="@+id/app_icon"
        android:layout_marginStart="16dp"
        android:layout_marginTop="2dp"
        android:text="@string/app_name"/>
    <CheckBox
        android:id="@+id/list_app_checkbox"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentEnd="true"
        android:layout_marginEnd="12dp"
        android:checked="false"
        android:focusable="false"
        android:focusableInTouchMode="false"
        android:clickable="false"
        android:layout_alignTop="@id/list_app_name"

        />

</RelativeLayout>

> More steps
content_copy
dashboard

#android #java #xml

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <gradient
        android:angle="45"
        android:startColor="#ff00ff"
        android:endColor="#000000"/>
</shape>
> More steps
keyboard_arrow_up