Skip to content

Instantly share code, notes, and snippets.

@shah-smit
Created September 23, 2017 06:56
Show Gist options
  • Save shah-smit/5f09c015506fb8f0046646b923a37e26 to your computer and use it in GitHub Desktop.
Save shah-smit/5f09c015506fb8f0046646b923a37e26 to your computer and use it in GitHub Desktop.
Android GridView Test

package a2017.simitclub.com.calculator;

 import android.os.Bundle;
 import android.app.Activity;
 import android.util.Log;
 import android.view.View;
 import android.widget.GridView;
 import android.widget.AdapterView;
 import android.widget.ArrayAdapter;
 import android.widget.TextView;
 import android.widget.Toast;

public class MainActivity extends Activity {
 String msg = "Android : ";
 GridView gridView;
// static final String[] numbers = new String[] {
// "0", "1", "2", "3", "4",
// "5", "6", "7", "8", "9",
// "+", "-", "%", "/", "AC",};
 /** Called when the activity is first created. /
 @Override
 public void onCreate(Bundle savedInstanceState) {
 super.onCreate(savedInstanceState);
 setContentView(R.layout.activity_main);
// gridView = (GridView) findViewById(R.id.opertators);
//
// ArrayAdapter adapter = new ArrayAdapter(this,
// R.layout.keyboard_view, numbers);
//
// gridView.setAdapter(adapter);
//
// gridView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
// public void onItemClick(AdapterView<?> parent, View v,
// int position, long id) {
// Toast.makeText(getApplicationContext(),
// ((TextView) v).getText(), Toast.LENGTH_SHORT).show();
// }
// });

 }

 /* Called when the activity is about to become visible. /
 @Override
 protected void onStart() {
 super.onStart();
 Log.d(msg, "The onStart() event");
 }

 /* Called when the activity has become visible. /
 @Override
 protected void onResume() {
 super.onResume();
 Log.d(msg, "The onResume() event");
 }

 /* Called when another activity is taking focus. /
 @Override
 protected void onPause() {
 super.onPause();
 Log.d(msg, "The onPause() event");
 }

 /* Called when the activity is no longer visible. /
 @Override
 protected void onStop() {
 super.onStop();
 Log.d(msg, "The onStop() event");
 }

 /* Called just before the activity is destroyed. */
 @Override
 public void onDestroy() {
 super.onDestroy();
 Log.d(msg, "The onDestroy() event");
 }

 public void Clear(View v)
 {
 Toast.makeText(getApplicationContext(),
 "Cleared Calculations", Toast.LENGTH_SHORT).show();
 }
}




 

 

 

 

 

 
 


 

 

 

 

 
 

 

 

 

 

 
 

 

 

 

 

 
 

 

 

 

 

 
 

 
 
 
 
 
 
 
 

 


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment