• LETS BUILD AWESOME MOBILE APPS USING THE EASIEST WAY

    A write less, do more library for Android. Andbrain Engine makes your code more concise and development simpler by using annotations
    GET STARTED NOW

RECENTCOMPONENTS

new logo

Why You Need To Extend AsyncTasks class Every time

I don’t see why you need to extend AsyncTasks class every time if you want to do some work on background . Also having to create a Thread and a Handler every time.you just need to do some background work and have a response just this.So AndBrain helps you to do that so easy and faster .AndBrain had a pair of annotations called @Background and @UIThread which magically allowed your code to be executed on the UI Thread or on a Background one with no effort.

package com.example.demo;
import android.os.Bundle;
import android.app.Activity;
.......

public class MainActivity extends Activity {
 MainActivity$ mGenClass;

 @UIThread
 public void publishProgress(int i) {
  progressBar.setProgress(i);
  tvLoading.setText("Loading...  " + i + " %");
  tvPer.setText(i + " %");

 }
 @Background()
 public void myDoInBackgroundTask(int time) {

  mGenClass.publishProgress(i);
  try {
   Thread.sleep(time);
  } catch (InterruptedException e) {
   e.printStackTrace();
  }
 }
 mGenClass.onPostExecute();
}

@UIThread
public void onPostExecute() {
 dialog.dismiss();
 AlertDialog alert = new AlertDialog.Builder(MainActivity .this)
  .create();
 alert.setTitle("Completed!!!");
 alert.setMessage("Your Task is Completed SuccessFully!!!");
 alert.show();
}

@AutoGen("layout/activity_main")
@Override
protected void onCreate(Bundle savedInstanceState) {
 super.onCreate(savedInstanceState);
 mGenClass = MainActivity$(this);
 mGenClass.myDoInBackgroundTask(500);
}
}

       
new logo

Automatically Generate All Input Controls For You

In every Android application,you need to declare all interactive components like Buttons, Edittext ,TextView Listes ….. manually and you have to use the findViewById() method for each view in the layout file that you want to use in your application’s code. But as applications’ designs get more complex layouts, the declare of this Input Controls and the call to this method becomes repetitive and this is where the Andbrain library comes in.

The andbrain library, has annotations that help developers to automatically parse layout files and generate all interactive components in it and instantiate all the views from activity or fragment.

package com.example.demo;
import android.os.Bundle;
import android.app.Activity;
import android.widget.Toast;

public class MainActivity extends Activity {
 MainActivity$ mGenClass;

 @OnClick(R.id.button)
 public void onclick(){
 String str = mGenClass.edittext.getText().toString();
 Toast msg = Toast.makeText(getBaseContext(),str,Toast.LENGTH_LONG);
 msg.show();
 }

 @AutoGen("layout/activity_main")
 @Override
 protected void onCreate(Bundle savedInstanceState) {

 super.onCreate(savedInstanceState);
 mGenClass=MainActivity$(this);

 }
}
new logo

Andbrain Engine Events

Andbrain Engine Events its a android library based on annotations ,that eases the process of injecting InputEvents (OnClick,OnTouch,MotionEvent, KeyEvent,…) into your classes automatically.its provide Handlers that allow for special methods that will be called for specific events.
Some Events Annotations Examples :
@OnClick
This annotation will trigger an event when a View (for example, a Button) is clicked.
Example

@OnClick(R.id.button)
public void onClick() {
    Toast.makeText(this, "Button clicked", Toast.LENGTH_SHORT).show();
}

@OnItemClick(R.id.list)
This annotation will trigger an event when an AbsListView (ListView, GridView…​) item is clicked.

Example

@OnItemClick
public void onItemClick(int position) {
    Toast.makeText(this, "Item $position clicked", Toast.LENGTH_SHORT).show();
}

@OnFocusChanged
This annotation will trigger an event when a View receives or loses focus.
Example

@OnFocusChanged(R.id.my_view)
public void onFocusChanged(boolean hasFocus) {
    Toast.makeText(this, "View has focus: $hasFocus", Toast.LENGTH_SHORT).show();
}

@OnEditorAction
This annotation will trigger an event when a TextView receives an action such as pressing ENTER key or a custom action on the keyboard.

LETS BUILD AWESOME MOBILE APPS USING THE EASIEST WAY
GET STARTED NOW