toast

Programmatically disabling/enabling notifications

匿名 (未验证) 提交于 2019-12-03 01:57:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Is there a way I can programmatically disable notifications of individual programs? I'd like to build a list of all programs installed on my device then check the ones I don't want to receive notifications from and hit one button to disable/enable them. I'm trying to build an app that will allow me to enable some/all notifications with a button click and re-enable them via either a button click or after a predetermined period of time. Does Android support that? NotificationManager doesn't seem to have those properties. 回答1: It is not

ionic 2 error cordova not available

匿名 (未验证) 提交于 2019-12-03 01:57:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am trying to use the cordova GooglePlus plugin in a new ionic 2 project (latest ionic2 version) but I always run into errors regarding cordova. The plugin is properly installed and shows up in the plugin folder. One approach I tried is this: import { GooglePlus } from "ionic-native"; and then GooglePlus.login().then(...) The login method executes but always throws an error saying "cordova_not_available" I want to test the app with ionic serve on my windows system first before deploying it to my android phone. How can I make cordova

Android dynamic String Resources

匿名 (未验证) 提交于 2019-12-03 01:57:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: in my app I do a web request that returns some result code, e.g. 105. I have string resources that look like that O.K. Something went wrong. Fatal error. Now I want to do something like that Toast.makeText(parent.getApplicationContext(), parent.getString(R.string.r+resultCode), Toast.LENGTH_LONG).show(); while r+resultCode is the resource identifier. This does not work. Any idea how to do that? 回答1: Try this getResources().getIdentifier(name, defType, defPackage) in a simple way. Toast.makeText(this, getResources().getIdentifier("r"

Get GPS Status on location changed

匿名 (未验证) 提交于 2019-12-03 01:54:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I am using GPS services to derive latitude & longitude in my App. I am able to get the latitude and longitude when the signal is avialable. Once i get a fix, if i have to go to a place where the GPS is not able to get a location fix, it still shows the last location. I want to get the current location and not otherwise. I have tried using onLocationChanged() and onGpsStatusChanged() both to get the GPS status but it isnt giving me the result. @Override public void onGpsStatusChanged ( int arg0 ) { // TODO Auto-generated method stub

How can I create a shelltoast?

匿名 (未验证) 提交于 2019-12-03 01:54:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: In my application I want to notify the user with the ShellToast . Just by running... var toast = new ShellToast { Title = "Nom nom nom!", Content = "More! More! Keep feeding me!", }; toast.Show(); ...makes nothing happen, and as I understand it needs to be run from a ScheduledTaskAgent . But how do I run this on command, and make sure it only run once? 回答1: You can't use a ShellToast while the app is the foreground app. It's meant to be invoked from a background service while the app isn't the foreground app. If you want to have a UX similar

Android ― Is there a way to rotate a toast 90 degrees?

匿名 (未验证) 提交于 2019-12-03 01:48:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: Can't think of any more info to provide. Is there a way? 回答1: As hackbod said, you would have to have a custom view to display the toast. I found a few classes for you that rotates the label for you: VerticalLabelView and CustomTextView I chose to use the latter, and had this code working in my own app: // Creating a new toast object Toast myToast = new Toast ( MyActivity . this ); // Creating our custom text view, and setting text/rotation CustomTextView text = new CustomTextView ( MyActivity . this ); text . SetText ( "Hello

Failure delivering result ResultInfo{who=null, request=2, result=0, data=null} camera

匿名 (未验证) 提交于 2019-12-03 01:45:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: here is the camera code private void selectImage(){ final int Camera_CPTURE = 1; try { Intent capture = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); startActivityForResult(capture,Camera_CPTURE); }catch (ActivityNotFoundException e) { String error ="opps ur devices doesn't support capturing"; Toast toast = Toast.makeText(this,error,Toast.LENGTH_SHORT); toast.show(); } } protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == RESULT_OK) { picUri = data.getData(); performCrop(); } else if(requestCode =

java.io.FileNotFoundException: /storage/emulated/0/Notes/fact50Result.txt: open failed ENOENT (No such file or directory)

匿名 (未验证) 提交于 2019-12-03 01:39:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am trying to export the results of a factorial calculation in a txt file. I found this code that looked quite straight forward from this article here. However I'm getting the error on the title. What am I doing wrong? I have typed this into the manifest: <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> And this is my code related to saving: public void save(View v) { if(numOnRAM!=-1) { EditText text = (EditText) findViewById(R.id.resultTextBox); String data = text.getText().toString(); generateNoteOnSD(this,

Unable to set Firebase Image Uri in Image View

匿名 (未验证) 提交于 2019-12-03 01:34:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I am retrieving an image from my firebase database and setting it in an Image View. I am using the following code. mStorageRef . child ( "Book_Photos/" + firstBook . bid ). getDownloadUrl (). addOnSuccessListener ( new OnSuccessListener < Uri >() { @Override public void onSuccess ( Uri uri ) { Toast . makeText ( getApplicationContext (), "GET IMAGE SUCCESSFUL" , Toast . LENGTH_LONG ). show (); if ( uri == null ){ Toast . makeText ( getApplicationContext (), "URI IS NULL" , Toast . LENGTH_LONG ). show (); } try { ImageView image2 ;

Android Checkbox preference

匿名 (未验证) 提交于 2019-12-03 01:32:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I cannot find any tutorials on checkbox preference. I can use a listpreference, but I can't use checkbox preference. For now, I want that if user sets on the checbox, a toast msg says "true" and if he sets it off, the toast msg says "false". So far I have this: preferences.xml: EditPreferences.java: public class EditPreferences extends PreferenceActivity { String listPreference; boolean checkboxPreference; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml