w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
  Home » ANDROID » Page 25
Using demo cards from cardslib
You have to define this card. Here you can find all the code in demo app: Fragment: Card code

Categories : Android

Android studio code completion not working properly
Ctrl+P, Parameter info (within method call arguments) If you using MAC OS X, then use ⌘P and the name of the functionality is "parameter info" (from View > Parameter Info) There's a nice explanation here

Categories : Android

MIT App Inventor 2 Creating Components With Procedures
No, you can't create new components during runtime of the app with App Inventor. But you can prepare as much components (for example buttons) as you think you will need and hide them. Then as soon you need them, just set their visibility to true.

Categories : Android

Import existing Android NDK project into VS2015 RC and RTM
I'm guessing if you got the VS2015 Community or Enterprise that was recently released, you could download it with the VS installer. If you already have a VS2015 installed, then go to Program and Features on you computer, go to Uninstall a program, look for Visual Studio 2015, click on it, the installer should come up, then click the modify button at the bottom of the installer, it should walk you

Categories : Android

Using the same cursor twice via a button with java/android
public class MainActivity extends Activity { Cursor dat; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); get_data(); } private void get_data() { Cursor dat = myDb.get_dat(); cur_get(dat); } private void cur_get(Cursor cursor) { if (cursor.moveToFirst()) { do {

Categories : Android

Setting Dialog ImageView from Activity
I would think you could just create a public method in your dialog that gives access to the image view in its custom view. So like public ImageView getDialogImageView(), then in your activity just check if the Image view is null and if not then set the image in onActivityResult. You might also want to use a WeakReference to do this so it can be garbage collected when you're done.

Categories : Android

RuntimeException: Unable to start activity componentInfo and InflateException: Error Inflating Class Fragment from setcontentview()
Caused by: java.lang.ClassCastException: android.widget.Button cannot be cast to android.widget.EditText This is the important part. The Logcat can seem difficult to read in the beginning, but it almost always tells you what's wrong. The next line even tells you where this happens: E/AndroidRuntime(1309): at meng.jerry.fragmentexample.ToolbarFragment.onCreateView(ToolbarFragment.java:50)

Categories : Android

PhoneGap CLI Error to Run or Emulate on Android
for phonegap or cordova first you needed to setup environment variables...have you set up that ? if yes then pls let me see which path have you set up... common path needed to setup are variable : ANDROID_HOME value : C:Androidsdk variable : ANT_HOME value : C:apache-ant-1.9.4 variable : JAVA_HOME value : C:Program FilesJavajdk1.7.0_45 variable : PATH value : (npminstallationdirectory)AppD

Categories : Android

OpenGL ES - How to implement the Glossy Shader in Blender Cycles Render?
That effect is basically just a gaussian blur filter. There is a good example of this for OpenGL ES 2.0 in the PowerVR SDK in these files: ExamplesIntermediateBloomOGLES2BlurVertShader.vsh: // Blur filter kernel shader // // 0 1 2 3 4 // x--x--X--x--x <- original filter kernel // y---X---y <- filter kernel abusing the hardware texture filtering // | // texel cente

Categories : Android

Will a Slave device need a different application than the Master?
The best way to do this would be to just make one application and then just have different code logic based on if the device is a master or a slave. Instead of doing just a simple SPP connection, you could create a sort of bluetooth "Server" and wait until x number of devices connect to the server and then do whatever it is you want to do in your app. An example (From the developer guide: Here

Categories : Android

Android Samsung Galaxy s5 on linux
Check this Post http://developer.android.com/tools/device.html You need to create file at /etc/udev/rules.d/51-android.rules with below content SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", MODE="0666", GROUP="plugdev"

Categories : Android

android studio - gradle executing tasks hangs on generateDebugSources
Looks like i had used an older version of Android Studio a while back and the folder was located somewhere else. I delete the traces of all android studio versions and then downloaded the latest one. This is what worked for me.

Categories : Android

what does handle() in android handlers
I am working on an android project where previous coders used Handlers More importantly, the previous coders didn't use a distinct class name, causing confusion for others encountering the code base. Please slap the previous coders with a trout for me. Am I looking in the wrong place, or what is this for? As you discovered, this isn't android.os.Handler, but something else. My guess is

Categories : Android

Android 5 lollipop update remove all AIR apps
Seems to be a known issue now. Both Adobe and Google are working on it. Hopefully.

Categories : Android

How to create a click animation for items in a RecycleView
You can accomplish this using you viewholder in your RecyclerAdapter class. //this goes in your recyclerView adapter.... /** * View holder for workouts */ public static class MyViewHolder extends RecyclerView.ViewHolder { // each data item is just a string in this case public TextView mTitleView; public TextView mTView1; public View homeView;

Categories : Android

Single-pane to Two-pane
You can accomplish your desired behavior by using the navigation drawer scheme for your app. Since ultimatly the two parts of the layout (The drawer and the detail) are both fragments you can have one layout just work like a normal navigation drawer where it slides back and forth. Then in your tablet layout make the fragment not slide and just be permanently visible. In your main activity you can

Categories : Android

Universal-Image-Loader | SSLHandshakeException: Handshake failed
If I'm right you have to create a certificate, sign it and include it in your app. Or change the server configuration (further information here). Otherwise you can trust every handshake within your app. This is not the best approach, but really useful during implementation. Include this class in your project public class SSLCertificateHandler { protected static final String TAG = "NukeSSLCert

Categories : Android

getChildAt returns incorrect view in GridView
You can use getFirstVisiblePosition to retrieve the offset for the first child int firstPosition = gridView.getFirstVisiblePosition(); int childPosition = position - firstPosition; TextView txtView = (TextView)gridView.getChildAt(childPosition); This should give you the correct position. Of course, you should check whether childPosition is actually a valid position (i.e. not <0 or >=gridV

Categories : Android

How to update imported modules with code modification from the their external library project in Gradle/Android Studio
You must not add the external library as a module. It will make copy of it under your project folder. What you have to do is: 1) Delete the library folder in your current project. 2) Open the 'seeting.gradle' file and add these: include ':your_external_library_module_name', ':perhaps_second_external_library' project (':your_external_library_module_name').projectDir = new File('../path/to/your/

Categories : Android

Android How to put activity in the background but not in stack
Think you need to read this: http://developer.android.com/training/implementing-navigation/ancestral.html If you want to always exit your app when pressing back in A, then you can override 'onBackPressed'. Regarding how you would keep A 'alive' so to speak, you could set A to be 'singleInstance' or 'singleTask' in your manifest Android singleTask or singleInstance launch mode?

Categories : Android

ViewPager with Fragments holding GridView
This is weird... @Override public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); grid = (GridView) getActivity().findViewById(R.id.gridView1); grid.setAdapter(new MyAdapter()); } Why are you looking for gridView in Activity? Probably you should do this in your onCreateView without messing in onActivityCreated @Override pu

Categories : Android

Visual Studio 2015, Android NDK with libc++ and cmath issues
The reason for this is that the <math.h> that exists for android platforms 19 and below has these typedefs enclosed by an #if 0 #endif block. For these platforms, these extra defines are in $(NDKRoot)/sources/android/support/include Simply including this folder in Visual Studio's project settings leads to a successful compile. As an aside, the <math.h> file for platform 21 in th

Categories : Android

My date time picker shows date starts from 1990 not the system date
You are fetching the current date wrong. Your IDE should display a warning. Here's the proper way: Calendar calendar = Calendar.getInstance(); DatePickerDialog dpd = new DatePickerDialog(this, new DatePickerDialog.OnDateSetListener() { @Override public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {

Categories : Android

android Application class singletons and global variables
Using Singletons on Android in and of itself is nothing bad, the Android guide even suggests it as one way to share data between activities. However, one thing you should be very careful with in the Android framework is passing Context items through Singletons. Unlike your application itself, Activities and Fragments get reclaimed by the system for various reasons (explicit activity destruction,

Categories : Android

Multiple Custom ListFragment in view pager
In your XML, change these android:id="@+id/android:list" android:id="@+id/android:empty" to these: android:id="@android:id/list" android:id="@android:id/empty" In your Fragments, change mListView = (ListView) getActivity().findViewById(R.id.list); to mListView = (ListView) rootView.findViewById(android.R.id.list); These are the proper ways to reference resource ids declared in the andr

Categories : Android

android fragmentList searchview
Did you see this link: http://blog.aimanbaharum.com/2014/07/android-development-8-implementing.html? In any case you can't use SearchView in Fragment, but you can get result in Activity and then send to a fragment or update it. See this: http://stackoverflow.com/a/10439682/3864698

Categories : Android

Android App restarts when I open it on my phone
The onPause() and onResume() methods might be what you're looking for. Check the Facebook SDK for details on persistent authentication, even when the app is closed. Check this SO post out for more details How to keep android applications always be logged in state? And no, I don't believe this is Android doing any garbage collection.

Categories : Android

Fullscreen on an Android device with objects off stage
In your app.xml file for this project do you see <fullScreen>true</fullScreen> after <initialWindow> If not, write it in, exactly as shown, and publish to your Android device using ADT.

Categories : Android

Run tests from Android Studio but terminal
When i understood correct, then you like to run single tests in Android Studio. I can tell you different ways: Use Intellij with Android Plugin, thats the way supported by deckard-gradle. The robolectric-gradle-plugin "support" run tests in Android Studio it but need much manual effort also explained here at the last "obsolete" part https://github.com/nenick/android-gradle-template/wiki/Tests-in

Categories : Android

Indeterminate circle progress bar on android is white, despite colorAccent color
I managed to change the colour of the ProgressBar on API 21 programatically from the green, to white like this: mProgressBar.getIndeterminateDrawable().setColorFilter(new LightingColorFilter(0xFF000000, 0xFFFFFF)); However, I still can't figure out how to do it in XML, but hopefully this will help someone.

Categories : Android

FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS Causes content to go below navigation bars
Try setting this flag getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); before super.onCreate(savedInstance) And after super, anytime in the activity you can set the Status bar color.

Categories : Android

Mapview displays blank but fragment is ok
You need to initialize the map yourself: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // Gets the MapView from the XML layout and creates it MapView mapView = (MapView) findViewById(R.id.map); mapView.onCreate(savedInstanceState); // Gets to GoogleMap from the MapView and does i

Categories : Android

Regarding MQTT PubAck with QoS level one
No it means the broker will continue to send the message to the subscriber until it gets an acknowledgment. The paho mqtt client code should handle this all for you. The only thing you may want to do when using QOS1 is to check for duplicate messages in the onmessage callback. The best way to do this is to include a unique of in the message payload

Categories : Android

Android Error when setting text on EditText
have you tried using? EditText et = (EditText) (EditText) this .findViewById(R.id.EditText2); while having in your layoutfile <EditText android:id="@+EditText2/" .../> if you are using int c=5; this.getChildAt(c); you are getting the 5th elemenet in the curent layout hirarchy. that may also work but is quite uncommon and fragile. if you later change

Categories : Android

Expandable Listview not showing
your layout should be: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".noticias" > <ExpandableListView android:id="@+id/list" android:layout_width="fill_parent" android:layout_height="wrap_content" android:

Categories : Android

Android program crashes upon trying to change activities
I think you just forgot to add ActivityB to your manifest your manifest should be something like this <application android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme"> <activity android:name=".ActivityA" android:label="@string/title_activity_a"> <intent-filter>

Categories : Android

Correctly handling sendBroadcast() from an IntentService
I don't know about how you can with your current scenario but developers do same thing in a different ways. They use EventBus (Otto, GreenRobot's EventBus) that is designed for same purpose which you are doing and it do job very nicely. So use it and you will find it interesting.

Categories : Android

Optimising Android file writing
Firstly you should try to do this in the background. The AsyncTask is fairly well suited for the task. Other than that, you should remove the flush() statement, and probperly close() your file writer. The flush causes the data to be written to disk in rather small portions, which is really slow. If you leave the filewriter to its own flushing, it will determine a buffer size on its own. When you

Categories : Android

IMPOSSIBLE to configure your SDK Via Configure | Project Default | Project Structure | SDKs
Simple Open the Android Studio. First click on File menu then Project Structure then you will find an option to set the SDK location. Now instead of writing path simply browse then you are done. It should solve your problem.

Categories : Android




© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.