spot7.org logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories
  Home » ANDROID » Page 4
Sending a string from FragmentActivity to Fragment through FragmentPagerAdaptor
try like this, in Fragment Activity mAdaptor = new TabsPagerAdaptor(getSupportFragmentManager(),vehicleNumber); & in FragmentPagerAdaptor, String mvehicleNumber; public TabsPagerAdaptor(FragmentManager fragmentManager,String vehicleNumber) { super(fragmentManager); this.mvehicleNumber = vehicleNumber; } @Override public Fragment getItem(int index) { //

Categories : Android

Android activity ComponentInfo
initialize private boolean getCurrentActivity = false; Change code, Log.e("Activity is : ", getCurrentActivity+""); by Log.e("Activity is : ", Boolean.toString(getCurrentActivity)); & Log.e ( "Fill Items in ServiceDialog", e.getMessage () ); by Log.e("Fill Items in ServiceDialog", "I got an error", e); hope it will help you

Categories : Android

How to change text in a Toast Notification dynamically while it's being displayed?
You can save your instance of Toast which you get from makeText and update it with setText. UPDATED Code: public class MainActivity extends ActionBarActivity { private Toast mToast; private int count = 0; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); findViewB

Categories : Android

Android - Record video in background and simultaneously show the recording video in a Surface View
try this ,it is worked perfectly for me :) my activity class public class CameraRecorder extends Activity implements SurfaceHolder.Callback { private static final String TAG = "Recorder"; public static SurfaceView mSurfaceView; public static SurfaceHolder mSurfaceHolder; public static Camera mCamera ; public static boolean mPreviewRunning; /** Called when the activity is first created. */ @Over

Categories : Android

How to prevent interruption of audio track playing when power button is pressed in android?
You need to keep CPU on by holding a wakelock. Do not forget to release lock once done with playback. PowerManager powerManager = (PowerManager) getSystemService(POWER_SERVICE); Wakelock wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "MyWakelockTag"); wakeLock.acquire();

Categories : Android

Return to mainActivity after being idle Android
1 ] Add screen timeout in your settings. 2 ] Use a BroadcastReceiver to trigger the Screen ON & OFF situations.You will get reference from here

Categories : Android

App Force Closing as soon as I try to Put ads in it
use in your Activity class AdView adView = (AdView) this.findViewById(R.id.ad); AdRequest adRequest = new AdRequest.Builder().build(); adView.loadAd(adRequest); Admob

Categories : Android

Using Saved Game Service for non-game apps
It sounds like a better solution would be to use the Google Drive API. Specifically, the ability to store application data. From the developer doc: The 'Application Data folder' is a special folder that is only accessible by your application. Its content is hidden from the user, and from other apps. Despite being hidden from the user, the Application Data folder is stored on the user's

Categories : Android

Viewpager in fragment not getting updated when navigating back to fragment
Finally I found the solution. Issue was in initialisation of my viewPager. I need to initiate it by, pager.setAdapter(new ImagePagerAdapter(this.getChildFragmentManager())); instead of pager.setAdapter(new ImagePagerAdapter(this.getFragmentManager())); I had refered FragmentPagerAdapter getItem is not being triggered accepted answer. Hope it might help someone who is facin

Categories : Android

Android Dialog theme with round corners
You just need to create Set custom background to your Parent RelativeLayout named reLayoutCustomizedAlert rouund_corner_bg.xml <?xml version="1.0" encoding="UTF-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android"> <stroke android:width="1dp" android:color="@android:color/transparent" /> <solid android:color="@android:color/transparent" /> &l

Categories : Android

Error in Manifest.xml when adding PACKAGE_USAGE_STATS [Android Lollipop]
The AndroidManifest.xml error can be fixed by disabling lint errors. Specifically Security - SignatureorSystemPermissions I guess after that the settings app will show your app.

Categories : Android

I have a maps fragment activity which i want to convert into fragments
First of all, change your FragmentActivity to Fragment. Also since MapFragment is also a Fragment, so you will be having nested Fragments now. There are plenty of solutions/hacks available to use nested Fragment (for your case it is MapFragment inside Fragment). But the most recommended one is to add MapFragment dynamically to your Fragemnt. For that you have to follow these simple steps. First o

Categories : Android

Scrollview Android how to start at determinate position
try this for Example <?xml version="1.0" encoding="utf-8"?> <HorizontalScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/ScrollView1" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_marginTop="50dp" android:scrollbars="horizontal" > <RelativeLayout android:layout_width="wrap_c

Categories : Android

tabhost implement sliding effects
Try this code from github https://github.com/jittya/SwipeableTabView Java Code : LinearLayout SwipableViewTabConntainer=(LinearLayout)findViewById(R.id.SwipableTabViewContainer); ArrayList<String> titles=new ArrayList<String>(); titles.add("One"); titles.add("Two"); titles.add("Three"); titles.add("Four"); titles.add("Five");

Categories : Android

CircledImageView always have rectangle image in front of the circle
you can create your own custom circular ImageView extending ImageView Class... i have created one.. may be you can use it.. public class CircularImageView extends ImageView { private int borderWidth; private int canvasSize; private Bitmap image; private Paint paint; private Paint paintBorder; public CircularImageView(final Context context) { this(context, null);

Categories : Android

Check if camera is turned on?
Try this code (from Android developer): /** A safe way to get an instance of the Camera object. */ public static Camera getCameraInstance(){ Camera c = null; try { c = Camera.open(); // attempt to get a Camera instance } catch (Exception e){ // Camera is not available (in use or does not exist) } return c; // returns null if camera is unavailable }

Categories : Android

How to store multiple Toggle button states in a Boolean Array in Android
Put them into list and set tags(Which is position inside list ) on them and also set OnCheckedChangedListener on them and getThat location when their status changes and have an array with same number of locations and update location by using the tag(which is the list location)

Categories : Android

Android Converting String Variable of Coordinates to Point
What you are looking for is how to split a string, and there are a few excellent examples on SO for you to peruse. In your case, this will work: String yourString = "(34872.1297,41551.7292)"; // Strip out parentheses and split the string on "," String[] items = yourString.replaceAll("[()]", "").split("\s*,\s*")); // Now you have a String[] (items) with the values "34872.1297" and "41551.7292"

Categories : Android

Creating standalone android library project using Android Studio (0.8.14)
There are a couple of ways I've tried doing this, a quick and easy way to do this is to symlink your library module directory to a directory in your project and add it to your settings.gradle. A better way to do it is to import the library module as a VCS project (local git works fine) It will still clone the library module into each project but changes made to the library will be consistent acros

Categories : Android

Android complaining about content not having Listview with id android.R.id.List despite having that
For an Activity that is extending ListActivity, the ListView needs to exist within the xml file that you are using in the activity, in your case that's the footer_view file. Taken from the Google Dev Site - "ListActivity has a default layout that consists of a single, full-screen list in the center of the screen. However, if you desire, you can customize the screen layout by setting your own view

Categories : Android

Android Service On Notification Bar
You should implement the logic in overridden Activity.onPause() method: @Override public void onPause() { NotificationManager nm = (NotificationManager)ctx.getSystemService( Context.NOTIFICATION_SERVICE ); Notification notification = createNotificationSomehow( .... ); nm.notify( TRAY_ID, notification ); }

Categories : Android

Specific layout advise
u can use linear layout vertical with relative layout in it and in the relative layout use the liner layout horizontal and in the linear layout horizontal use the linear layout vertical. use this format for ur code liner layout vertical -> relative layout -> liner layout horizontal -> relative layout-> liner layout vertical -> textview for example u can try it like tis also ... <RelativeL

Categories : Android

Android accidental button click on ViewPager swipe
I think that the flow you are following is not really good, the button also has the business code to handle the ACTION_DOWN touch event and the parent (ViewPager) always need handle touch event to detect the scroll events, so button will handle the ACTION_DOWN touch event first and then pass the touch to ViewPager. You can move the business code into the OnClickListener of Button or another way y

Categories : Android

variables need to be saved
Try using Android SharedPreferences instead. This is a persistent key-value storage that Android offers for its apps and was designed to covers issues like this. Here's the easy way to use it: SharedPreference prefs = PreferenceManager.getDefaultSharedPreferences(this); // To put a data (in this case a String from your EditText).. Editor editor = prefs.edit(); editor.putString("data", yourString

Categories : Android

Using appcompat previous versions on already installed sdk 21 version
You can't use the previous support library while using the current sdk, platform and build tools and sdk. It will always ask for the Material design files for example. Go to the SDK manager and remove the packages for sdk 21, all of them and download the API 19, which is Kitkat and not Wearables sdk.

Categories : Android

Change row height of ExtendedCalendarView
Change the value of layout_height to what you want: <com.tyczj.extendedcalendarview.ExtendedCalendarView android:id="@+id/calendar" android:layout_height="match_parent" android:layout_width="match_parent"/> eg: <com.tyczj.extendedcalendarview.ExtendedCalendarView android:id="@+id/calendar" android:layout_height="100px" android:layout_width="match_parent"/>

Categories : Android

How can I use gcm and node.js?
You can use this client xmpp https://github.com/node-xmpp/node-xmpp and may be this https://github.com/jacobp100/node-gcm-ccs

Categories : Android

Background Bitmap image in Activity?
To point out, image file size don't effect memory usage. It depend on the image specs: width x height x 1 byte. You shouldn't set splash screen image in code by scaling it depending on screen resolution. The drawable folders are there to do that. Provide a different image with different specs for each of the screen resolution categories (l,m,x,xx,xxx). As a fast solution, copy and paste the s

Categories : Android

Fragment doesn't receive the correct result in onActivityResult
**I also encountered the same problem of OnActivityResult() you have to change your implementation bc incase of Fragment the OnActivityResult() of the Host Activity is called not the fragment's **

Categories : Android

How to play YouTube videos in WebView on Amazon Fire TV?
I've written a class to play a youtube video on Fire TV and it also works on the kindle fire as well. As you know, Youtube doesn't have an offical api and we have to resort to using webviews for this. The class I've pasted here has a lot of stuff besides webviews that you might be curious about so I will explain. First of all, you will find that a YouTube playing webview will keep playing when you

Categories : Android

Android AsyncTask HttpPost Connection Refused
The "uses-permission" should be outside the "application" <uses-permission android:name="android.permission.INTERNET"/> <application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > ... </application> I would also suggest adding <uses-permission android:name="android.permissio

Categories : Android

Android layout similar to Google Now
Sorry, i didn't test much with Google Now, but for the Layout you can follow the instruction below : Root : LinearLayout (Vertical Mode) with 2 child 1, RelativeLayout : layout for static card, no scroll, always be visible on the top 2, ScrollView : Layout for other scolling view below the static, non-scroll layout. has a child is a LinearLayout (Vertical) The drop-down layout and the li

Categories : Android

How can I use Picasso to add icon to Marker?
Picasso provides a generic Target interface you can use to implement your own image destination. Specifically, you will want to override onBitmapLoaded to populate your marker. A basic implementation is given below. public class PicassoMarker implements Target { Marker mMarker; PicassoMarker(Marker marker) { mMarker = marker; } @Override public int hashCode() {

Categories : Android

GCM push notification error: MismatchSenderId
Try using this code: define("GOOGLE_API_KEY", "[YOUR API KEY]"); define("GOOGLE_GCM_URL", "https://android.googleapis.com/gcm/send"); function send_gcm_notify($reg_id, $message) { $fields = array( 'registration_ids' => array( $reg_id ), 'data' => array( "[Attr]" => '[val]', "[Attr]" => '[val]'), ); $headers = array( 'Authorization:

Categories : Android

Integer variable not incrementing
chech this http://developer.android.com/reference/android/text/TextWatcher.html and set all Edit text with afterTextChanged(),beforeTextChanged(), onTextChanged(). q1.addTextChangedListener(new TextWatcher() { public void afterTextChanged(Editable s) { //call method where you are chceking isMatch(s); } public void beforeTextChanged(CharSequence s,

Categories : Android

How to format dates correctly when I use getAttributeValue?
I could resolve as follows: first I had to convert the original string value in a Date object and then a String object. SimpleDateFormat sdfDateBefore = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss", Locale.US); sdfDateBefore.setTimeZone(TimeZone.getTimeZone("UTC")); SimpleDateFormat dateTodayFile = new SimpleDateFormat("yyyy/MM/dd", Locale.US); String fechaFile = xpp.getAttributeValue(null, "fecha

Categories : Android

How do I use tools:overrideLibrary in a build.gradle file?
it doesn't matter that you declare your minSdk in build.gradle. You have to copy overrideLibrary in your AndroidManifest.xml, as documented here <uses-sdk tools:overrideLibrary="com.example.lib1, com.example.lib2"/> The system automatically ignores the sdkVersion declared in AndroidManifest.xml. I hope this solve your problem.

Categories : Android

Is it possible to save levels on google play games services?
If I understand your requirements correctly, the Saved Games API can store the information you want to. The API is basically a blob store. So if you serialize the player's current level, unlocked level list and any other state information, you can load it again (even from a different device). You can refer to the sample CollectAllTheStars2, which saves a multi-level game state by serializing to

Categories : Android

android - get item(position) in adapter returns null
Your adapter code is wrong. you are trying to set bitmap to an ImageView in your activities xml. You need to create new ImageView in the adapter and return it. You can look at here https://github.com/codepath/android_guides/wiki/Using-an-ArrayAdapter-with-ListView

Categories : Android


Recently Add
Wait for all requests in Android Volley
android scrollview not working
Android: How to prevent a Wifi disconnect on DHCP renewal?
Using HorizontalScrollView for gallery - no pictures inside
-bash: export: not a valid identifier
m3u8 Video stops with MediaPlayer: Error (1,-1004)
java.lang.IndexOutOfBoundsException at ListView android
Facebook REST calls for mobile cross-platform app
How to returning image from camera intent and placing in google maps api v2 as thumbnail
How can I add a row to a ListView in one Fragment by clicking the button in another Fragment?
Using MediaController on Android 5
Is TCP packet filtering possible on mobile platforms?
Spinner from editext android
Incomplete file downloaded in android using DataInputStream
How do I delete a row form SQLite DB via ListView and refresh list view?
Change action bar to toolbar, and now I am having force closes. What am I doing wrong here?
Adding buttons below GraphView, all inside a Fragment
Get rotation and display in degrees
What methods are available to execute things in the background
Data Persistence Android
Intent not delivered correctly
Android Studio 1.0 RC 1 Gradle build issues - Could not run build action using Gradle installation
otto eventbus for android behaves differently in release build
How get item ID from ListFragment in android?
Receive bluetooth connection changes after reboot
Encrypting plain-text passwords and passing variables to xml for display in android
android html5 video fullscreenchange not called on entering fullscreen
Want to create API for my android application done using Intel XDK
Gps not getting location
Spannable Text is not working in Dialog Fragment
© Copyright 2017 spot7.org Publishing Limited. All rights reserved.