I want to lock the screen of the app on button click
I have written the code as
public class MainActivity extends DeviceAdminReceiver{
public void makeTest()
{
System.out.println("Entered Main Class");
}
public class Controller extends Activity {
static final int RESULT_ENABLE = 1;
Button powerOff;
int amountOfTime =20*1000;
Context context = this;
DevicePolicyManager mDPM;
ActivityManag
I have a button that links to another activity, when I click on it it goes to the layout.xml I want it to
This is the java file for the main/first screen
Button button;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
addListenerOnButton();
}
public void addListenerOnButton() {
final Context context
I am creating a simple app in eclipse but I am getting error at this line
b.setOnClickListener(new OnClickListener()
please have a look at the entire program
package com.example.activity2;
public class Main extends Activity {
//Called when the activity is first created.
My application works fine on an emulator but when i run it on tablet. I get nullpointer exception.
I've been trying to link 2 android activities and I've coded everything however It crashes when I tried to test it on an emulator. Could you guys please help me?
I have a very annoying problem with the android context menu: Randomly the pressed-state-color of a (pressed) entry in a context menu is wrong (darker as it should).
now after hours I can reproduce this behaviour with the following code:
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Button
I have made a program of simple alert box in android.now i have to put two buttons "OK" and "cancel" but when i run the program it only shows ,the "cancel" button...my code is as below:
Main.java
public class MainActivity extends Activity {
Button btn;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout
I'saw this code when looking at an Android example:
EditText editNumber;
Button btnCall = (Button) this.findViewById( R.id.btnCall);
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
editNumber = (EditText) this.findViewById(R.id.editNumber);
btnCall.setOnClickListener(
new OnClickLi
I have two activities:
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void click(View view) {
Intent intent= new Intent(this, TranslucentActivity.class);
startActivity(intent);
}
}
public class TranslucentActivity extends Activity