Java Code Examples for android.widget.Button

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 2Degrees-Toolbox, under directory /Toolbox/src/biz/shadowservices/DegreesToolbox/.

Source file: LogViewActivity.java

  19 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.log_view);
  Button clearLogButton=(Button)findViewById(R.id.clear_log_button);
  clearLogButton.setOnClickListener(clearLog);
  Button sendLogButton=(Button)findViewById(R.id.send_log_button);
  sendLogButton.setOnClickListener(sendLog);
}
 

Example 2

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

Source file: FragmentAlertDialogSupport.java

  18 
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/.

Source file: DownloadActivity.java

  18 
vote

@Override protected void onPreExecute(){
  Button btnDownload=(Button)findViewById(R.id.btnDownload);
  btnDownload.setEnabled(false);
  mInstalledData.clear();
  mAvailableData.clear();
}
 

Example 4

From project aksunai, under directory /src/org/androidnerds/app/aksunai/ui/.

Source file: ServerDetail.java

  18 
vote

@Override public void onCreate(Bundle appState){
  super.onCreate(appState);
  setContentView(R.layout.server_detail);
  setTitle(R.string.server_detail_title);
  Bundle extras=getIntent().getExtras();
  mMode=extras.getString("mode");
  Button confirm=(Button)findViewById(R.id.new_confirm);
  confirm.setOnClickListener(mConfirmListener);
  Button cancel=(Button)findViewById(R.id.btn_discard);
  cancel.setOnClickListener(mCancelListener);
  if (mMode.equals("edit")) {
    loadServerData(mId=extras.getLong("id"));
  }
}
 

Example 5

From project AmDroid, under directory /AmDroid/src/main/java/com/jaeckel/amenoid/.

Source file: Fragment2.java

  18 
vote

@Override public void onStart(){
  super.onStart();
  Button btnGetText=(Button)getActivity().findViewById(R.id.btnGetText1);
  btnGetText.setOnClickListener(new View.OnClickListener(){
    public void onClick(    View v){
      TextView lbl=(TextView)getActivity().findViewById(R.id.labelFragment1);
      Toast.makeText(getActivity(),lbl.getText(),Toast.LENGTH_SHORT).show();
    }
  }
);
}
 

Example 6

From project and-bible, under directory /AndBible/src/net/bible/android/view/util/buttongrid/.

Source file: ButtonGrid.java

  18 
vote

/** 
 * calculate button position relative to this table because MotionEvents are relative to this table
 */
private void recordButtonPositions(){
  for (  ButtonInfo buttonInfo : buttonInfoList) {
    Button button=buttonInfo.button;
    TableRow tableRow=(TableRow)button.getParent();
    buttonInfo.left+=button.getLeft() + tableRow.getLeft();
    buttonInfo.top+=button.getTop() + tableRow.getTop();
    buttonInfo.right+=button.getRight() + tableRow.getLeft();
    buttonInfo.bottom+=button.getBottom() + tableRow.getTop();
  }
  ButtonInfo but1=buttonInfoList.get(0);
  mPreviewOffset=but1.top - but1.bottom;
}
 

Example 7

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

Source file: Dashboard.java

  18 
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 8

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

Source file: Tmts.java

  18 
vote

/** 
 * Return a  {@link TmtsButton} by the given name.
 * @param name String name of view id, the string after @+id/ defined in layout files.
 * @return {@link TmtsButton} with the given name.
 * @throws Exception Exception
 */
TmtsButton getTmtsButton(String name) throws Exception {
  Log.i(LOG_TAG,"getTmtsButton: " + name);
  Button button=(Button)getView(name,Button.class);
  printLog(button,name,"getTmtsButton");
  TmtsButton tmtsButton=new TmtsButton(inst,button);
  return tmtsButton;
}
 

Example 9

From project android-client_1, under directory /src/com/buddycloud/view/.

Source file: FollowActivity.java

  18 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.follow);
  Button abort=(Button)findViewById(R.id.abort);
  Button follow=(Button)findViewById(R.id.follow);
  abort.setOnClickListener(this);
  follow.setOnClickListener(this);
  setup(getIntent());
}
 

Example 10

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

Source file: ApplicationBackup.java

  18 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  requestWindowFeature(Window.FEATURE_NO_TITLE);
  setContentView(R.layout.backup_layout);
  mAppLabel=(TextView)findViewById(R.id.backup_label);
  Button button=(Button)findViewById(R.id.backup_button_all);
  button.setOnClickListener(this);
  mAppList=new ArrayList<ApplicationInfo>();
  mPackMag=getPackageManager();
  get_downloaded_apps();
  setListAdapter(new TableView());
}
 

Example 11

From project android-joedayz, under directory /Proyectos/client/src/org/springframework/android/showcase/rest/.

Source file: HttpGetSetRequestTimeoutActivity.java

  18 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.http_get_set_request_timeout_activity_layout);
  final Button buttonJson=(Button)findViewById(R.id.button_submit);
  buttonJson.setOnClickListener(new View.OnClickListener(){
    public void onClick(    View v){
      new RequestTask().execute();
    }
  }
);
}
 

Example 12

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

Source file: AccessControlActivity.java

  18 
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 13

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

Source file: HelloAndroidActivity.java

  18 
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 14

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

Source file: MainMenuActivity.java

  17 
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 15

From project actionbar, under directory /actionbar-example/src/main/java/com/github/erd/actionbar/widget/.

Source file: ActionbarChooser.java

  17 
vote

/** 
 * {@inheritDoc}
 */
@Override protected void onCreate(Bundle icicle){
  super.onCreate(icicle);
  setContentView(R.layout.activity_chooser);
  Button button1=(Button)findViewById(R.id.button1);
  button1.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      startActivity(new Intent(v.getContext(),ActionbarExample1.class));
    }
  }
);
  Button button2=(Button)findViewById(R.id.button2);
  button2.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      startActivity(new Intent(v.getContext(),ActionbarExample2.class));
    }
  }
);
  Button button3=(Button)findViewById(R.id.button3);
  button3.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      startActivity(new Intent(v.getContext(),ActionbarExample3.class));
    }
  }
);
  Button button4=(Button)findViewById(R.id.button4);
  button4.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      startActivity(new Intent(v.getContext(),ActionbarExample4.class));
    }
  }
);
}
 

Example 16

From project agit, under directory /agit/src/main/java/com/madgag/agit/.

Source file: CommitNavigationView.java

  17 
vote

private void addButtonsFor(PlotCommit<PlotLane> commit,final Relation relation){
  ViewGroup buttonGroup=buttonGroups.get(relation);
  buttonGroup.removeAllViews();
  View.OnClickListener clickListener=new View.OnClickListener(){
    @SuppressWarnings("unchecked") public void onClick(    View v){
      commitSelectedListener.onCommitSelected(relation,(PlotCommit<PlotLane>)v.getTag());
    }
  }
;
  for (  PlotCommit<PlotLane> relatedCommit : relation.relationsOf(commit)) {
    Button button=(Button)layoutInflater.inflate(R.layout.related_commit_button,buttonGroup,false);
    button.setTag(relatedCommit);
    String abbrId=relatedCommit.getName().substring(0,4);
    String buttonText=(relation == PARENT) ? ("? " + abbrId) : (abbrId + " ?");
    button.setText(buttonText);
    button.setOnClickListener(clickListener);
    buttonGroup.addView(button);
  }
}
 

Example 17

From project alljoyn_java, under directory /samples/android/chat/src/org/alljoyn/bus/sample/chat/.

Source file: DialogBuilder.java

  17 
vote

public Dialog createUseJoinDialog(final Activity activity,final ChatApplication application){
  Log.i(TAG,"createUseJoinDialog()");
  final Dialog dialog=new Dialog(activity);
  dialog.requestWindowFeature(dialog.getWindow().FEATURE_NO_TITLE);
  dialog.setContentView(R.layout.usejoindialog);
  ArrayAdapter<String> channelListAdapter=new ArrayAdapter<String>(activity,android.R.layout.test_list_item);
  final ListView channelList=(ListView)dialog.findViewById(R.id.useJoinChannelList);
  channelList.setAdapter(channelListAdapter);
  List<String> channels=application.getFoundChannels();
  for (  String channel : channels) {
    int lastDot=channel.lastIndexOf('.');
    if (lastDot < 0) {
      continue;
    }
    channelListAdapter.add(channel.substring(lastDot + 1));
  }
  channelListAdapter.notifyDataSetChanged();
  channelList.setOnItemClickListener(new ListView.OnItemClickListener(){
    public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      String name=channelList.getItemAtPosition(position).toString();
      application.useSetChannelName(name);
      application.useJoinChannel();
      activity.removeDialog(UseActivity.DIALOG_JOIN_ID);
    }
  }
);
  Button cancel=(Button)dialog.findViewById(R.id.useJoinCancel);
  cancel.setOnClickListener(new View.OnClickListener(){
    public void onClick(    View view){
      activity.removeDialog(UseActivity.DIALOG_JOIN_ID);
    }
  }
);
  return dialog;
}
 

Example 18

From project android-api-demos, under directory /src/com/mobeelizer/demos/activities/.

Source file: C2DMReceiver.java

  17 
vote

private void handleMessage(final Context context,final Intent intent){
  String message=intent.getStringExtra("alert");
  String title="Push received!";
  if (ApplicationStatus.isVisible()) {
    final Dialog dialog=new Dialog(ApplicationStatus.getCurrentActivity(),R.style.MobeelizerDialogTheme);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.setContentView(R.layout.info_dialog);
    TextView titleView=(TextView)dialog.findViewById(R.id.dialogTitle);
    titleView.setText(title);
    TextView textView=(TextView)dialog.findViewById(R.id.dialogText);
    textView.setText(message);
    Button closeButton=(Button)dialog.findViewById(R.id.dialogButton);
    closeButton.setOnClickListener(new View.OnClickListener(){
      public void onClick(      final View paramView){
        dialog.dismiss();
      }
    }
);
    dialog.show();
  }
 else {
    Notification notification=new Notification(R.drawable.ic_launcher,message,System.currentTimeMillis());
    notification.setLatestEventInfo(context,title,message,null);
    notification.flags|=Notification.FLAG_AUTO_CANCEL;
    NotificationManager notificationManager=(NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE);
    notificationManager.notify(i++,notification);
  }
}
 

Example 19

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

Source file: MainActivity.java

  17 
vote

@Override protected void onCreate(){
  final LayoutInflater inflater=(LayoutInflater)this.anchor.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  final ViewGroup root=(ViewGroup)inflater.inflate(R.layout.popup_account,null);
  final Button btnHide=(Button)root.findViewById(R.id.btnHide);
  final Button btnUnhide=(Button)root.findViewById(R.id.btnUnhide);
  final Button btnDisableNotifications=(Button)root.findViewById(R.id.btnDisableNotifications);
  final Button btnEnableNotifications=(Button)root.findViewById(R.id.btnEnableNotifications);
  if (selected_account.isHidden()) {
    btnHide.setVisibility(View.GONE);
    btnUnhide.setVisibility(View.VISIBLE);
    btnUnhide.setOnClickListener(this);
  }
 else {
    btnHide.setVisibility(View.VISIBLE);
    btnUnhide.setVisibility(View.GONE);
    btnHide.setOnClickListener(this);
  }
  if (selected_account.isNotify()) {
    btnDisableNotifications.setVisibility(View.VISIBLE);
    btnDisableNotifications.setOnClickListener(this);
    btnEnableNotifications.setVisibility(View.GONE);
  }
 else {
    btnDisableNotifications.setVisibility(View.GONE);
    btnEnableNotifications.setOnClickListener(this);
    btnEnableNotifications.setVisibility(View.VISIBLE);
  }
  this.setContentView(root);
}
 

Example 20

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

Source file: Blogger.java

  17 
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 21

From project android-client_2, under directory /src/org/mifos/androidclient/main/.

Source file: AccountDetailsActivity.java

  17 
vote

private void updateContent(AbstractAccountDetails details){
  if (details != null) {
    mDetails=details;
    ViewBuilderFactory factory=new ViewBuilderFactory(this);
    AccountDetailsViewBuilder builder=factory.createAccountDetailsViewBuilder(details);
    LinearLayout tabContent=(LinearLayout)findViewById(R.id.account_overview);
    if (tabContent.getChildCount() > 0) {
      tabContent.removeAllViews();
    }
    tabContent.addView(builder.buildOverviewView());
    tabContent=(LinearLayout)findViewById(R.id.account_transaction);
    if (tabContent.getChildCount() > 0) {
      tabContent.removeAllViews();
    }
    tabContent.addView(builder.buildTransactionView());
    tabContent=(LinearLayout)findViewById(R.id.account_details);
    if (tabContent.getChildCount() > 0) {
      tabContent.removeAllViews();
    }
    tabContent.addView(builder.buildDetailsView());
    if (details.getClass() == SavingsAccountDetails.class) {
      if (((SavingsAccountDetails)details).getDepositTypeName().equals(SavingsAccountDetails.MANDATORY_DEPOSIT)) {
        Button depositDueButton=(Button)findViewById(R.id.view_depositDueDetails_button);
        depositDueButton.setVisibility(View.VISIBLE);
      }
    }
  }
}
 

Example 22

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

Source file: AugmentEditActivity.java

  17 
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 23

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

Source file: DirContentActivity.java

  17 
vote

private void addBackButton(String name,boolean refreshList){
  final String bname=name;
  Button button=new Button(mContext);
  if (refreshList)   mData=mFileMang.getNextDir(name,false);
  button.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      int index=(Integer)v.getTag();
      String path=mFileMang.getCurrentDir();
      String subPath;
      if (mActionModeSelected || mMultiSelectOn)       return;
      if (mThumbnail != null) {
        mThumbnail.setCancelThumbnails(true);
        mThumbnail=null;
      }
      if (index != (mPathView.getChildCount() - 1)) {
        while (index < mPathView.getChildCount() - 1)         mPathView.removeViewAt(mPathView.getChildCount() - 1);
        mBackPathIndex=index + 1;
        subPath=path.substring(0,path.lastIndexOf(bname));
        mData=mFileMang.getNextDir(subPath + bname,true);
        mDelegate.notifyDataSetChanged();
      }
    }
  }
);
  button.setText(name);
  button.setTag(mBackPathIndex++);
  mPathView.addView(button);
  if (refreshList)   mDelegate.notifyDataSetChanged();
}
 

Example 24

From project Android-Flashcards, under directory /src/com/secretsockssoftware/androidflashcards/.

Source file: LessonDownload.java

  17 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.lesson_download);
  Bundle extras=getIntent().getExtras();
  lname=extras.getString("LessonName");
  ldesc=extras.getString("LessonDesc");
  lurl=extras.getString("LessonUrl");
  lfilt=extras.getString("LessonFilter");
  ltarget=extras.getString("LessonTarget");
  lenc=extras.getString("LessonEncoding");
  me=this;
  setResult(0);
  final TextView nametv=(TextView)findViewById(R.id.lesson_name_tv);
  nametv.setText(lname);
  final TextView desctv=(TextView)findViewById(R.id.lesson_desc_tv);
  desctv.setText(ldesc);
  final Button cancel_button=(Button)findViewById(R.id.cancel_button);
  cancel_button.setOnClickListener(new View.OnClickListener(){
    public void onClick(    View v){
      finish();
    }
  }
);
  final Button dl_button=(Button)findViewById(R.id.download_button);
  dl_button.setOnClickListener(new View.OnClickListener(){
    public void onClick(    View v){
      pd=ProgressDialog.show(me,"","Downloading lesson...",true);
      Thread t=new Thread(me);
      t.start();
    }
  }
);
}
 

Example 25

From project Android-GifStitch, under directory /src/com/phunkosis/gifstitch/.

Source file: HomeGalleryActivity.java

  17 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_home);
  if (!Utils.isSDCardPresent(this)) {
    DialogHelper.displayFatalSDError(this);
  }
 else {
    GSSettings.InitializeSettings(this.getApplicationContext());
    Utils.app_launched(this);
    Button createButt=(Button)findViewById(R.id.button_create_new);
    createButt.setOnClickListener(new View.OnClickListener(){
      @Override public void onClick(      View v){
        HomeGalleryActivity.this.startCreateNewGif();
      }
    }
);
    this.mAdapter=new GifHomeGridAdapter(this);
    this.mGifGrid=(GridView)findViewById(R.id.gifGrid);
    this.mGifGrid.setOnItemClickListener(this);
    this.mGifGrid.setOnItemLongClickListener(this);
    this.mGifGrid.setAdapter(this.mAdapter);
    this.mSS=(SavedState)this.getLastNonConfigurationInstance();
    if (this.mSS == null)     this.mSS=new SavedState();
    this.mGifGrid.scrollTo(0,this.mSS.scrollPosition);
    if (this.mSS.inImageOptionsDialog)     this.showImageOptionsDialog();
 else     if (this.mSS.inConfirmDeleteDialog)     this.showConfirmDeleteDialog();
 else     if (this.mSS.mIsUploading)     this.showUploadingDialog();
    if (this.mSS.mUploadGifTask != null)     this.mSS.mUploadGifTask.setmUploadCompleteListener(this.mUploadCompleteListener);
    if (this.mAdapter.getCount() <= 0) {
      this.startCreateNewGif();
    }
  }
}
 

Example 26

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

Source file: TwitterActivity.java

  17 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.ac_twitter);
  Bundle bundle=getIntent().getExtras();
  final String message=bundle == null ? "" : bundle.getString(Extra.POST_MESSAGE);
  messageView=(TextView)findViewById(R.id.message);
  Button postButton=(Button)findViewById(R.id.button_post);
  messageView.setText(message);
  postButton.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      if (twitter.isAuthorized()) {
        twitter.publishMessage(messageView.getText().toString());
        finish();
      }
 else {
        twitter.authorize(new AuthListener(){
          @Override public void onAuthSucceed(){
            twitter.publishMessage(messageView.getText().toString());
            finish();
          }
          @Override public void onAuthFail(          String error){
          }
        }
);
      }
    }
  }
);
  twitter=new TwitterFacade(this,Constants.TWITTER_CONSUMER_KEY,Constants.TWITTER_CONSUMER_SECRET);
  twitterEventObserver=TwitterEventObserver.newInstance();
}
 

Example 27

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

Source file: AndroidSampleProjectActivity.java

  17 
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 28

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

Source file: TutorialBuddyStatusActivity.java

  17 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.hello_world);
  sipAddressWidget=(TextView)findViewById(R.id.AddressId);
  sipAddressWidget.setText(defaultSipAddress);
  mySipAddressWidget=(TextView)findViewById(R.id.MyAddressId);
  mySipAddressWidget.setVisibility(View.VISIBLE);
  mySipPasswordWidget=(TextView)findViewById(R.id.Password);
  mySipPasswordWidget.setVisibility(TextView.VISIBLE);
  final TextView outputText=(TextView)findViewById(R.id.OutputText);
  buttonCall=(Button)findViewById(R.id.CallButton);
  buttonCall.setOnClickListener(new View.OnClickListener(){
    public void onClick(    View v){
      TutorialLaunchingThread thread=new TutorialLaunchingThread();
      buttonCall.setEnabled(false);
      thread.start();
    }
  }
);
  Button buttonStop=(Button)findViewById(R.id.ButtonStop);
  buttonStop.setOnClickListener(new View.OnClickListener(){
    public void onClick(    View v){
    }
  }
);
}
 

Example 29

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

Source file: PasswActivity.java

  17 
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 30

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

Source file: PasswActivity.java

  17 
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 31

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

Source file: HomeActivity.java

  17 
vote

@Override @TargetApi(9) public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.home);
  if (Build.VERSION.SDK_INT >= 9) {
    final StrictMode.ThreadPolicy policy=new StrictMode.ThreadPolicy.Builder().permitAll().build();
    StrictMode.setThreadPolicy(policy);
  }
  final Display display=getWindowManager().getDefaultDisplay();
  ThumbSize.setScreenSize(display.getWidth(),display.getHeight());
  final Button versionButton=(Button)findViewById(R.id.home_version_button);
  final GridView menuGrid=(GridView)findViewById(R.id.HomeItemGridView);
  mHomeController=new HomeController(this,new Handler(),menuGrid);
  mHomeController.setupVersionHandler(new Handler(),versionButton,menuGrid);
  mEventClientManager=ManagerFactory.getEventClientManager(mHomeController);
  mConfigurationManager=ConfigurationManager.getInstance(this);
  versionButton.setText("Connecting...");
  versionButton.setOnClickListener(mHomeController.getOnHostChangeListener());
  ((Button)findViewById(R.id.home_about_button)).setOnClickListener(new OnClickListener(){
    public void onClick(    View v){
      startActivity(new Intent(HomeActivity.this,AboutActivity.class));
    }
  }
);
}
 

Example 32

From project 4308Cirrus, under directory /tendril-cirrus/src/main/java/edu/colorado/cs/cirrus/cirrus/.

Source file: TendrilActivity.java

  15 
vote

@Override public void onStart(){
  super.onStart();
  loginButton=(Button)findViewById(R.id.LoginButton);
  loginSubmitButton=(Button)findViewById(R.id.LoginSubmitButton);
  loginCancelButton=(Button)findViewById(R.id.LoginCancelButton);
  aboutButton=(Button)findViewById(R.id.AboutButton);
  loginMenu=(LinearLayout)findViewById(R.id.LoginMenu);
  mainMenu=(LinearLayout)findViewById(R.id.MainMenu);
  emailInput=(EditText)findViewById(R.id.EmailInput);
  passwordInput=(EditText)findViewById(R.id.PasswordInput);
  loginButton.setOnClickListener(mySimpleListener);
  loginSubmitButton.setOnClickListener(mySimpleListener);
  loginCancelButton.setOnClickListener(mySimpleListener);
  aboutButton.setOnClickListener(mySimpleListener);
  passwordInput.setOnEditorActionListener(new myEditorActionListener());
}
 

Example 33

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

Source file: AAWidget.java

  15 
vote

/** 
 * Creates the activity; This themes up our activity to look like a dialog Also registers some UI action listeners to the UI elements
 */
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  this.setContentView(R.layout.widget_settings);
  this.setTitle("Widget Settings");
  getWindow().setBackgroundDrawableResource(R.drawable.widget_dialog2);
  Display d=getWindow().getWindowManager().getDefaultDisplay();
  getWindow().setLayout(d.getWidth() * 15 / 16,LayoutParams.WRAP_CONTENT);
  this.setResult(RESULT_CANCELED);
  settings=this.getSharedPreferences("settings",0);
  btn_ok=(Button)this.findViewById(R.id.btn_ok);
  sb_freq=(SeekBar)this.findViewById(R.id.sb_freq);
  tv_freq=(TextView)this.findViewById(R.id.tv_freq);
  rg_layoutPicker=(RadioGroup)this.findViewById(R.id.rg_layoutPicker);
  rb_left=(RadioButton)this.findViewById(R.id.rb_left);
  rb_center=(RadioButton)this.findViewById(R.id.rb_center);
  btn_ok.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      acceptChanges();
    }
  }
);
  sb_freq.setOnSeekBarChangeListener(new OnSeekBarChangeListener(){
    @Override public void onStopTrackingTouch(    SeekBar seekBar){
    }
    @Override public void onStartTrackingTouch(    SeekBar seekBar){
    }
    /** 
 * When the user changes the position of the slider bar; display  the current progress in the textview below
 */
    @Override public void onProgressChanged(    SeekBar seekBar,    int progress,    boolean fromUser){
      tv_freq.setText((progress + 1) + " hour/s");
    }
  }
);
  sb_freq.setProgress((int)settings.getLong("freq",2) - 1);
}
 

Example 34

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

Source file: AlarmActivity.java

  15 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  LogEx.verbose("AlarmActivity onCreate");
  this.setContentView(R.layout.alarm_confirmation);
  this.lvOperationDetails=(ListView)findViewById(R.id.lvAlarmDetails);
  this.tvTitle=(TextView)findViewById(R.id.tvTitle);
  this.tvText=(TextView)findViewById(R.id.tvText);
  this.btAccept=(Button)findViewById(R.id.btAccept);
  this.btReject=(Button)findViewById(R.id.btReject);
  this.btSwitchToStatus=(Button)findViewById(R.id.btSwitchToStatus);
  this.llButtonBar=(LinearLayout)findViewById(R.id.llButtonBar);
  this.btAccept.setOnClickListener(onUpdateAlarmStatusClick(AlarmState.Accepted));
  this.btReject.setOnClickListener(onUpdateAlarmStatusClick(AlarmState.Rejeced));
  this.btSwitchToStatus.setOnClickListener(switchToClick);
  if (AlarmData.isAlarmDataBundle(savedInstanceState)) {
    alarm=AlarmData.create(savedInstanceState);
  }
 else {
    Ensure.valid(AlarmData.isAlarmDataBundle(getIntent().getExtras()));
    alarm=AlarmData.create(getIntent().getExtras());
  }
}
 

Example 35

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

Source file: SelectPositionActivity.java

  15 
vote

protected void enableSearch(){
  if (findViewById(R.id.Layoutpos01).getVisibility() == View.VISIBLE) {
    ((Button)findViewById(R.id.Button_validate)).setText(R.string.address_search);
    findViewById(R.id.Button_validate).setEnabled(true);
    search=true;
  }
}
 

Example 36

From project Android-Battery-Widget, under directory /src/com/em/batterywidget/.

Source file: BatteryWidgetActivity.java

  15 
vote

@Override protected void onCreate(Bundle bundle){
  super.onCreate(bundle);
  getWindow().setBackgroundDrawable(new ColorDrawable(0x7f000000));
  setContentView(R.layout.battery_info_view);
  mStatusView=(TextView)findViewById(R.id.state);
  mPlugView=(TextView)findViewById(R.id.plug);
  mLevelView=(TextView)findViewById(R.id.level);
  mScaleView=(TextView)findViewById(R.id.scale);
  mVoltageView=(TextView)findViewById(R.id.voltage);
  mTemperatureView=(TextView)findViewById(R.id.temperature);
  mTechnologyView=(TextView)findViewById(R.id.technology);
  mHealthView=(TextView)findViewById(R.id.health);
  mSummaryButton=(Button)findViewById(R.id.summaryButton);
  mSettingsButton=(Button)findViewById(R.id.settingsButton);
  mHistoryButton=(Button)findViewById(R.id.historyButton);
  mSummaryButton.setOnClickListener(this);
  mSettingsButton.setOnClickListener(this);
  mHistoryButton.setOnClickListener(this);
}
 

Example 37

From project android-context, under directory /src/edu/fsu/cs/contextprovider/.

Source file: ContextAccuracyActivity.java

  15 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  final PowerManager pm=(PowerManager)getSystemService(Context.POWER_SERVICE);
  wakelock=pm.newWakeLock(PowerManager.FULL_WAKE_LOCK,"ContextAccuracyActivity");
  wakelock.acquire();
  KeyguardManager km=(KeyguardManager)getSystemService(KEYGUARD_SERVICE);
  KeyguardManager.KeyguardLock keylock=km.newKeyguardLock(TAG);
  keylock.disableKeyguard();
  getPrefs();
  setContentView(R.layout.accuracy);
  vibrate=(Vibrator)getSystemService(Context.VIBRATOR_SERVICE);
  audio=(AudioManager)getSystemService(Context.AUDIO_SERVICE);
  volume=(AudioManager)getSystemService(Context.AUDIO_SERVICE);
  placeBar=(SeekBar)findViewById(R.id.place);
  movementBar=(SeekBar)findViewById(R.id.movement);
  activityBar=(SeekBar)findViewById(R.id.activity);
  shelterGroup=(RadioGroup)findViewById(R.id.shelter);
  shelterCorrect=(RadioButton)findViewById(R.id.shelterCorrect);
  onPersonGroup=(RadioGroup)findViewById(R.id.onPerson);
  onPersonCorrect=(RadioButton)findViewById(R.id.onPersonCorrect);
  placeText=(EditText)findViewById(R.id.editPlace);
  movementText=(EditText)findViewById(R.id.editMovement);
  activityText=(EditText)findViewById(R.id.editActivity);
  shelterText=(EditText)findViewById(R.id.editShelter);
  onPersonText=(EditText)findViewById(R.id.editOnPerson);
  placeText.setText(DerivedMonitor.getPlace());
  movementText.setText(MovementMonitor.getMovementState());
  activityText.setText(DerivedMonitor.getActivity());
  shelterText.setText(DerivedMonitor.getShelterString());
  onPersonText.setText(DerivedMonitor.getOnPersonString());
  submitBtn=(Button)findViewById(R.id.SubmitButton);
  resetBtn=(Button)findViewById(R.id.ResetButton);
  submitBtn.setOnClickListener(this);
  resetBtn.setOnClickListener(this);
  resetBars();
  if (accuracyAudioEnabled)   tone.play();
  if (accuracyVibrateEnabled)   startVibrate();
  timer=new Timer();
  timer.schedule(new ContextDismissTask(),(dismissDelay * 1000));
}
 

Example 38

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

Source file: FFMPEGPrototype.java

  15 
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 39

From project android-shuffle, under directory /client/src/org/dodgybits/shuffle/android/list/activity/task/.

Source file: AbstractTaskListActivity.java

  15 
vote

@Override public void onCreate(Bundle icicle){
  super.onCreate(icicle);
  SwipeListItemWrapper wrapper=(SwipeListItemWrapper)findViewById(R.id.swipe_wrapper);
  wrapper.setSwipeListItemListener(this);
  if (mAddTaskButton != null) {
    Drawable addIcon=getResources().getDrawable(android.R.drawable.ic_menu_add);
    addIcon.setBounds(0,0,24,24);
    mAddTaskButton.setCompoundDrawables(addIcon,null,null,null);
    mAddTaskButton.setOnClickListener(this);
    mOtherButton=(Button)findViewById(R.id.other_button);
    mOtherButton.setText(R.string.title_delete_completed_preference);
    Drawable deleteIcon=getResources().getDrawable(android.R.drawable.ic_menu_delete);
    deleteIcon.setBounds(0,0,24,24);
    mOtherButton.setCompoundDrawables(deleteIcon,null,null,null);
    mOtherButton.setVisibility(View.VISIBLE);
    mOtherButton.setOnClickListener(this);
  }
}
 

Example 40

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

Source file: IntentSampleActivity.java

  15 
vote

protected void onActivityResult(int request,int result,Intent data){
  if (result != RESULT_OK) {
    return;
  }
  if (request == REQUEST_WINDOW_HANDLE && data != null) {
    mHandle=data.getStringExtra("jackpal.androidterm.window_handle");
    ((Button)findViewById(R.id.runScriptSaveWindow)).setText(R.string.run_script_existing_window);
  }
}
 

Example 41

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;
}