What is the difference between Empty activity and Blank activity

1359 views.

which one is more use full in doing a real time project

Add Comment
1 Answer(s)
693 views.

In Real time we use empty activity only because just observer auto generated code (Java) for both below

BlankActivity

package com.example.aaa;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
public class MainActivity extends ActionBarActivity {
@Override
 protected void onCreate(Bundle savedInstanceState) {
 super.onCreate(savedInstanceState);
 setContentView(R.layout.activity_main);
 }
@Override
 public boolean onCreateOptionsMenu(Menu menu) {
 // Inflate the menu; this adds items to the action bar if it is present.
 getMenuInflater().inflate(R.menu.main, menu);
 return true;
 }
@Override
 public boolean onOptionsItemSelected(MenuItem item) {
 // Handle action bar item clicks here. The action bar will
 // automatically handle clicks on the Home/Up button, so long
 // as you specify a parent activity in AndroidManifest.xml.
 int id = item.getItemId();
 if (id == R.id.action_settings) {
 return true;
 }
 return super.onOptionsItemSelected(item);
 }
}

 

Empty Activity

package com.example.auto;
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
public class MainActivity extends Activity {
 String Course[]={"Android","Java",".net","Salesforce","PHP","Android","Java",".net","Salesforce","PHP"};
 @Override
 protected void onCreate(Bundle savedInstanceState) {
 super.onCreate(savedInstanceState);
 setContentView(R.layout.activity_main);
 }
}

Blank activity extends as Action bar Activity but now those methods are depression methods so we are using Empty Activity

 

Note: Depression means not using now.

Answered on July 1, 2016.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.