Java Code Examples for android.view.View.OnClickListener

The following code examples are extracted from open source projects. You can click to vote up the examples that are useful to you.

Example 1

From project Barcamp-Bangalore-Android-App, under directory /slidingmenu/library/src/com/slidingmenu/lib/.

Source file: SlidingMenuActivity.java

  18 
vote

public SlidingMenuList(final Context context){
  super(context);
  setAdapter(new SlidingMenuListAdapter(context));
  setOnItemClickListener(new OnItemClickListener(){
    public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      OnClickListener listener=((SlidingMenuListAdapter)getAdapter()).getItem(position).mListener;
      if (listener != null)       listener.onClick(view);
    }
  }
);
}
 

Example 2

From project ActionBarSherlock, under directory /samples/fragments/src/com/actionbarsherlock/sample/fragments/.

Source file: FragmentAlertDialogSupport.java

  17 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  setTheme(SampleList.THEME);
  super.onCreate(savedInstanceState);
  setContentView(R.layout.fragment_dialog);
  View tv=findViewById(R.id.text);
  ((TextView)tv).setText("Example of displaying an alert dialog with a DialogFragment");
  Button button=(Button)findViewById(R.id.show);
  button.setOnClickListener(new OnClickListener(){
    public void onClick(    View v){
      showDialog();
    }
  }
);
}
 

Example 3

From project Airports, under directory /src/com/nadmm/airports/utils/.

Source file: ExternalStorageActivity.java

  17 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.external_storage_view);
  TextView tv=(TextView)findViewById(R.id.storage_desc_text);
  tv.setText("This application uses external SD card for storing it's databases. " + "As a result, it will not function if the external SD card is not available." + "\n\n"+ "The SD card is normally unavailable if the device is connected via USB to a "+ "computer and mounted as a storage device.");
  Button btnTryNow=(Button)findViewById(R.id.btn_trynow);
  btnTryNow.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      tryAgain();
    }
  }
);
}
 

Example 4

From project AlarmApp-Android, under directory /src/org/alarmapp/activities/.

Source file: AlarmActivity.java

  17 
vote

private OnClickListener onUpdateAlarmStatusClick(final AlarmState newState){
  return new OnClickListener(){
    public void onClick(    View v){
      IntentUtil.stopAudioPlayerService(AlarmActivity.this);
      setStateToRecentOpenAlarms(newState);
      updateButtonBarVisibility();
    }
  }
;
}
 

Example 5

From project Alerte-voirie-android, under directory /src/com/fabernovel/alertevoirie/.

Source file: CreditsActivity.java

  17 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.layout_credits);
  findViewById(R.id.button_contact).setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      Intent mail=new Intent(Intent.ACTION_SENDTO);
      mail.setData(Uri.parse(String.format("mailto:%s",getString(R.string.credits_email))));
      startActivity(mail);
    }
  }
);
}
 

Example 6

From project android-bankdroid, under directory /src/com/liato/bankdroid/.

Source file: LockableActivity.java

  17 
vote

@Override public void setContentView(int layoutResID){
  super.setContentView(layoutResID);
  getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE,R.layout.title);
  View titlebar=findViewById(R.id.layTitle);
  mTitlebarButtons=(LinearLayout)titlebar.findViewById(R.id.layTitleButtons);
  mInflater=(LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  mHomeButton=(ImageView)titlebar.findViewById(R.id.imgTitle);
  mHomeButtonCont=titlebar.findViewById(R.id.layLogoContainer);
  mProgressBar=(ProgressBar)titlebar.findViewById(R.id.progressBar);
  OnClickListener listener=new View.OnClickListener(){
    public void onClick(    View v){
      Intent intent=new Intent(LockableActivity.this,MainActivity.class);
      intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
      startActivity(intent);
      LockableActivity.this.finish();
    }
  }
;
  mHomeButton.setOnClickListener(listener);
  mHomeButtonCont.setOnClickListener(listener);
  setHomeButtonEnabled(true);
}
 

Example 7

From project android-cropimage, under directory /src/com/android/camera/.

Source file: Util.java

  17 
vote

public static synchronized OnClickListener getNullOnClickListener(){
  if (sNullOnClickListener == null) {
    sNullOnClickListener=new OnClickListener(){
      public void onClick(      View v){
      }
    }
;
  }
  return sNullOnClickListener;
}
 

Example 8

From project android-joedayz, under directory /Proyectos/Socrates/src/org/upc/socrates/.

Source file: MainActivity.java

  17 
vote

/** 
 * Called when the activity is first created. 
 */
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  theme=new Theme(getResources().getInteger(R.integer.theme));
  theme.onActivityCreateSetTheme(this);
  setContentView(R.layout.main);
  entrarButton=(Button)findViewById(R.id.entrarButton);
  entrarButton.setOnClickListener(new OnClickListener(){
    public void onClick(    View view){
      Intent intent=new Intent(MainActivity.this,AplicacionesListActivity.class);
      startActivity(intent);
    }
  }
);
}
 

Example 9

From project android-rackspacecloud, under directory /src/com/rackspacecloud/android/.

Source file: AccessControlActivity.java

  17 
vote

private void setupButton(){
  Button addRule=(Button)findViewById(R.id.add_rule_button);
  addRule.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      Intent viewIntent=new Intent(getContext(),AddAccessRuleActivity.class);
      viewIntent.putExtra("loadBalancer",loadBalancer);
      startActivityForResult(viewIntent,ADD_RULE);
    }
  }
);
}
 

Example 10

From project android-rindirect, under directory /rindirect-demo/app2/src/main/java/foo/app2/.

Source file: HelloAndroidActivity.java

  17 
vote

/** 
 * Called when the activity is first created.
 * @param savedInstanceState If the activity is being re-initialized afterpreviously being shut down then this Bundle contains the data it most recently supplied in onSaveInstanceState(Bundle). <b>Note: Otherwise it is null.</b>
 */
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  Log.i(TAG,"onCreate");
  setContentView(R.layout.app2);
  Button button=(Button)findViewById(R.id.goto_button);
  button.setOnClickListener(new OnClickListener(){
    public void onClick(    View v){
      launchActivityFromApp1();
    }
  }
);
}
 

Example 11

From project android-xbmcremote, under directory /src/org/xbmc/android/remote/presentation/controller/.

Source file: HomeController.java

  17 
vote

public View.OnClickListener getOnHostChangeListener(){
  return new OnClickListener(){
    public void onClick(    View v){
      openHostChanger();
    }
  }
;
}
 

Example 12

From project android-xbmcremote-sandbox, under directory /src/org/xbmc/android/remotesandbox/ui/tablet/.

Source file: DashboardFragment.java

  17 
vote

private void setupLastestAlbums(DashboardBoxLayout musicBox){
  final ListView list=(ListView)musicBox.findViewById(R.id.dashboardbox_list);
  final Cursor c=getActivity().getContentResolver().query(AudioContract.Albums.CONTENT_URI,AlbumsQuery.PROJECTION,null,null,AudioContract.Albums.SORT_LATEST_FIRST);
  list.setAdapter(new AlbumsAdapter(getActivity().getApplicationContext(),c));
  musicBox.setOnTitlebarClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      getActivity().startActivity(new Intent(v.getContext(),MusicPagerActivity.class));
    }
  }
);
}
 

Example 13

From project Android_1, under directory /ContactSelector/src/com/novoda/.

Source file: ContactSelector.java

  17 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main);
  btnContacts=(Button)findViewById(R.id.btn_contacts);
  txtContacts=(TextView)findViewById(R.id.txt_contacts);
  btnContacts.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View arg0){
      Intent intent=new Intent(Intent.ACTION_PICK,People.CONTENT_URI);
      startActivityForResult(intent,PICK_CONTACT);
    }
  }
);
}
 

Example 14

From project android_packages_apps_Gallery, under directory /src/com/android/camera/.

Source file: Util.java

  17 
vote

public static synchronized OnClickListener getNullOnClickListener(){
  if (sNullOnClickListener == null) {
    sNullOnClickListener=new OnClickListener(){
      public void onClick(      View v){
      }
    }
;
  }
  return sNullOnClickListener;
}
 

Example 15

From project android_packages_apps_Gallery2, under directory /src/com/android/gallery3d/ui/.

Source file: CustomMenu.java

  17 
vote

public DropDownMenu(Context context,Button button,int menuId,OnMenuItemClickListener listener){
  mButton=button;
  mPopupMenu=new PopupMenu(context,mButton);
  mMenu=mPopupMenu.getMenu();
  mPopupMenu.getMenuInflater().inflate(menuId,mMenu);
  mPopupMenu.setOnMenuItemClickListener(listener);
  mButton.setOnClickListener(new OnClickListener(){
    public void onClick(    View v){
      mPopupMenu.show();
    }
  }
);
}
 

Example 16

From project Backyard-Brains-Android-App, under directory /src/com/backyardbrains/view/.

Source file: UIFactory.java

  17 
vote

public static void setupRecordingButtons(final BackyardAndroidActivity context){
  OnClickListener recordingToggle=new OnClickListener(){
    @Override public void onClick(    View v){
      context.toggleRecording();
    }
  }
;
  ImageButton mRecordButton=(ImageButton)context.findViewById(R.id.recordButton);
  mRecordButton.setOnClickListener(recordingToggle);
  OnClickListener fileViewclick=new OnClickListener(){
    public void onClick(    View view){
      Intent i=new Intent(view.getContext(),FileListActivity.class);
      context.startActivityForResult(i,0);
    }
  }
;
  ImageButton mFileButton=(ImageButton)context.findViewById(R.id.fileButton);
  mFileButton.setOnClickListener(fileViewclick);
  View tapToStopRecView=context.findViewById(R.id.TapToStopRecordingTextView);
  tapToStopRecView.setOnClickListener(recordingToggle);
}
 

Example 17

From project 2Degrees-Toolbox, under directory /Toolbox/src/biz/shadowservices/DegreesToolbox/Preferences/.

Source file: WidgetPreferencesActivity.java

  16 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.widget_preferences);
  Button save=(Button)findViewById(R.id.widgetPrefsSave);
  save.setOnClickListener(saveListener);
  Button cancel=(Button)findViewById(R.id.widgetPrefsCancel);
  cancel.setOnClickListener(cancelListener);
  SeekBar s=(SeekBar)findViewById(R.id.transparencySeekBar);
  s.setOnSeekBarChangeListener(new OnSeekBarChangeListener(){
    @Override public void onProgressChanged(    SeekBar seekBar,    int progress,    boolean fromUser){
      TextView transparencyTextView=(TextView)((View)seekBar.getParent()).findViewById(R.id.transparencyPercentageText);
      transparencyTextView.setText(Integer.toString(progress));
    }
    @Override public void onStartTrackingTouch(    SeekBar seekBar){
    }
    @Override public void onStopTrackingTouch(    SeekBar seekBar){
    }
  }
);
  Gallery g=(Gallery)findViewById(R.id.gallery);
  g.setAdapter(new ImageAdapter(this));
  g.setOnItemClickListener(new OnItemClickListener(){
    public void onItemClick(    AdapterView<?> parent,    View v,    int position,    long id){
      View parentObj=(View)parent.getParent();
      if (parent != null) {
        ImageView preview=(ImageView)parentObj.findViewById(R.id.previewImage);
        preview.setImageResource(Values.backgroundIds[position]);
      }
    }
  }
);
  Button editTextColour=(Button)findViewById(R.id.widgetPreferencesSetTextColor);
  editTextColour.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      AmbilWarnaDialog dialog=new AmbilWarnaDialog(v.getContext(),widget.getTextColor(v.getContext()),onColorSelected);
      dialog.show();
    }
  }
);
}
 

Example 18

From project abalone-android, under directory /src/com/bytopia/abalone/.

Source file: MainMenuActivity.java

  16 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  mainMenuActivity=this;
  setContentView(R.layout.menu);
  Button newGameButtonHuman=(Button)findViewById(R.id.n_game_human);
  newGameButtonHuman.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      Intent intent=new Intent("com.bytopia.abalone.GAMEOPTIONS");
      intent.putExtra("vs","human");
      startActivity(intent);
    }
  }
);
  Button newGameButtonCpu=(Button)findViewById(R.id.n_game_cpu);
  newGameButtonCpu.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      Intent intent=new Intent("com.bytopia.abalone.GAMEOPTIONS");
      intent.putExtra("vs","cpu");
      startActivity(intent);
    }
  }
);
  Button resumeButton=(Button)findViewById(R.id.resume_game);
  resumeButton.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      Intent intent=new Intent("com.bytopia.abalone.RESUMEGAME");
      intent.putExtra("type","resume");
      startActivity(intent);
    }
  }
);
  Button tutorialButton=(Button)findViewById(R.id.tutorial);
  tutorialButton.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      Intent intent=new Intent("com.bytopia.abalone.TUTORIAL");
      startActivity(intent);
    }
  }
);
}
 

Example 19

From project Absolute-Android-RSS, under directory /src/com/AA/Activities/.

Source file: AAMain.java

  16 
vote

/** 
 * Called when the activity is created and put into memory. This is where all GUI elements should be set up and any other member variables that is used throughout the class
 */
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main);
  articles=new ArrayList<Article>();
  settings=this.getSharedPreferences("settings",0);
  AlarmReceiver.stopAlarm(this);
  adapter=new ArticleAdapter(this);
  this.setListAdapter(adapter);
  ib_refresh=(ImageButton)findViewById(R.id.ib_refresh);
  TextView tv=(TextView)findViewById(R.id.AATitle);
  Typeface face=Typeface.createFromAsset(getAssets(),"fonts/WREXHAM_.TTF");
  tv.setTypeface(face);
  finishReceiver=new BroadcastReceiver(){
    @Override public void onReceive(    Context context,    Intent intent){
      articles.clear();
      Bundle articleBundle=intent.getBundleExtra("articles");
      ArrayList<String> titles=articleBundle.getStringArrayList("titles");
      for (      String title : titles)       articles.add((Article)articleBundle.getSerializable(title));
      progressDialog.cancel();
      refresh();
    }
  }
;
  this.registerReceiver(finishReceiver,new IntentFilter("RSSFinish"));
  ib_refresh.setOnClickListener(new OnClickListener(){
    /** 
 * Handles when the user clicks the refresh button
 * @param v - view that was clicked
 */
    @Override public void onClick(    View v){
      runService();
    }
  }
);
  runService();
}
 

Example 20

From project AChartEngine, under directory /client/src/org/achartengine/demo/.

Source file: Demo.java

  16 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  getWindow().requestFeature(Window.FEATURE_LEFT_ICON);
  setContentView(R.layout.main);
  getWindow().setFeatureDrawableResource(Window.FEATURE_LEFT_ICON,R.drawable.titlebar_icon);
  findViewById(R.id.button_multiseries_data_provider).setOnClickListener(new OnClickListener(){
    public void onClick(    View v){
      Uri u=DataContentProvider.BASE_URI.buildUpon().appendPath(DataContentProvider.CHART_DATA_MULTISERIES_PATH).appendPath(DataContentProvider.CHART_DATA_UNLABELED_PATH).build();
      Intent i=new Intent(Intent.ACTION_VIEW,u);
      i.putExtra(Intent.EXTRA_TITLE,TemperatureData.DEMO_CHART_TITLE);
      startActivity(i);
    }
  }
);
  findViewById(R.id.button_labeled_multiseries_data_provider).setOnClickListener(new OnClickListener(){
    public void onClick(    View v){
      Uri u=DataContentProvider.BASE_URI.buildUpon().appendPath(DataContentProvider.CHART_DATA_MULTISERIES_PATH).appendPath(DataContentProvider.CHART_DATA_LABELED_PATH).build();
      Intent i=new Intent(Intent.ACTION_VIEW,u);
      i.putExtra(Intent.EXTRA_TITLE,DonutData.DEMO_CHART_TITLE);
      startActivity(i);
    }
  }
);
}
 

Example 21

From project adg-android, under directory /src/com/analysedesgeeks/android/.

Source file: AboutActivity.java

  16 
vote

@Override protected void onCreate(final Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_about);
  moogAudioIV.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    final View v){
      ActivityController.onUrlClicked(AboutActivity.this,Const.MOOG_AUDIO_URL);
    }
  }
);
  cipcIV.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    final View v){
      ActivityController.onUrlClicked(AboutActivity.this,Const.CIPC_URL);
    }
  }
);
  aboutTV.setText(Html.fromHtml(REALISED_BY_HTML));
  Linkify.addLinks(aboutTV,0);
  aboutTV.setMovementMethod(LinkMovementMethod.getInstance());
}
 

Example 22

From project and-bible, under directory /tests/Buttons/src/org/andbible/buttons/.

Source file: CustomTitlebarActivityBase.java

  16 
vote

/** 
 * custom title bar code to add the FEATURE_CUSTOM_TITLE just before setContentView and set the new titlebar layout just after
 */
@Override public void setContentView(int layoutResID){
  requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
  super.setContentView(layoutResID);
  getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE,R.layout.title_bar);
  mDocumentTitleLink=(Button)findViewById(R.id.titleDocument);
  mPageTitleLink=(Button)findViewById(R.id.titlePassage);
  mProgressBarIndeterminate=(ProgressBar)findViewById(R.id.progressCircular);
  mQuickBibleChangeLink=(Button)findViewById(R.id.quickBibleChange);
  mQuickCommentaryChangeLink=(Button)findViewById(R.id.quickCommentaryChange);
  mDocumentTitleLink.setOnClickListener(new OnClickListener(){
    public void onClick(    View v){
    }
  }
);
  mPageTitleLink.setOnClickListener(new OnClickListener(){
    public void onClick(    View v){
    }
  }
);
  mQuickBibleChangeLink.setOnClickListener(new OnClickListener(){
    public void onClick(    View v){
    }
  }
);
  mQuickCommentaryChangeLink.setOnClickListener(new OnClickListener(){
    public void onClick(    View v){
    }
  }
);
}
 

Example 23

From project andlytics, under directory /src/com/github/andlyticsproject/.

Source file: AdmobActivity.java

  16 
vote

protected void showAccountList(){
  final AccountManager manager=AccountManager.get(this);
  final Account[] accounts=manager.getAccountsByType(Constants.ACCOUNT_TYPE_ADMOB);
  final int size=accounts.length;
  String[] names=new String[size];
  accountList.removeAllViews();
  for (int i=0; i < size; i++) {
    names[i]=accounts[i].name;
    View inflate=getLayoutInflater().inflate(R.layout.admob_account_list_item,null);
    TextView accountName=(TextView)inflate.findViewById(R.id.admob_account_list_item_text);
    accountName.setText(accounts[i].name);
    inflate.setTag(accounts[i].name);
    inflate.setOnClickListener(new OnClickListener(){
      @Override public void onClick(      View view){
        String currentAdmobAccount=(String)view.getTag();
        configSwitcher.showNext();
        new LoadRemoteSiteListTask(currentAdmobAccount).execute();
      }
    }
);
    accountList.addView(inflate);
  }
}
 

Example 24

From project Android, under directory /app/src/main/java/com/github/mobile/ui/code/.

Source file: RepositoryCodeFragment.java

  16 
vote

@Override public void onViewCreated(View view,Bundle savedInstanceState){
  super.onViewCreated(view,savedInstanceState);
  ViewFinder finder=new ViewFinder(view);
  progressView=finder.find(id.pb_loading);
  listView=finder.find(android.R.id.list);
  listView.setOnItemClickListener(this);
  Activity activity=getActivity();
  adapter=new HeaderFooterListAdapter<CodeTreeAdapter>(listView,new CodeTreeAdapter(activity));
  branchFooterView=finder.find(id.rl_branch);
  branchView=finder.find(id.tv_branch);
  branchIconView=finder.find(id.tv_branch_icon);
  branchFooterView.setOnClickListener(new OnClickListener(){
    public void onClick(    View v){
      switchBranches();
    }
  }
);
  pathHeaderView=activity.getLayoutInflater().inflate(layout.path_item,null);
  pathView=(TextView)pathHeaderView.findViewById(id.tv_path);
  pathView.setMovementMethod(LinkMovementMethod.getInstance());
  if (pathShowing)   adapter.addHeader(pathHeaderView);
  TypefaceUtils.setOcticons(branchIconView,(TextView)pathHeaderView.findViewById(id.tv_folder_icon));
  listView.setAdapter(adapter);
}
 

Example 25

From project android-aac-enc, under directory /src/com/todoroo/aacenc/.

Source file: Main.java

  16 
vote

/** 
 * Called when the activity is first created. 
 */
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main);
  File dir=getFilesDir();
  AAC_FILE=dir.toString() + "/audio.aac";
  findViewById(R.id.write).setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      write();
    }
  }
);
  findViewById(R.id.play).setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      play();
    }
  }
);
  sr=SpeechRecognizer.createSpeechRecognizer(this);
}
 

Example 26

From project android-api_1, under directory /Example/src/com/example/CatchApiDemo/.

Source file: Dashboard.java

  16 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main);
  final Button signInButton=(Button)findViewById(R.id.sign_in_button);
  signInButton.setOnClickListener(new OnClickListener(){
    public void onClick(    View v){
      showDialog(DIALOG_SIGN_IN);
    }
  }
);
  final Button fetchButton=(Button)findViewById(R.id.fetch_button);
  fetchButton.setOnClickListener(new OnClickListener(){
    public void onClick(    View v){
      if (mAccessToken == null) {
        Toast.makeText(Dashboard.this,"Not signed in!",Toast.LENGTH_SHORT).show();
      }
 else {
        new FetchNotesTask(getApplicationContext()).execute();
      }
    }
  }
);
  final Button createButton=(Button)findViewById(R.id.create_button);
  createButton.setOnClickListener(new OnClickListener(){
    public void onClick(    View v){
      if (mAccessToken == null) {
        Toast.makeText(Dashboard.this,"Not signed in!",Toast.LENGTH_SHORT).show();
      }
 else {
        showDialog(DIALOG_COMPOSE_NOTE);
      }
    }
  }
);
}
 

Example 27

From project Android-automation, under directory /TmtsApp/src/com/taobao/tmts/framework/app/.

Source file: TextViewActivity.java

  16 
vote

private void init(){
  final String[] strings=new String[]{"abc","abd","abe","bcd","bce","bcf"};
  ArrayAdapter<String> adapter=new ArrayAdapter<String>(this,android.R.layout.simple_dropdown_item_1line,strings);
  textView=(TextView)findViewById(R.id.my_textview);
  editText=(EditText)findViewById(R.id.my_edittext);
  autoCompleteTextView=(AutoCompleteTextView)findViewById(R.id.my_autocompletetextview);
  checkedTextView=(CheckedTextView)findViewById(R.id.my_checkedtextview);
  multiAutoCompleteTextView=(MultiAutoCompleteTextView)findViewById(R.id.my_multiautocompletetextview);
  checkedTextView.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      checkedTextView.toggle();
      if (checkedTextView.isChecked()) {
        checkedTextView.setText("Checked");
      }
 else {
        checkedTextView.setText("Unchecked");
      }
    }
  }
);
  autoCompleteTextView.setAdapter(adapter);
  multiAutoCompleteTextView.setAdapter(adapter);
  multiAutoCompleteTextView.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());
}
 

Example 28

From project android-client, under directory /xwiki-android-client/src/org/xwiki/android/client/blog/.

Source file: Blogger.java

  16 
vote

private void showRetreiveDialog(){
  ret_dialog=new Dialog(this);
  ret_dialog.getWindow().setFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND,WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
  ret_dialog.setTitle("Page to retreive");
  LayoutInflater li=(LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  View dialogView=li.inflate(R.layout.blog_retreive_dialog,null);
  ret_dialog.setContentView(dialogView);
  ret_dialog.show();
  Button okBtn=(Button)dialogView.findViewById(R.id.blg_ret_btn_ok);
  etPageName=(EditText)dialogView.findViewById(R.id.blg_ret_et_pageName);
  okBtn.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      DocumentReference dref=new DocumentReference("xwiki","Blog",etPageName.getText().toString());
      DocumentRemoteSvcCallbacks clbk=new DocumentRemoteSvcCallbacks(){
        @Override public void onFullyRetreived(        Document res,        boolean success,        RaoException ex){
          if (success) {
            ret_dialog.dismiss();
            progDialog.dismiss();
            Intent i=new Intent(Blogger.this,EditPostActivity.class);
            i.putExtra(EditPostActivity.ARG_UPDATE_DOC,res);
            startActivity(i);
          }
 else {
            progDialog.dismiss();
          }
        }
      }
;
      progDialog=ProgressDialog.show(Blogger.this,"Processing","Fetching document from server");
      dsvc.retreive(dref,clbk);
    }
  }
);
}
 

Example 29

From project Android-FFXIEQ, under directory /ffxieq/src/com/github/kanata3249/ffxieq/android/.

Source file: AugmentEditActivity.java

  16 
vote

@Override protected void onStart(){
  super.onStart();
  if (mAugID >= 0) {
    Equipment aug=getDAO().instantiateEquipment(mBaseID,mAugID);
    Equipment base=getDAO().instantiateEquipment(aug.getId(),-1);
    if (!aug.getName().equals(base.getName())) {
      base=getDAO().findEquipment(aug.getName(),aug.getLevel(),aug.getPart(),aug.getWeapon());
      if (base == null) {
        showDialog(R.string.BaseEquipmentNotFound);
      }
 else {
        ((FFXIDatabase)getDAO()).saveAugment(aug.getAugId(),aug.getAugment(),base.getId());
      }
    }
  }
  updateViews();
{
    Button btn;
    btn=(Button)findViewById(R.id.Save);
    btn.setOnClickListener(new OnClickListener(){
      public void onClick(      View v){
        long newId=saveAugment();
        Intent result=new Intent();
        result.putExtra("From","AugmentEditActivity");
        result.putExtra("Part",mPart);
        result.putExtra("BaseId",mBaseID);
        result.putExtra("AugId",newId);
        setResult(RESULT_OK,result);
        finish();
      }
    }
);
  }
}
 

Example 30

From project android-flash-cards, under directory /src/org/thomasamsler/android/flashcards/fragment/.

Source file: AboutFragment.java

  16 
vote

@Override public void onActivityCreated(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  String version=null;
  try {
    version=getActivity().getPackageManager().getPackageInfo(getActivity().getPackageName(),0).versionName;
  }
 catch (  NameNotFoundException e) {
    Log.w(AppConstants.LOG_TAG,"Exception accessing version information",e);
  }
  TextView versionTextView=(TextView)getActivity().findViewById(R.id.textViewAboutVersion);
  versionTextView.append(version);
  ImageButton imageButtonCancel=(ImageButton)getActivity().findViewById(R.id.imageButtonAboutClose);
  imageButtonCancel.setOnClickListener(new OnClickListener(){
    public void onClick(    View v){
      ((MainApplication)getActivity().getApplication()).doAction(ACTION_SHOW_CARD_SETS,Boolean.TRUE);
    }
  }
);
}
 

Example 31

From project Android-RTMP, under directory /android-ffmpeg-prototype/src/com/camundo/.

Source file: FFMPEGPrototype.java

  16 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main);
  audioActivityButton=(Button)findViewById(R.id.audioActivityButton);
  audioActivityButton.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      Intent intent=new Intent();
      intent.setClass(getBaseContext(),AudioActivity.class);
      startActivity(intent);
    }
  }
);
  videoActivityButton=(Button)findViewById(R.id.videoActivityButton);
  videoActivityButton.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
    }
  }
);
}
 

Example 32

From project Android-Simple-Social-Sharing, under directory /SimpleSocialSharingExample/src/com/nostra13/example/socialsharing/.

Source file: HomeActivity.java

  16 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.ac_home);
  findViewById(R.id.button_share_facebook).setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      startFacebookActivity();
    }
  }
);
  findViewById(R.id.button_share_twitter).setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      startTwitterActivity();
    }
  }
);
  facebookEventObserver=FacebookEventObserver.newInstance();
  twitterEventObserver=TwitterEventObserver.newInstance();
}
 

Example 33

From project Android-Terminal-Emulator, under directory /examples/intents/src/jackpal/androidterm/sample/intents/.

Source file: IntentSampleActivity.java

  16 
vote

/** 
 * Called when the activity is first created. 
 */
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main);
  addClickListener(R.id.openNewWindow,new OnClickListener(){
    public void onClick(    View v){
      Intent intent=new Intent("jackpal.androidterm.OPEN_NEW_WINDOW");
      intent.addCategory(Intent.CATEGORY_DEFAULT);
      startActivity(intent);
    }
  }
);
  final EditText script=(EditText)findViewById(R.id.script);
  script.setText(getString(R.string.default_script));
  addClickListener(R.id.runScript,new OnClickListener(){
    public void onClick(    View v){
      Intent intent=new Intent("jackpal.androidterm.RUN_SCRIPT");
      intent.addCategory(Intent.CATEGORY_DEFAULT);
      String command=script.getText().toString();
      intent.putExtra("jackpal.androidterm.iInitialCommand",command);
      startActivity(intent);
    }
  }
);
  addClickListener(R.id.runScriptSaveWindow,new OnClickListener(){
    public void onClick(    View v){
      Intent intent=new Intent("jackpal.androidterm.RUN_SCRIPT");
      intent.addCategory(Intent.CATEGORY_DEFAULT);
      String command=script.getText().toString();
      intent.putExtra("jackpal.androidterm.iInitialCommand",command);
      if (mHandle != null) {
        intent.putExtra("jackpal.androidterm.window_handle",mHandle);
      }
      startActivityForResult(intent,REQUEST_WINDOW_HANDLE);
    }
  }
);
}
 

Example 34

From project android-voip-service, under directory /src/main/java/org/linphone/core/tutorials/.

Source file: TestVideoActivity.java

  16 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.videotest);
  surfaceView=(SurfaceView)findViewById(R.id.videotest_surfaceView);
  nextSize=(Button)findViewById(R.id.test_video_size);
  nextSize.setOnClickListener(this);
  changeCamera=(Button)findViewById(R.id.test_video_camera);
  changeCamera.setText("Cam" + otherCameraId(currentCameraId));
  changeCamera.setOnClickListener(new OnClickListener(){
    public void onClick(    View v){
      changeCamera.setText("Cam" + currentCameraId);
      currentCameraId=otherCameraId(currentCameraId);
      updateRecording();
    }
  }
);
  changeOrientation=(Button)findViewById(R.id.test_video_orientation);
  changeOrientation.setText(orientationToString(!currentOrientationIsPortrait));
  changeOrientation.setOnClickListener(new OnClickListener(){
    public void onClick(    View v){
      currentOrientationIsPortrait=!currentOrientationIsPortrait;
      changeOrientation.setText(orientationToString(!currentOrientationIsPortrait));
      if (width == 0 || height == 0)       return;
      int newWidth=currentOrientationIsPortrait ? Math.min(height,width) : Math.max(height,width);
      int newHeight=currentOrientationIsPortrait ? Math.max(height,width) : Math.min(height,width);
      changeSurfaceViewLayout(newWidth,newHeight);
    }
  }
);
  SurfaceHolder holder=surfaceView.getHolder();
  holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
  holder.addCallback(this);
  debugView=(TextView)findViewById(R.id.videotest_debug);
}
 

Example 35

From project android-wheel, under directory /wheel-demo/src/kankan/wheel/demo/.

Source file: PasswActivity.java

  16 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.passw_layout);
  initWheel(R.id.passw_1);
  initWheel(R.id.passw_2);
  initWheel(R.id.passw_3);
  initWheel(R.id.passw_4);
  Button mix=(Button)findViewById(R.id.btn_mix);
  mix.setOnClickListener(new OnClickListener(){
    public void onClick(    View v){
      mixWheel(R.id.passw_1);
      mixWheel(R.id.passw_2);
      mixWheel(R.id.passw_3);
      mixWheel(R.id.passw_4);
    }
  }
);
  updateStatus();
}
 

Example 36

From project android-wheel_1, under directory /wheel-demo/src/kankan/wheel/demo/.

Source file: PasswActivity.java

  16 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.passw_layout);
  initWheel(R.id.passw_1);
  initWheel(R.id.passw_2);
  initWheel(R.id.passw_3);
  initWheel(R.id.passw_4);
  Button mix=(Button)findViewById(R.id.btn_mix);
  mix.setOnClickListener(new OnClickListener(){
    public void onClick(    View v){
      mixWheel(R.id.passw_1);
      mixWheel(R.id.passw_2);
      mixWheel(R.id.passw_3);
      mixWheel(R.id.passw_4);
    }
  }
);
  updateStatus();
}
 

Example 37

From project AndroidBillingLibrary, under directory /DungeonsRedux/src/net/robotmedia/billing/example/.

Source file: Dungeons.java

  16 
vote

private void setupWidgets(){
  mBuyButton=(Button)findViewById(R.id.buy_button);
  mBuyButton.setEnabled(false);
  mBuyButton.setOnClickListener(new OnClickListener(){
    public void onClick(    View v){
      if (mSelectedItem.managed != Managed.SUBSCRIPTION) {
        BillingController.requestPurchase(Dungeons.this,mSelectedItem.sku,true,null);
      }
 else {
        BillingController.requestSubscription(Dungeons.this,mSelectedItem.sku,true,null);
      }
    }
  }
);
  mSelectItemSpinner=(Spinner)findViewById(R.id.item_choices);
  mCatalogAdapter=new CatalogAdapter(this,CatalogEntry.CATALOG);
  mSelectItemSpinner.setAdapter(mCatalogAdapter);
  mSelectItemSpinner.setOnItemSelectedListener(new OnItemSelectedListener(){
    public void onItemSelected(    AdapterView<?> parent,    View view,    int position,    long id){
      mSelectedItem=CatalogEntry.CATALOG[position];
    }
    public void onNothingSelected(    AdapterView<?> arg0){
    }
  }
);
  mOwnedItemsTable=(ListView)findViewById(R.id.owned_items);
}
 

Example 38

From project androidquery, under directory /demo/src/com/androidquery/test/.

Source file: ListenerTestActivity.java

  16 
vote

private void setupTest(){
  AQUtility.setDebug(true);
  aq=new AQuery(this);
  aq.id(R.id.image1).text("Hihi");
  aq.id(R.id.clicked1).clicked(this,"clicked1");
  aq.id(R.id.clicked2).clicked(new OnClickListener(){
    @Override public void onClick(    View v){
      TestUtility.showToast(ListenerTestActivity.this,"pass");
    }
  }
);
  aq.id(R.id.image_reload).clicked(this,"reloadImage");
  aq.id(R.id.image_clear_mem).clicked(this,"clearMem");
  aq.id(R.id.image_clear_disk).clicked(this,"clearDisk");
  aq.id(R.id.async_bytes).clicked(this,"asyncBytes");
  aq.id(R.id.async_json).clicked(this,"asyncJson");
  aq.id(R.id.async_bad_json).clicked(this,"asyncBadJson");
  aq.id(R.id.async_bm).clicked(this,"asyncBitmap");
  aq.id(R.id.async_html).clicked(this,"asyncHtml");
  aq.id(R.id.async_post).clicked(this,"asyncPost");
  loadImage();
}
 

Example 39

From project android_ioio_combination_lock, under directory /src/net/mitchtech/ioio/.

Source file: CombinationLockActivity.java

  16 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main);
  initWheel(R.id.pin_0);
  initWheel(R.id.pin_1);
  initWheel(R.id.pin_2);
  initWheel(R.id.pin_3);
  Button btnMix=(Button)findViewById(R.id.btn_random);
  btnMix.setOnClickListener(new OnClickListener(){
    public void onClick(    View v){
      mixWheel(R.id.pin_0);
      mixWheel(R.id.pin_1);
      mixWheel(R.id.pin_2);
      mixWheel(R.id.pin_3);
    }
  }
);
  Button btnReset=(Button)findViewById(R.id.btn_reset);
  btnReset.setOnClickListener(new OnClickListener(){
    public void onClick(    View v){
      setWheel(R.id.pin_0,0);
      setWheel(R.id.pin_1,0);
      setWheel(R.id.pin_2,0);
      setWheel(R.id.pin_3,0);
    }
  }
);
}
 

Example 40

From project andstatus, under directory /src/org/andstatus/app/.

Source file: SplashMoreActivity.java

  16 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  requestWindowFeature(Window.FEATURE_NO_TITLE);
  setContentView(R.layout.splash_more);
  mFlipper=((ViewFlipper)this.findViewById(R.id.splash_more_flipper));
  AlphaAnimation anim=(AlphaAnimation)AnimationUtils.loadAnimation(SplashMoreActivity.this,R.anim.fade_in);
  findViewById(R.id.splash_container).startAnimation(anim);
  final Button getstarted=(Button)findViewById(R.id.button_splash_get_started);
  getstarted.setOnClickListener(new OnClickListener(){
    public void onClick(    View v){
      startActivity(new Intent(SplashMoreActivity.this,PreferencesActivity.class));
      finish();
    }
  }
);
  final Button learn_more=(Button)findViewById(R.id.button_splash_learn_more);
  learn_more.setOnClickListener(new OnClickListener(){
    public void onClick(    View v){
      mFlipper.showNext();
    }
  }
);
}
 

Example 41

From project andtweet, under directory /src/com/xorcode/andtweet/.

Source file: SplashMoreActivity.java

  16 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  requestWindowFeature(Window.FEATURE_NO_TITLE);
  setContentView(R.layout.splash_more);
  mFlipper=((ViewFlipper)this.findViewById(R.id.splash_more_flipper));
  AlphaAnimation anim=(AlphaAnimation)AnimationUtils.loadAnimation(SplashMoreActivity.this,R.anim.fade_in);
  findViewById(R.id.splash_container).startAnimation(anim);
  final Button getstarted=(Button)findViewById(R.id.button_splash_get_started);
  getstarted.setOnClickListener(new OnClickListener(){
    public void onClick(    View v){
      startActivity(new Intent(SplashMoreActivity.this,PreferencesActivity.class));
      finish();
    }
  }
);
  final Button learn_more=(Button)findViewById(R.id.button_splash_learn_more);
  learn_more.setOnClickListener(new OnClickListener(){
    public void onClick(    View v){
      mFlipper.showNext();
    }
  }
);
}
 

Example 42

From project Anki-Android, under directory /src/com/ichi2/anki/.

Source file: MyAccount.java

  16 
vote

private void initAllContentViews(){
  mLoginToMyAccountView=getLayoutInflater().inflate(R.layout.my_account,null);
  mUsername=(EditText)mLoginToMyAccountView.findViewById(R.id.username);
  mPassword=(EditText)mLoginToMyAccountView.findViewById(R.id.password);
  Button loginButton=(Button)mLoginToMyAccountView.findViewById(R.id.login_button);
  loginButton.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      login();
    }
  }
);
  Button signUpButton=(Button)mLoginToMyAccountView.findViewById(R.id.sign_up_button);
  signUpButton.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      startActivity(new Intent(Intent.ACTION_VIEW,Uri.parse(getResources().getString(R.string.ankionline_sign_up_url))));
    }
  }
);
  mLoggedIntoMyAccountView=getLayoutInflater().inflate(R.layout.my_account_logged_in,null);
  mUsernameLoggedIn=(TextView)mLoggedIntoMyAccountView.findViewById(R.id.username_logged_in);
  Button logoutButton=(Button)mLoggedIntoMyAccountView.findViewById(R.id.logout_button);
  logoutButton.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      logout();
    }
  }
);
}
 

Example 43

From project AnySoftKeyboard, under directory /src/com/anysoftkeyboard/ui/settings/.

Source file: UserDictionaryEditorActivity.java

  16 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.user_dictionary_editor);
  mLangs=(Spinner)findViewById(R.id.user_dictionay_langs);
  mLangs.setOnItemSelectedListener(new OnItemSelectedListener(){
    public void onItemSelected(    AdapterView<?> arg0,    View arg1,    int arg2,    long arg3){
      mSelectedLocale=arg0.getItemAtPosition(arg2).toString();
      fillWordsList();
    }
    public void onNothingSelected(    AdapterView<?> arg0){
      Log.d(TAG,"No locale selected");
      mSelectedLocale=null;
    }
  }
);
  findViewById(R.id.add_user_word).setOnClickListener(new OnClickListener(){
    public void onClick(    View v){
      showAddOrEditDialog(null);
    }
  }
);
  findViewById(R.id.backup_words).setOnClickListener(new OnClickListener(){
    public void onClick(    View v){
      new BackupUserWordsAsyncTask(UserDictionaryEditorActivity.this).execute();
    }
  }
);
  findViewById(R.id.restore_words).setOnClickListener(new OnClickListener(){
    public void onClick(    View v){
      new RestoreUserWordsAsyncTask(UserDictionaryEditorActivity.this).execute();
    }
  }
);
  TextView emptyView=(TextView)findViewById(R.id.empty_user_dictionary);
  ListView listView=getListView();
  listView.setFastScrollEnabled(true);
  listView.setEmptyView(emptyView);
}
 

Example 44

From project apg, under directory /src/org/thialfihar/android/apg/.

Source file: KeyListActivity.java

  16 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.key_list);
  setDefaultKeyMode(DEFAULT_KEYS_SEARCH_LOCAL);
  mList=(ExpandableListView)findViewById(R.id.list);
  registerForContextMenu(mList);
  mFilterLayout=findViewById(R.id.layout_filter);
  mFilterInfo=(TextView)mFilterLayout.findViewById(R.id.filterInfo);
  mClearFilterButton=(Button)mFilterLayout.findViewById(R.id.btn_clear);
  mClearFilterButton.setOnClickListener(new OnClickListener(){
    public void onClick(    View v){
      handleIntent(new Intent());
    }
  }
);
  handleIntent(getIntent());
}
 

Example 45

From project apps-for-android, under directory /CLiCkin2DaBeaT/src/com/google/clickin2dabeat/.

Source file: CreateC2BFile.java

  16 
vote

@Override public void onCreate(Bundle icicle){
  super.onCreate(icicle);
  dataSource=this.getIntent().getData().toString();
  setContentView(R.layout.c2b_creator_form);
  Button create=((Button)findViewById(R.id.CreateButton));
  create.setOnClickListener(new OnClickListener(){
    public void onClick(    View arg0){
      String title=((EditText)findViewById(R.id.TitleEditText)).getText().toString();
      String author=((EditText)findViewById(R.id.AuthorEditText)).getText().toString();
      if (!title.equals("") && !author.equals("")) {
        createC2BSkeleton(title,author,dataSource);
        finish();
      }
    }
  }
);
  Button cancel=((Button)findViewById(R.id.CancelButton));
  cancel.setOnClickListener(new OnClickListener(){
    public void onClick(    View arg0){
      finish();
    }
  }
);
}
 

Example 46

From project BART, under directory /src/pro/dbro/bart/.

Source file: TheActivity.java

  16 
vote

@Override public void onReceive(Context context,Intent intent){
  int status=intent.getIntExtra("status",-1);
  if (status == 0) {
    Log.d("TheActivity-BroadcastReceived","service stopped");
    stopServiceTv.setVisibility(View.GONE);
  }
 else   if (status == 1) {
    Log.d("TheActivity-BroadcastReceived","service started");
    stopServiceTv.setVisibility(0);
    stopServiceTv.setOnClickListener(new OnClickListener(){
      @Override public void onClick(      View v){
        Intent i=new Intent(c,UsherService.class);
        stopService(i);
        v.setVisibility(View.GONE);
      }
    }
);
  }
 else   if (status == 2) {
    Log.d("TheActivity-BroadcastReceived","countdown timer expired");
    validateInputAndDoRequest();
  }
 else   if (status == 3) {
    Log.d("TheActivity-BroadcastReceived","requestTask complete");
    parseBart(intent.getStringExtra("result"),intent.getStringExtra("request"),intent.getBooleanExtra("updateUI",true));
  }
 else   if (status == 4) {
    Log.d("TheActivity-BroadcastReceived","Bart parser complete");
    handleResponse(intent.getSerializableExtra("result"),intent.getBooleanExtra("updateUI",true));
  }
 else   if (status == 13) {
    showErrorDialog(intent.getStringExtra("message"));
  }
}
 

Example 47

From project Android-File-Manager, under directory /src/com/nexes/manager/.

Source file: EventHandler.java

  15 
vote

/** 
 * This private method is used to display options the user can select when the tool box button is pressed. The WIFI option is commented out as it doesn't seem to fit with the overall idea of the application. However to display it, just  uncomment the below code and the code in the AndroidManifest.xml file.
 */
private void display_dialog(int type){
  AlertDialog.Builder builder;
  AlertDialog dialog;
switch (type) {
case MANAGE_DIALOG:
    CharSequence[] options={"Process Info","Application backup"};
  builder=new AlertDialog.Builder(mContext);
builder.setTitle("Tool Box");
builder.setIcon(R.drawable.toolbox);
builder.setItems(options,new DialogInterface.OnClickListener(){
public void onClick(DialogInterface dialog,int index){
Intent i;
switch (index) {
case 0:
  i=new Intent(mContext,ProcessManager.class);
mContext.startActivity(i);
break;
case 1:
i=new Intent(mContext,ApplicationBackup.class);
mContext.startActivity(i);
break;
}
}
}
);
dialog=builder.create();
dialog.show();
break;
}
}
 

Example 48

From project Android-File-Manager-Tablet, under directory /src/com/nexes/manager/tablet/.

Source file: BluetoothActivity.java

  15 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setTheme(android.R.style.Theme_Holo_Dialog_MinWidth);
  setContentView(R.layout.bluetooth_layout);
  mFilePaths=getIntent().getExtras().getStringArray("paths");
  mDeviceData=new ArrayList<String>();
  mBluetoothAdapter=BluetoothAdapter.getDefaultAdapter();
  if (mBluetoothAdapter == null) {
    AlertDialog.Builder b=new AlertDialog.Builder(this);
    b.setTitle("Bluetooth error").setMessage("This device does not support bluetooth").setIcon(R.drawable.download_md).setPositiveButton("Ok",new DialogInterface.OnClickListener(){
      @Override public void onClick(      DialogInterface dialog,      int which){
        finish();
      }
    }
).create().show();
  }
  mDelegate=new BluetoothDeviceAdapter(this,R.layout.grid_content_layout,mDeviceData);
  GridView gview=(GridView)findViewById(R.id.bt_gridview);
  gview.setAdapter(mDelegate);
  gview.setOnItemClickListener(this);
  mMessageView=(TextView)findViewById(R.id.bt_message);
  mButton=(Button)findViewById(R.id.bt_button);
  mButton.setOnClickListener(this);
  if (!mBluetoothAdapter.isEnabled()) {
    mMessageView.setText("Bluetooth is turned off");
    mButton.setText("Enable Bluetooth");
    mButton.setId(BUTTON_ENABLE);
  }
 else {
    mMessageView.setText("Bluetooth is turned on");
    mButton.setText("Scan for Devices");
    mButton.setId(BUTTON_FIND);
    findPairedDevices();
  }
}
 

Example 49

From project Android-SQL-Helper, under directory /tests/AndroidSampleProject/src/com/sgxmobileapps/androidsqlhelper/example/.

Source file: AndroidSampleProjectActivity.java

  15 
vote

/** 
 * Called when the activity is first created. 
 */
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main);
  Button storeButton=(Button)findViewById(R.id.button_store);
  storeButton.setOnClickListener(this);
  Button usersButton=(Button)findViewById(R.id.button_view_users);
  usersButton.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      UserListActivity.launch(AndroidSampleProjectActivity.this);
    }
  }
);
  Button profilesButton=(Button)findViewById(R.id.button_view_profiles);
  profilesButton.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      UserProfileListActivity.launch(AndroidSampleProjectActivity.this);
    }
  }
);
}
 

Example 50

From project android-tether, under directory /src/og/android/tether/.

Source file: MainActivity.java

  15 
vote

@Override public boolean onTrackballEvent(MotionEvent event){
  if (event.getAction() == MotionEvent.ACTION_DOWN) {
    Log.d(MSG_TAG,"Trackball pressed ...");
    String tetherStatus=this.application.coretask.getProp("tether.status");
    if (!tetherStatus.equals("running")) {
      new AlertDialog.Builder(this).setMessage(getString(R.string.main_activity_trackball_pressed_start)).setPositiveButton(getString(R.string.main_activity_confirm),new DialogInterface.OnClickListener(){
        public void onClick(        DialogInterface dialog,        int which){
          Log.d(MSG_TAG,"Trackball press confirmed ...");
          MainActivity.currentInstance.startBtnListener.onClick(MainActivity.currentInstance.startBtn);
        }
      }
).setNegativeButton(getString(R.string.main_activity_cancel),null).show();
    }
 else {
      if (MainActivity.this.lockBtn.isChecked()) {
        Log.d(MSG_TAG,"Tether was locked ...");
        MainActivity.this.application.displayToastMessage(getString(R.string.main_activity_locked));
        return false;
      }
      new AlertDialog.Builder(this).setMessage(getString(R.string.main_activity_trackball_pressed_stop)).setPositiveButton(getString(R.string.main_activity_confirm),new DialogInterface.OnClickListener(){
        public void onClick(        DialogInterface dialog,        int which){
          Log.d(MSG_TAG,"Trackball press confirmed ...");
          MainActivity.currentInstance.stopBtnListener.onClick(MainActivity.currentInstance.startBtn);
        }
      }
).setNegativeButton(getString(R.string.main_activity_cancel),null).show();
    }
  }
  return true;
}
 

Example 51

From project android-thaiime, under directory /latinime/src/com/android/inputmethod/deprecated/voice/.

Source file: RecognitionView.java

  15 
vote

public RecognitionView(Context context,OnClickListener clickListener){
  mUiHandler=new Handler();
  LayoutInflater inflater=(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  mView=inflater.inflate(R.layout.recognition_status,null);
  mPopupLayout=mView.findViewById(R.id.popup_layout);
  Resources r=context.getResources();
  mListeningBorder=r.getDrawable(R.drawable.vs_dialog_red);
  mWorkingBorder=r.getDrawable(R.drawable.vs_dialog_blue);
  mErrorBorder=r.getDrawable(R.drawable.vs_dialog_yellow);
  mInitializing=r.getDrawable(R.drawable.mic_slash);
  mError=r.getDrawable(R.drawable.caution);
  mImage=(ImageView)mView.findViewById(R.id.image);
  mProgress=mView.findViewById(R.id.progress);
  mSoundIndicator=(SoundIndicator)mView.findViewById(R.id.sound_indicator);
  mButton=(Button)mView.findViewById(R.id.button);
  mButton.setOnClickListener(clickListener);
  mText=(TextView)mView.findViewById(R.id.text);
  mLanguage=(TextView)mView.findViewById(R.id.language);
  mContext=context;
}
 

Example 52

From project android_7, under directory /src/org/immopoly/android/fragments/.

Source file: MapFragment.java

  15 
vote

public void setMapViewWithZoom(int mapLayoutId,int zoomControlsLayoutId){
  ZoomControls zoomControls=(ZoomControls)mMapView.findViewById(zoomControlsLayoutId);
  zoomControls.setOnZoomInClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      getMapView().getController().zoomInFixing(getMapView().getWidth() / 2,getMapView().getHeight() / 2);
    }
  }
);
  zoomControls.setOnZoomOutClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      getMapView().getController().zoomOut();
    }
  }
);
}
 

Example 53

From project android_packages_apps_phone, under directory /src/com/android/phone/.

Source file: FakePhoneActivity.java

  15 
vote

@Override public void onCreate(Bundle icicle){
  super.onCreate(icicle);
  setContentView(R.layout.fake_phone_activity);
  mPlaceCall=(Button)findViewById(R.id.placeCall);
  mPlaceCall.setOnClickListener(new ButtonListener());
  mPhoneNumber=(EditText)findViewById(R.id.phoneNumber);
  mPhoneNumber.setOnClickListener(new View.OnClickListener(){
    public void onClick(    View v){
      mPlaceCall.requestFocus();
    }
  }
);
  mRadioControl=PhoneApp.getInstance().phone.getSimulatedRadioControl();
  Log.i(TAG,"- PhoneApp.getInstance(): " + PhoneApp.getInstance());
  Log.i(TAG,"- PhoneApp.getInstance().phone: " + PhoneApp.getInstance().phone);
  Log.i(TAG,"- mRadioControl: " + mRadioControl);
}
 

Example 54

From project android_packages_apps_Tag, under directory /src/com/android/apps/tag/record/.

Source file: RecordUtils.java

  15 
vote

/** 
 * Creates one or more views for a parsed record that wants to display an actionable intent. The views will have a  {@link ClickInfo} set as their tag.
 */
public static View getViewsForIntent(Activity activity,LayoutInflater inflater,ViewGroup parent,OnClickListener listener,Intent intent,String description){
  PackageManager pm=activity.getPackageManager();
  int flags=PackageManager.GET_RESOLVED_FILTER | PackageManager.MATCH_DEFAULT_ONLY;
  List<ResolveInfo> activities=pm.queryIntentActivities(intent,flags);
  int numActivities=activities.size();
  if (numActivities == 0 || (numActivities == 1 && !activities.get(0).activityInfo.enabled)) {
    TextView text=(TextView)inflater.inflate(R.layout.tag_text,parent,false);
    text.setText(description);
    return text;
  }
 else   if (numActivities == 1) {
    return buildActivityView(activity,activities.get(0),pm,inflater,parent,listener,intent,description);
  }
 else {
    LinearLayout container=new LinearLayout(activity);
    container.setOrientation(LinearLayout.VERTICAL);
    container.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.WRAP_CONTENT));
    for (    ResolveInfo resolveInfo : activities) {
      if (!resolveInfo.activityInfo.enabled) {
        continue;
      }
      if (container.getChildCount() > 0) {
        inflater.inflate(R.layout.tag_divider,container);
      }
      Intent clone=new Intent(intent);
      container.addView(buildActivityView(activity,resolveInfo,pm,inflater,container,listener,clone,description));
    }
    return container;
  }
}
 

Example 55

From project android_packages_inputmethods_LatinIME, under directory /java/src/com/android/inputmethod/deprecated/voice/.

Source file: RecognitionView.java

  15 
vote

public RecognitionView(Context context,OnClickListener clickListener){
  mUiHandler=new Handler();
  LayoutInflater inflater=(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  mView=inflater.inflate(R.layout.recognition_status,null);
  mPopupLayout=mView.findViewById(R.id.popup_layout);
  Resources r=context.getResources();
  mListeningBorder=r.getDrawable(R.drawable.vs_dialog_red);
  mWorkingBorder=r.getDrawable(R.drawable.vs_dialog_blue);
  mErrorBorder=r.getDrawable(R.drawable.vs_dialog_yellow);
  mInitializing=r.getDrawable(R.drawable.mic_slash);
  mError=r.getDrawable(R.drawable.caution);
  mImage=(ImageView)mView.findViewById(R.id.image);
  mProgress=mView.findViewById(R.id.progress);
  mSoundIndicator=(SoundIndicator)mView.findViewById(R.id.sound_indicator);
  mButton=(Button)mView.findViewById(R.id.button);
  mButton.setOnClickListener(clickListener);
  mText=(TextView)mView.findViewById(R.id.text);
  mLanguage=(TextView)mView.findViewById(R.id.language);
  mContext=context;
}
 

Example 56

From project Apertiurm-Androind-app-devlopment, under directory /ApertiumAndroid/src/org/apertium/android/.

Source file: ApertiumActivity.java

  15 
vote

@SuppressWarnings("deprecation") private void CrashRecovery(){
  final String crash=appPreference.GetCrashReport();
  if (crash != null) {
    appPreference.ClearCrashReport();
    Log.i(TAG,"Crash on last run time" + crash);
    final AlertDialog alertDialog=new AlertDialog.Builder(thisActivity).create();
    alertDialog.setTitle(R.string.crash_detect);
    alertDialog.setMessage(getString(R.string.crash_message_with_error_and_support_address,crash,AppPreference.SUPPORT_MAIL));
    alertDialog.setButton(getString(R.string.report),new DialogInterface.OnClickListener(){
      public void onClick(      final DialogInterface dialog,      final int which){
        Intent emailIntent=new Intent(android.content.Intent.ACTION_SEND);
        emailIntent.setType("plain/text");
        String aEmailList[]={AppPreference.SUPPORT_MAIL};
        emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL,aEmailList);
        emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT,"Apertium Android Error Report");
        emailIntent.setType("plain/text");
        emailIntent.putExtra(android.content.Intent.EXTRA_TEXT,"Error : " + crash + "\nSDK Version :"+ android.os.Build.VERSION.SDK_INT);
        startActivity(Intent.createChooser(emailIntent,getString(R.string.send_email_in)));
        alertDialog.dismiss();
      }
    }
);
    alertDialog.setButton2(getString(R.string.setting),new DialogInterface.OnClickListener(){
      public void onClick(      final DialogInterface dialog,      final int which){
        final Intent myIntent=new Intent(ApertiumActivity.this,ManageActivity.class);
        ApertiumActivity.this.startActivity(myIntent);
      }
    }
);
    alertDialog.show();
  }
}