Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.hatinc.priem_ali.a20linesquran;
- import android.app.AlertDialog;
- import android.content.DialogInterface;
- import android.content.Intent;
- import android.graphics.Bitmap;
- import android.net.Uri;
- import android.support.v7.app.AppCompatActivity;
- import android.os.Bundle;
- import android.text.Editable;
- import android.text.InputType;
- import android.view.View;
- import android.widget.Button;
- import android.widget.EditText;
- import android.widget.Toast;
- import java.io.File;
- import java.io.IOException;
- public class Main_menu extends AppCompatActivity implements View.OnClickListener {
- private Button button1;
- private Button button2;
- private Button button3;
- private Button button4;
- private Button button5;
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main_menu);
- button1 = (Button)findViewById( R.id.button1 );
- button2 = (Button)findViewById( R.id.button2 );
- button3 = (Button)findViewById( R.id.button3 );
- button4 = (Button)findViewById( R.id.button4 );
- button5 = (Button)findViewById( R.id.button5 );
- button1.setOnClickListener( this );
- button2.setOnClickListener( this );
- button3.setOnClickListener( this );
- button4.setOnClickListener( this );
- button5.setOnClickListener( this );
- }
- @Override
- public void onClick(View v) {
- if ( v == button1 ) {
- // Handle clicks for button1
- Intent i = new Intent(this,MainActivity.class);
- startActivity(i);
- } else if ( v == button2 ) {
- save_in_extrenal_file db = new save_in_extrenal_file();
- db.datasaver("");
- } else if ( v == button3 ) {
- // Handle clicks for button3
- } else if ( v == button4 ) {
- // Handle clicks for button4
- } else if ( v == button5 ) {
- // Handle clicks for Go TO Page
- try {
- // Handle clicks for button2
- AlertDialog.Builder alert = new AlertDialog.Builder(this);
- final EditText edittext = new EditText(this);
- alert.setMessage("Go To Page No#\n اذهب إلى رقم الصفحة");
- alert.setTitle("HOLY QURAN القرآن الكريم");
- edittext.setInputType(InputType.TYPE_CLASS_NUMBER);
- alert.setView(edittext);
- alert.setPositiveButton("Search بحث", new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int whichButton) {
- //What ever you want to do with the value
- Editable YouEditTextValue = edittext.getText();
- Toast.makeText(getApplicationContext(),"You Entered "+YouEditTextValue,Toast.LENGTH_LONG).show();
- }
- });
- alert.setNegativeButton("Cancel إلغاء", new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int whichButton) {
- // what ever you want to do with No option.
- }
- });
- alert.show();
- } catch (Exception e) {
- Toast.makeText(getApplicationContext(),e.toString(),Toast.LENGTH_LONG).show();
- e.printStackTrace();
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment