- package com.example.bluetooth;
- import android.os.Bundle;
- import android.app.Activity;
- import android.view.Menu;
- import android.app.Activity;
- import android.bluetooth.BluetoothAdapter;
- import android.content.Context;
- import android.content.Intent;
- import android.os.Bundle;
- import android.util.Log;
- import android.view.View;
- import android.widget.Button;
- import android.widget.TextView;
- import android.widget.Toast;
- public class MainActivity extends Activity {
- private static final int REQUEST_ENABLE_BT = 0;
- private static final int REQUEST_DISCOVERABLE_BT = 0;
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
- final TextView out=(TextView)findViewById(R.id.out);
- final Button button1 = (Button) findViewById(R.id.button1);
- final Button button2 = (Button) findViewById(R.id.button2);
- final Button button3 = (Button) findViewById(R.id.button3);
- final BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
- if (mBluetoothAdapter == null) {
- out.append("device not supported");
- }
- button1.setOnClickListener(new View.OnClickListener() {
- public void onClick(View v) {
- if (!mBluetoothAdapter.isEnabled()) {
- Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
- startActivityForResult(enableBtIntent, REQUEST_ENABLE_BT);
- }
- }
- });
- button2.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- if (!mBluetoothAdapter.isDiscovering()) {
- //out.append("MAKING YOUR DEVICE DISCOVERABLE");
- Toast.makeText(getApplicationContext(), "MAKING YOUR DEVICE DISCOVERABLE",
- Toast.LENGTH_LONG);
- Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_DISCOVERABLE);
- startActivityForResult(enableBtIntent, REQUEST_DISCOVERABLE_BT);
- }
- }
- });
- button3.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- mBluetoothAdapter.disable();
- //out.append("TURN_OFF BLUETOOTH");
- Toast.makeText(getApplicationContext(), "TURNING_OFF BLUETOOTH", Toast.LENGTH_LONG);
- }
- });
- }
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.activity_main, menu);
- return true;
- }
- }
Saturday, 30 April 2016
BLUETOOTH IN ANDROID
Sunday, 6 December 2015
How to Submit an App to the Android Market
http://www.wikihow.com/Submit-an-App-to-the-Android-Market
Saturday, 5 December 2015
ANDROID GUI ARCHITECTURE
Android GUI Architecture
The Android UI framework is, like the other UI frameworks, organized around the common Model-View-Controller pattern illustrated in Figure. It provides structure and tools for building a Controller that handles user input (like key presses and screen taps) and a View that renders graphical information to the screen.
The Model
The Model is the guts of your application: what it actually does. It might be, for instance, the database of tunes on your device and the code for playing them. It might be your list of contacts and the code that places phone calls or sends IMs to them.
While
a particular application’s View and Controller will necessarily reflect
the Model they manipulate, a single Model might be used by several
different applications. Think, for instance, of an MP3 player and an
application that converts MP3 files into WAV files. For both
applications, the Model includes the MP3 file format and codecs for
it. The former application, however, has the familiar Stop, Start, and
Pause controls, and plays the track. The latter may not produce any
sound at all; instead, it will have controls for setting bitrate, etc.
The Model is all about the data.
The View
The
View is the application’s feedback to the user. It is the portion of
the application responsible for rendering the display, sending audio to
speakers, generating tactile feedback, and so on. The graphical portion
of the Android UI framework’s View, is implemented as a tree of
subclasses of the View class. Graphically, each of these objects
represents a rectangular area on the screen that is completely within
the rectangular area represented by its parent in the tree. The root of
this tree is the application window.
The Controller
The
Controller is the portion of an application that responds to external
actions: a keystroke, a screen tap, an incoming call, etc. It is
implemented as an event queue. Each external action is represented as a
unique event in the queue. The framework removes each event from the
queue in order and dispatches it.
Monday, 28 September 2015
package com.sumeetmca;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
public class Login extends Activity implements OnClickListener{
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
if (arg0.getId()==R.id.signin)
{
username=mail.getText().toString();
password=paswd.getText().toString();
if(username.equals("sumeet")&& password.equals("123"))
{
Toast toast=Toast.makeText(getApplicationContext(),"success",Toast.LENGTH_SHORT);
toast.setMargin(50,50);
toast.show();
Intent aa=new Intent(getApplicationContext(), Welcome.class);
startActivity(aa);
finish();
mail.setText("*******");
paswd.setText("*******");
}
else
{
Toast.makeText(getApplicationContext(),"warning wrong password",Toast.LENGTH_SHORT).show();
}}
else
{
if(arg0.getId()==R.id.signup)
{
Toast.makeText(getApplicationContext(),"SORRY SIGNUP REGISTATION WAS CLOSED",Toast.LENGTH_SHORT).show();
}
else
{
finish();
}
}
}
Button cancel,sigin,signup;
String username,password;
EditText mail,paswd;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
cancel=(Button) findViewById(R.id.cancel);
sigin=(Button) findViewById(R.id.signin);
signup=(Button) findViewById(R.id.signup);
mail=(EditText) findViewById(R.id.email);
paswd=(EditText) findViewById(R.id.password);
cancel.setOnClickListener(this);
sigin.setOnClickListener(this);
cancel.setOnClickListener(this);
mail.setOnClickListener(this);
paswd.setOnClickListener(this);
signup.setOnClickListener(this);
}
}
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
public class Login extends Activity implements OnClickListener{
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
if (arg0.getId()==R.id.signin)
{
username=mail.getText().toString();
password=paswd.getText().toString();
if(username.equals("sumeet")&& password.equals("123"))
{
Toast toast=Toast.makeText(getApplicationContext(),"success",Toast.LENGTH_SHORT);
toast.setMargin(50,50);
toast.show();
Intent aa=new Intent(getApplicationContext(), Welcome.class);
startActivity(aa);
finish();
mail.setText("*******");
paswd.setText("*******");
}
else
{
Toast.makeText(getApplicationContext(),"warning wrong password",Toast.LENGTH_SHORT).show();
}}
else
{
if(arg0.getId()==R.id.signup)
{
Toast.makeText(getApplicationContext(),"SORRY SIGNUP REGISTATION WAS CLOSED",Toast.LENGTH_SHORT).show();
}
else
{
finish();
}
}
}
Button cancel,sigin,signup;
String username,password;
EditText mail,paswd;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
cancel=(Button) findViewById(R.id.cancel);
sigin=(Button) findViewById(R.id.signin);
signup=(Button) findViewById(R.id.signup);
mail=(EditText) findViewById(R.id.email);
paswd=(EditText) findViewById(R.id.password);
cancel.setOnClickListener(this);
sigin.setOnClickListener(this);
cancel.setOnClickListener(this);
mail.setOnClickListener(this);
paswd.setOnClickListener(this);
signup.setOnClickListener(this);
}
}
HOW TO CREATE LIST VIEW /CONTEXT MENU WITH DIAOG BOX.
package com.example.listview1;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Toast;
public class MainActivity extends Activity {
ListView L1;
String Contact[]={"MCA","MTECH","MBA","BCA","BBA"};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
L1=(ListView) findViewById(R.id.listView1);
ArrayAdapter<String> adapter=new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,Contact);
L1.setAdapter(adapter);
registerForContextMenu(L1);
}
@Override
public void onCreateContextMenu(ContextMenu menu, View v,
ContextMenuInfo menuInfo) {
// TODO Auto-generated method stub
super.onCreateContextMenu(menu, v, menuInfo);
menu.setHeaderTitle("DO YOU WANT TO PROCCESED");
menu.add(0, v.getId(), 0, "YES");//groupId, itemId, order, title
menu.add(0, v.getId(), 0, "NO");
}
@Override
public boolean onContextItemSelected(MenuItem item) {
// TODO Auto-generated method stub
if(item.getTitle()=="YES"){
Intent i = new Intent(getApplicationContext(), Login.class);
startActivity(i);
}
else {
Intent i = new Intent(getApplicationContext(), MainActivity.class);
startActivity(i);
return false;
}
return true;
}
}
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Toast;
public class MainActivity extends Activity {
ListView L1;
String Contact[]={"MCA","MTECH","MBA","BCA","BBA"};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
L1=(ListView) findViewById(R.id.listView1);
ArrayAdapter<String> adapter=new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,Contact);
L1.setAdapter(adapter);
registerForContextMenu(L1);
}
@Override
public void onCreateContextMenu(ContextMenu menu, View v,
ContextMenuInfo menuInfo) {
// TODO Auto-generated method stub
super.onCreateContextMenu(menu, v, menuInfo);
menu.setHeaderTitle("DO YOU WANT TO PROCCESED");
menu.add(0, v.getId(), 0, "YES");//groupId, itemId, order, title
menu.add(0, v.getId(), 0, "NO");
}
@Override
public boolean onContextItemSelected(MenuItem item) {
// TODO Auto-generated method stub
if(item.getTitle()=="YES"){
Intent i = new Intent(getApplicationContext(), Login.class);
startActivity(i);
}
else {
Intent i = new Intent(getApplicationContext(), MainActivity.class);
startActivity(i);
return false;
}
return true;
}
}
Thursday, 24 September 2015
how to desidn login form and jump into website using implict intent
package com.example.sum;
import android.net.Uri;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
public class MainActivity extends Activity implements OnClickListener{
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
if (arg0.getId()==R.id.button2)
{
username=et1.getText().toString();
paswd=et2.getText().toString();
if(username.equals("sumeet")&& paswd.equals("123"))
{
Toast toast=Toast.makeText(getApplicationContext(),"success",Toast.LENGTH_SHORT);
toast.setMargin(50,50);
toast.show();
Intent intent=new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("http://www.facebook.com"));
startActivity(intent);
et1.setText("*******");
et2.setText("*******");
}
else
{
Toast.makeText(getApplicationContext(),"warning wrong password",Toast.LENGTH_SHORT).show();
}}
else
{
finish();
}
}
Button b1,b2;
EditText et1,et2;
String username,paswd;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
b1=(Button) findViewById(R.id.button1);
b1.setOnClickListener(this);
b2=(Button) findViewById(R.id.button2);
b2.setOnClickListener(this);
et1=(EditText) findViewById(R.id.editText1);
et2=(EditText) findViewById(R.id.editText2);
et1.setOnClickListener(this);
et2.setOnClickListener(this);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
}
}
import android.net.Uri;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
public class MainActivity extends Activity implements OnClickListener{
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
if (arg0.getId()==R.id.button2)
{
username=et1.getText().toString();
paswd=et2.getText().toString();
if(username.equals("sumeet")&& paswd.equals("123"))
{
Toast toast=Toast.makeText(getApplicationContext(),"success",Toast.LENGTH_SHORT);
toast.setMargin(50,50);
toast.show();
Intent intent=new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("http://www.facebook.com"));
startActivity(intent);
et1.setText("*******");
et2.setText("*******");
}
else
{
Toast.makeText(getApplicationContext(),"warning wrong password",Toast.LENGTH_SHORT).show();
}}
else
{
finish();
}
}
Button b1,b2;
EditText et1,et2;
String username,paswd;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
b1=(Button) findViewById(R.id.button1);
b1.setOnClickListener(this);
b2=(Button) findViewById(R.id.button2);
b2.setOnClickListener(this);
et1=(EditText) findViewById(R.id.editText1);
et2=(EditText) findViewById(R.id.editText2);
et1.setOnClickListener(this);
et2.setOnClickListener(this);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
}
}
Subscribe to:
Posts (Atom)
Earn money online through app sign up
Hey, I just transferred some money to a friend using Chillr. Its super quick and easy. Check it out. https://m.chillr.in/invite Hey! I...

