toast

Android: Show toast after finishing application / activity

匿名 (未验证) 提交于 2019-12-03 02:30:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I want to show a simple toast, when exiting an application. The problem is, that the toast is not shown. I assume it is because the acitivity is finished or because of System.exit(0) , but I don't know how to solve it. Does anyone have a tip? Thanks!! In my activity I have the following code: Toast.makeText(this,"Exit application.",Toast.LENGTH_SHORT).show(); exitApp(); public void exitApp (){ App.getInstance().exit(); finish(); } And the mehod exit in App: public void exit() { System.exit(0); } 回答1: It is advisable that you call finish to

The method makeText in the type Toast is not applicable for the arguments

匿名 (未验证) 提交于 2019-12-03 02:27:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am using a ViewPageIndicator and trying to use a Toast to display when we scroll to the next fragment page. i am getting he following error The method makeText(Context, CharSequence, int) in the type Toast is not applicable for the arguments (PlaceDetailsFragment, String, int) PlaceDetailsFragment.java public class PlaceDetailsFragment extends SherlockFragment { ImageFragmentAdapter mAdapter; ViewPager mPager; PageIndicator mIndicator; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle

onTouch MotionEvent getTouchMinor and getTouchMajor always the exact same number result, why?

匿名 (未验证) 提交于 2019-12-03 02:27:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Looking at the documentation, the touch major and touch minor are axis of the ellipse for the touch event. one is for the length of the touch area longest measurement and the other for the shortest of the touch event. like the measurement of an ellipse. however, i tested this code for getTouchMajor and getTouchMinor methods on several android tablets. and did this with putting my finger down so that the surface area touching the screen would be longer in one direction so it would not be a circle. this way the max and min numbers should not

SMS Delivery Report in Android

匿名 (未验证) 提交于 2019-12-03 02:16:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I want to get SMS delivery report I am trying many examples but, one flow not displaying delivery report like if my balance is 0 when SMS sending in my code is not displaying SMS delivery report failed otherwise shows report like no service etc.. I want to find SMS sending failed delivery report when my balance is 0. Help me with any code! Thanks in Advance! 回答1: BroadcastReceiver sendBroadcastReceiver = new SentReceiver(); BroadcastReceiver deliveryBroadcastReciever = new DeliverReceiver();; @Override protected void onPause() { // TODO Auto

android request runtime permission to call action [closed]

匿名 (未验证) 提交于 2019-12-03 02:16:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: i have code for call action and i need best way to declare run time permission ive tried many codes but i always get error here is my basic code any suggestion for make it work with runtime permission thanks in advance public class MainActivity extends Activity { private Button button; private EditText etPhoneno; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); button = (Button) findViewById(R.id.buttonCall); etPhoneno = (EditText) findViewById(R.id.editText1); //

第八次作业

巧了我就是萌 提交于 2019-12-03 02:15:36
xml <?xml version="1.0" encoding="utf-8"?><android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity"> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:background="#55000000" android:orientation="vertical" android:paddingLeft="30dp" android:paddingRight="30dp" > <LinearLayout android:layout_marginTop="80dp"

Android - Unable to get the gps location on the emulator

匿名 (未验证) 提交于 2019-12-03 02:14:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: i'm tring to use the gps on the android emulator, i've the following code: public class NL extends Activity { private LocationManager locmgr = null; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.nl); locmgr = (LocationManager) getSystemService(Context.LOCATION_SERVICE); Criteria crit = new Criteria(); crit.setAccuracy(Criteria.ACCURACY_FINE); String provider = locmgr.getBestProvider(crit, true); Location loc = locmgr.getLastKnownLocation(provider); Toast msg = Toast

Android Toast started from Service only displays once

匿名 (未验证) 提交于 2019-12-03 02:13:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a service that monitors a socket connection. When the connection is lost it needs to display a Toast informing the user that it is reconnecting. This works fine the first time. After that I see the enqueueToast in the log but the toast is not displayed. Any ideas are appreciated. I thought this was going to be an easy thing to add, but I must be missing something. Log entry INFO/NotificationService(118): enqueueToast pkg=com.abc callback=android.app.ITransientNotification$Stub$Proxy@43f7b100 duration=1 Code that calls the Toast public

Camera API not working on KITKAT

匿名 (未验证) 提交于 2019-12-03 02:06:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I have a really strange problem. The following code I have is used to take a picture on button click. It works properly on Jelly Bean phones, but not on Kitkat: MainActivity.java : package com . example . takepic ; import android . app . Activity ; import android . content . pm . PackageManager ; import android . hardware . Camera ; import android . hardware . Camera . CameraInfo ; import android . os . Bundle ; import android . util . Log ; import android . view . View ; import android . widget . Button ; import android . widget .

Android Place Picker (PlacePicker) no longer has Search icon after updating to Google Play Services 9.0.83

匿名 (未验证) 提交于 2019-12-03 01:59:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Very recently some of my users began reporting that the search icon had disappeared from the PlacePicker UI widget. I was able to isolate the issue to updating to Google Play Services 9.0.83. Has anybody found a workaround to get the search icon back again? Update: I also noticed that the setLatLngBounds() method of the PlacePicker.IntentBuilder class no longer functions properly after updating to 9.0.83. It centers the map at 0 lat, 0 long out in the Ocean off the coast of Africa. As long as I do not invoke setLatLngBounds() the PlacePicker