Search Results

Search found 15838 results on 634 pages for 'android layout'.

Page 16/634 | < Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >

  • MVC 2 View Layout CSS Control Layout

    - by Cory Mathewson
    I'm new to a lot of what I'm trying to do with the development of a new MVC2 web application so this is a beginner question. I need to understand my options for control and content layout on a web page. I’m using MVC2 so I’m using Controllers, Views, ViewModels, and View Templates. What I need to spin up on…fast…is control the granular layout of controls and content on any particular view. Below I’ve pasted two examples of auto generated templates that illustrate my challenge. I see that layout is controlled by CSS in my Site.css document. In the first example I get a sequential flow of DisplayLabel and DisplayField. I prefer the adjacent layout of DisplayLabel on the same line as DisplayField produced from example 2. However, example 2 is too simple because the formatting is applied to the Label and the Field. I think the correct way to tackle this learning curve is Microsoft Expression but I don’t have personal bandwidth at the moment to tackle Expression. Can anyone point me to a resource that will expose me to lots of examples for CSS formatting? I have lots of syntax questions. For instance, I believe is referencing the Site.css but I can’t find a "display-label" section in Site.css. Example 1 <fieldset> <legend>Fields</legend> <div class="display-label">DocTitle</div> <div class="display-field"><%: Model.DocTitle %></div> <div class="display-label">DocoumentPropertiesID</div> <div class="display-field"><%: Model.DocumentPropertiesID %></div> Example 2 <h2>Title: <%: Model.DocTitle %></h2> <h2>Created: <%: Model.Created %></h2> <h2>Modified: <%: Model.Modified %></h2> <h2>Author: <%: Model.tbl_Author.Name %></h2> <h2>Genre: <%: Model.tbl_DocumentGenre.GenreName %></h2>

    Read the article

  • How do I use PackageManager.addPreferredActivity()?

    - by afonseca
    In SDK 1.5 I was using the PackageManager class to set the preferred home screen to be my app using PackageManager.addPackageToPreferred(). In the new SDK (using 2.1) this has been deprecated so I'm trying to use addPreferredActivity() for the same result but it's not working as expected. Some necessary background. I'm writing a lock screen replacement app so I want the home key to launch my app (which will already be running, hence having the effect of disabling the key). When the user "unlocks" the screen I intend to restore the mapping so everything works as normal. In my AndroidManifest.xml I have: <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.HOME"/> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> <uses-permission android:name="android.permission.SET_PREFERRED_APPLICATIONS"> </uses-permission> In my code I have the following snippet: // Set as home activity // This is done so we can appear to disable the Home key. PackageManager pm = getPackageManager(); //pm.addPackageToPreferred(getPackageName()); IntentFilter filter = new IntentFilter("android.intent.action.MAIN"); filter.addCategory("android.intent.category.HOME"); filter.addCategory("android.intent.category.DEFAULT"); ComponentName[] components = new ComponentName[] { new ComponentName("com.android.launcher", ".Launcher") }; Context context = getApplicationContext(); ComponentName component = new ComponentName(context.getPackageName(), MyApp.class.getName()); pm.clearPackagePreferredActivities("com.android.launcher"); pm.addPreferredActivity(filter, IntentFilter.MATCH_CATEGORY_EMPTY, components, component); The resulting behavior is that the app chooser comes up when I press the Home key, which indicates that the clearPackagePreferredActivities() call worked but my app did not get added as the preferred. Also, the first line in the log below says something about "dropping preferred activity for Intent": 04-06 02:34:42.379: INFO/PackageManager(1017): Result set changed, dropping preferred activity for Intent { act=android.intent.action.MAIN cat=[android.intent.category.HOME] flg=0x10200000 } type null 04-06 02:34:42.379: INFO/ActivityManager(1017): Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.HOME] flg=0x10200000 cmp=android/com.android.internal.app.ResolverActivity } Does anyone know what this first log message means? Maybe I'm not using the API correctly, any ideas? Any help would be greatly appreciated.

    Read the article

  • How to dynamic adjust the number of columns in Table layout

    - by michael
    Hi, I create a TableLayout which has 3 equally-wide columns (I put 'stretchColumns="*" in my TableLayout which has 3 TextViews). See below: But my questions is why I set one of the TextView to 'visibility' to Gone in my java code, the TableLayout does not re-size to 2 qually-wide columns which fit the whole screen. I have even call 'tableLayout.requestLayout()' after i set the visibility to Gone.' How can I achieve what I want? Thank you. <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/textpanel" android:stretchColumns="*"> <TableRow android:layout_width="fill_parent" android:layout_height="wrap_content"> <TextView android:id="@+id/text1" android:layout_width="fill_parent" android:layout_height="wrap_content"/> <TextView android:id="@+id/text2" android:layout_width="fill_parent" android:layout_height="wrap_content"/> <TextView android:id="@+id/text3" android:layout_width="fill_parent" android:layout_height="wrap_content"/> </TableRow> </TableLayout>

    Read the article

  • How to dynamic adjust the width of columns in Table layout

    - by michael
    Hi, I create a TableLayout which has 3 equally-wide columns (I put 'stretchColumns="*" in my TableLayout which has 3 TextViews). See below: But my questions is why I set one of the TextView to 'visibility' to Gone in my java code, the TableLayout does not re-size to 2 qually-wide columns which fit the whole screen. I have even call 'tableLayout.requestLayout()' after i set the visibility to Gone.' How can I achieve what I want? Thank you. <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/textpanel" android:stretchColumns="*"> <TableRow android:layout_width="fill_parent" android:layout_height="wrap_content"> <TextView android:id="@+id/text1" android:layout_width="fill_parent" android:layout_height="wrap_content"/> <TextView android:id="@+id/text2" android:layout_width="fill_parent" android:layout_height="wrap_content"/> <TextView android:id="@+id/text3" android:layout_width="fill_parent" android:layout_height="wrap_content"/> </TableRow> </TableLayout>

    Read the article

  • Android Window Mananger leacked windwo progress dialog

    - by saravanan-palpandi
    05-14 16:53:52.273: ERROR/WindowManager(412): Activity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@43db2e68 that was originally added here 05-14 16:53:52.273: ERROR/WindowManager(412): android.view.WindowLeaked: Activity com.sss.client.AddClient has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@43db2e68 that was originally added here 05-14 16:53:52.273: ERROR/WindowManager(412): at android.view.ViewRoot.(ViewRoot.java:227) 05-14 16:53:52.273: ERROR/WindowManager(412): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:148) 05-14 16:53:52.273: ERROR/WindowManager(412): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91) 05-14 16:53:52.273: ERROR/WindowManager(412): at android.view.Window$LocalWindowManager.addView(Window.java:424) 05-14 16:53:52.273: ERROR/WindowManager(412): at android.app.Dialog.show(Dialog.java:239) 05-14 16:53:52.273: ERROR/WindowManager(412): at android.app.ProgressDialog.show(ProgressDialog.java:107) 05-14 16:53:52.273: ERROR/WindowManager(412): at android.app.ProgressDialog.show(ProgressDialog.java:90) 05-14 16:53:52.273: ERROR/WindowManager(412): at android.app.ProgressDialog.show(ProgressDialog.java:85) 05-14 16:53:52.273: ERROR/WindowManager(412): at com.sss.client.AddClient.searchValues(AddClient.java:236) 05-14 16:53:52.273: ERROR/WindowManager(412): at com.sss.client.AddClient.clientFormAction(AddClient.java:264) 05-14 16:53:52.273: ERROR/WindowManager(412): at java.lang.reflect.Method.invokeNative(Native Method) 05-14 16:53:52.273: ERROR/WindowManager(412): at java.lang.reflect.Method.invoke(Method.java:521) 05-14 16:53:52.273: ERROR/WindowManager(412): at android.view.View$1.onClick(View.java:2026) 05-14 16:53:52.273: ERROR/WindowManager(412): at android.view.View.performClick(View.java:2364) 05-14 16:53:52.273: ERROR/WindowManager(412): at android.view.View.onTouchEvent(View.java:4179) 05-14 16:53:52.273: ERROR/WindowManager(412): at android.widget.TextView.onTouchEvent(TextView.java:6540) 05-14 16:53:52.273: ERROR/WindowManager(412): at android.view.View.dispatchTouchEvent(View.java:3709) 05-14 16:53:52.273: ERROR/WindowManager(412): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884) 05-14 16:53:52.273: ERROR/WindowManager(412): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884) 05-14 16:53:52.273: ERROR/WindowManager(412): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884) 05-14 16:53:52.273: ERROR/WindowManager(412): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884) 05-14 16:53:52.273: ERROR/WindowManager(412): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884) 05-14 16:53:52.273: ERROR/WindowManager(412): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1659) 05-14 16:53:52.273: ERROR/WindowManager(412): at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1107) 05-14 16:53:52.273: ERROR/WindowManager(412): at android.app.Activity.dispatchTouchEvent(Activity.java:2061) 05-14 16:53:52.273: ERROR/WindowManager(412): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1643) 05-14 16:53:52.273: ERROR/WindowManager(412): at android.view.ViewRoot.handleMessage(ViewRoot.java:1691) 05-14 16:53:52.273: ERROR/WindowManager(412): at android.os.Handler.dispatchMessage(Handler.java:99) 05-14 16:53:52.273: ERROR/WindowManager(412): at android.os.Looper.loop(Looper.java:123) 05-14 16:53:52.273: ERROR/WindowManager(412): at android.app.ActivityThread.main(ActivityThread.java:4363) 05-14 16:53:52.273: ERROR/WindowManager(412): at java.lang.reflect.Method.invokeNative(Native Method) 05-14 16:53:52.273: ERROR/WindowManager(412): at java.lang.reflect.Method.invoke(Method.java:521) 05-14 16:53:52.273: ERROR/WindowManager(412): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860) 05-14 16:53:52.273: ERROR/WindowManager(412): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618) 05-14 16:53:52.273: ERROR/WindowManager(412): at dalvik.system.NativeStart.main(Native Method) when show the dialog box it show the error message please do reply me

    Read the article

  • Linear Layout Issue at Runtime

    - by George
    Hi all, I am trying to build a layout dynamically which display some text and image for the most part, but has a series of buttons placed next to each other in the bottom. I have a linear layout that carries the text, another linear layout that carries the image. And yet another linear layout that carries the buttons that get created in a for loop. I have a main layout aligned vertical that adds the text, image and buttons layout, in that order. To finally generate something like this: Text .... Image ... Button1 Button2 Button3.... The problem is the number of buttons get decided at runtime, so if there are more than 4 buttons, the 5th button gets displayed really tiny. Also, when I tilt the phone, I get only the text and image showing, but no buttons coz the image covers the entire screen. Layoutting seems to be pretty complicated to me, any help is appreciated! Thanks George

    Read the article

  • Layout Question - OnItemClickListener not working now

    - by user244190
    Ok, after figuring out the earlier question 'Layout Question', now my OnItemClickListener, and ItemLongClickListener(ContextMenu) have stopped working. With just the TextView it works fine xml: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content"> <TextView android:id="@+id/txtVehName" android:hint="@string/VEH_NAME" android:textSize="18dp" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginTop="10dip" android:layout_alignParentBottom="true" > </TextView> <RadioButton android:id="@+id/rbDefault" android:text="" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_alignParentBottom="true" > </RadioButton> </RelativeLayout> Anyone have any ideas as to why this would stop working? thanks

    Read the article

  • Self updating app, wont overwrite existing app, using Android packagemanager?

    - by LokiSinclair
    I know there are plenty of questions about this on here, but I've tried everything (but the correct 'thing', obviously!) and nothing seems to shine any light on the problem I'm having. I've written an app (for a customer), which is designed to be hosted on their own server. The app references a simple text file with the latest version code in it and checks it against it's own version. If it's out of date it goes off and downloads the update. Everything is working as intended up to this point. I use the: Intent i = new Intent(Intent.ACTION_VIEW); i.setDataAndType(Uri.fromFile(outputFile), "application/vnd.android.package-archive"); i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(i); ...code to start the install process of the newly downloaded .apk file. And that all starts as I would expect. I click on "Install" - when I'm prompted to confirm the overwriting of the current app, with the new. It starts, and then displays: App not installed. And existing package by the same name with a conflicting signature is already installed. Now I'm aware that Android can't have multiple applications sharing the same package name, which is fine, but nothing comes up in LogCat and I can only assume that the OS is annoyed at me attempting to 'update' my app, even though I'm going through all the correct channels and using the inbuilt package manager to do it for me! Can anyone tell me what the OS is moaning about? I'm not attempting to install two apps side by side, I want it to update it, which it starts to do, and then gets really confused. Is it something to do with me using the same keystore for signing the packages? I highly doubt it as I've used the same keystores previously to handle updates to games and the like, but I just can't figure out what it's complaining about. Hopefully someone out there has had this issue and solved it, and can point me in the right direction. I'm flying a bit blind with the limited information it's giving me :( Cheers.

    Read the article

  • how does scrolling in android listview work?

    - by gartenkralleb
    hi, i have an android-app with a listview in an activity. the listview has, if i call it so, three data states. no data loaded from inet - only one dummy item is visible, saying that data is loading data is loaded and shown in list one listitem is clicked and now shows more information for this listitem (so it is increased in its height) on every state change (1 - 2, 2 - 3) i call notifyDataSetChanged() on this ListAdapater. this causes the listview to scroll down to the last item. this is ugly in the first transition and even more ugly in the second because the clicked list item is now out of focus. as i can see, this happens with a google g1 with android 1.6. a htc touch with the same sdk acts like desired (i try to figure it out with some more devices). to avoid this i tried to read out getScrollY() and set this value back. but this returns 0. the reason for this return value i already found on stackoverflow in other qutestions. does anyone else comes along with my problem so far? why does the listview scrolls to the last item? it was mentioned, that listview does keep track on the scroll position. but it seems that it does not in my case. or may i call the wrong refresh method? is notifyDataSetChanged the correct one?

    Read the article

  • Android reset activity component state on navigation back

    - by Aure77
    I have 2 activities in my application. In activity1, I set some configuration and I modify the state of some component (ex: set button state disabled). And I navigate to activity2. In activity2 I do some stuff and at end, I finish this activity and come back to activity1. But In activity1, my components state are the same when I leave this activity. How to reset the components state with valuesdeclared in XML file (layout) ?

    Read the article

  • Changes to keyboard layout resetted on restart

    - by Matthieu Napoli
    I edited /usr/share/X11/xkb/symbols/fr to customize the french-dvorak layout. I then selected french-dvorak layout (instead of french). Now when I restart Ubuntu, I end up with the non-edited french-dvorak (my changes are ignored). But if I switch to french, then back to french-dvorak, my changes are now taken into account... How can I have my custom french-dvorak on startup? Is there some sort of cached version of the keyboard layout? I don't understand how it can switch me to the official french-dvorak because I changed it, so it should no longer exist.

    Read the article

  • Android never receives UDP packet

    - by Quandary
    The below code results in a timeout. It works fine on non-Android Java. What's the matter? //@Override public static void run() { //System.out.println ( "Local Machine IP : "+addrStr.toString ( ) ) ; HelloWorldActivity.tv.setText("Trace 1"); try { // Retrieve the ServerName InetAddress serverAddr; //= InetAddress.getByName(Server.SERVERIP); InetAddress ias[] = InetAddress.getAllByName(Server.SERVERNAME); serverAddr = ias[0]; Log.d("UDP", "C: Connecting..."); /* Create new UDP-Socket */ DatagramSocket socket = new DatagramSocket(); /* Prepare some data to be sent. */ String strQuery="ÿÿÿÿgetservers"+" "+Server.iProtocol+" "+"'all'"; Log.d("UDP", strQuery); //byte[] buf = ("ÿÿÿÿgetservers 68 'all'").getBytes(); byte[] buf = strQuery.getBytes(); /* Create UDP-packet with * data & destination(url+port) */ DatagramPacket packet = new DatagramPacket(buf, buf.length, serverAddr, Server.SERVERPORT); Log.d("UDP", "C: Sending: '" + new String(buf) + "'"); /* Send out the packet */ socket.setSoTimeout(5000); socket.send(packet); Log.d("UDP", "C: Sent."); Log.d("UDP", "C: Done."); // http://code.google.com/p/android/issues/detail?id=2917 byte[] buffer= new byte[1024*100]; DatagramPacket receivePacket = new DatagramPacket(buffer, buffer.length); //, serverAddr, Server.SERVERPORT); socket.receive(receivePacket); HelloWorldActivity.tv.setText("TTT"); String x = new String(receivePacket.getData()); Log.d("UDP", "C: Received: '" + x + "'"); HelloWorldActivity.tv.setText(x); } catch (Exception e) { HelloWorldActivity.tv.setText(e.getMessage()); Log.e("UDP", "C: Error", e); } } public class Server { /* //public static java.lang.string SERVERIP; public static String SERVERNAME = "monster.idsoftware.com"; public static String SERVERIP = "192.246.40.56"; public static int SERVERPORT = 27950; public static int PROTOCOL = 68; */ //public static String SERVERNAME="monster.idsoftware.com"; public static String SERVERNAME="dpmaster.deathmask.net"; public static String SERVERIP="192.246.40.56"; public static int SERVERPORT=27950; //public static int iProtocol= 68; // Quake3 public static int iProtocol=71; // OpenArena } Android manifest: <?xml version="1.0" encoding="utf-8"?> <use-permission id="android.permission.READ_CONTACTS" /> <use-permission android:name="android.permission.WRITE_SETTINGS" /> <uses-permission android:name="android.permission.READ_CONTACTS" /> <uses-permission android:name="android.permission.CALL_PHONE" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_GPS" /> <uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_ASSISTED_GPS" /> <uses-permission android:name="android.permission.ACCESS_CELL_ID" /> <uses-permission android:name="android.permission.RECEIVE_SMS" /> <uses-permission android:name="android.permission.VIBRATE" /> <uses-permission android:name="android.permission.WAKE_LOCK" /> <application android:icon="@drawable/icon" android:label="AAA New Application" > <activity android:name="HelloWorldActivity"> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> </application>

    Read the article

  • Missing styles. Is the correct theme chosen for this layout?

    - by user1820007
    Missing styles. Is the correct theme chosen for this layout? Use the Theme combo box above the layout to choose a different layout, or fix the theme style references. Failed to find style 'mapViewStyle' in current theme. I tried every solutions available to solve this problem. But nothing seems to work. I have included library in the manifest file. I even created style is styles.xml. I have chosen Google Apis build target as well. Can somebody please give me a solution. Thank you in advance for your valuable time... here is my xml file: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" style="@style/AppTheme" android:layout_width="fill_parent" android:layout_height="fill_parent" > <com.google.android.maps.MapView android:id="@+id/themap" style="@style/mapViewStyle" android:layout_width="fill_parent" android:layout_height="fill_parent" android:apiKey="here i have my key" android:clickable="true" android:enabled="true" /> </RelativeLayout> ` Here is my manifest snippet: <uses-library android:name="com.google.android.maps" /> <activity android:name=".MainActivity" android:label="@string/title_activity_main" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name=".Second" /> <acttiviy android:name=".Third" android:theme="@android:style/Theme.Black" /> </application> here is my style.xml file <style name="mapViewStyle" parent="@android:style/Theme.Black"> </style> </resources>

    Read the article

  • Can I add a portrait layout on top of a landscape Camera SurfaceView?

    - by Uwe Krass
    My application should hold a camera preview surface. The camera is fixed to landscape view via AndroidMainfest.xml <application android:icon="@drawable/icon" android:label="Camera"> <uses-library android:name="com.google.android.maps" /> <uses-feature android:name="android.hardware.camera" /> <uses-feature android:name="android.hardware.camera.autofocus" /> <activity android:name=".CameraPreview" android:label="Camera" android:screenOrientation="landscape"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> If there is another way to get the camera preview itself to behave correctly, please let me know. Now I need to have an overlay that holds a bunch of buttons. Due to usability, the user interface should be set to portrait view (or even better orientation aware). Is there a way to have a transparent layout (for buttons and other GUI elements) in portrait orientation? I tried to write a special rotated layout by extending a RelativeLayout, but the onDraw method isn't called at anytime. public class RotatedOverlay extends RelativeLayout { private static final String TAG = "RotatedOverlay"; public RotatedOverlay(Context context, AttributeSet attrs ) { super(context, attrs); } @Override protected void onDraw(Canvas canvas) { canvas.rotate(90); super.onDraw(canvas); } I am quite new to the Android plattform programming. Of course I dont know much about the programming tricks and workarounds yet. I did a lot of research over the last two weeks (even studied the native Camera implementation), but couldnt find a good solution so far. Maybe it works with two seperate Activities, but I dont think, that this can the right solution.

    Read the article

  • Android popup style activity which sits on top of any other apps

    - by RenegadeAndy
    What I want to create is a popup style application. I have a service in the background - something arrives on the queue and i want an activity to start to inform the user - very very similar to the functionality of SMSPopup app. So I have the code where something arrives on the queue and it calls my activity. However for some reason the activity always shows on top of the originally started activity instead of just appearing on the main desktop of the android device. As an example: I have the main activity which is shown when the application is run I have the service which checks queue I have a popup activity. When i start the main activity it starts the service - I can now close this. I then have something on the queue and it creates the popup activity which launches the main activity with the popup on top of it :S How do I stop this and have it behave as i want... The popup class is : package com.andy.tabletsms.work; import com.andy.tabletsms.tablet.R; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.Button; import android.widget.PopupWindow; import android.widget.TextView; import android.widget.Toast; public class SMSPopup extends Activity implements OnClickListener{ public static String msg; @Override public void onCreate(Bundle bundle){ super.onCreate(bundle); // Toast.makeText(getApplicationContext(), msg, Toast.LENGTH_LONG).show(); this.setContentView(R.layout.popup); TextView tv = (TextView)findViewById(R.id.txtLbl); Intent intent = getIntent(); if (intent != null){ Bundle bb = intent.getExtras(); if (bb != null){ msg = bb.getString("com.andy.tabletsms.message"); } } if(msg == null){ msg = "LOLOLOL"; } tv.setText(msg); Button b = (Button)findViewById(R.id.closeBtn); b.setOnClickListener(this); } @Override public void onClick(View v) { this.finish(); } } and I call the activity from a broadcast receiver which checks the queue every 30 seconds or so : if(main.msgs.size()0){ Intent testActivityIntent = new Intent(context.getApplicationContext(), com.andy.tabletsms.work.SMSPopup.class); testActivityIntent.putExtra("com.andy.tabletsms.message", main.msgs.get(0)); testActivityIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(testActivityIntent); } The layout is here : http://pastebin.com/F25u6wdM

    Read the article

  • Tunning up Activity with dialog theme

    - by Gaks
    I need to launch a Dialog from home screen widget, so I created an Activity with android:theme="@android:style/Theme.Dialog" The problem is, that I would like make it look like standard dialog window ( buttons on the gray background, font and text size, paddings etc), like here: This is how my "dialog" Activity looks like: Is there some standard way (theme?) to make it look like standard system dialogs? Or do I have to imitate it in my own layout?

    Read the article

  • Can I use android.os.* libraries in a standalone project?

    - by medicdave
    I'm trying to develop an external library (not sure if that's the right term) to provide prepackaged functionality in Android projects. Working in Eclipse, I've added the appropriate android.jar file to the build path, and everything is happy both while editing and upon compilation. However, when I use Android's Handler and Message classes (android.os.Handler, android.os.Message) for inter-thread communication, I get exceptions unless I'm running within an Android app, on the emulator or a device. I can no longer test my library in a "standalone" way without having to go through a running Android target. Is there any way for me to include these two Android classes and still be able to test my library standalone? Do I need to have the Android source available? Or would it require some sort of conditional compilation hand-waving?

    Read the article

  • How to publish paid Android apps if you're not from US/UK

    - by Sheikh Aman
    I was pretty excited while creating one of my apps but as it turns out you can't actually sign up for Google Checkout if you don't live either in the USA or in the UK. And since Google Checkout is the only way Android Market will pay you, all my efforts seem to be going in vain. So because I live in India, I can't sell my apps. I tried contacting Google by various means on this, but haven't got any response so far. I tried searching the web as well just to find out that one can't be paid via any other way. I am pretty sure that many people here might have gone through the same problem. How did you solve it? I have a PayPal account and an AdSense account as well. Can they help in any way? And if nothing works out, how am I supposed to be selling my app?

    Read the article

  • Databinding a ListView with Mono for Android

    - by Wallym
    The world lives on data. Data is all around us and in many forms: salespeople need to know what customers have spent; twitter users want to know what their friends are saying. How do we as developers present data to a user? In Android, we use the ListView in its various forms. In this article, we'll look at using a ListView, how we can work with it, then discuss what we need to do to overcome some of the challenges in a mobile environment.Article url: http://visualstudiomagazine.com/articles/2012/09/14/databind-a-listview.aspx

    Read the article

  • Why is Android VM-based? [closed]

    - by adib
    By about 2004, it was clear that ARM is the clear winner for mobile CPUs, beating out MIPS, SH3, and DragonBall. PocketPC (Windows Mobile) applications was natively-compiled (at least most of them - except for .NET compact and its competitors). Likewise, Apple's iOS (named iPhone OS at the time) prefers natively-compiled applications. Then why Android chose a virtual machine based system stack? (the Dalvik VM). Wouldn't it be simpler to just compile applications down to ARM code using GCJ or something? Is the decision influenced by the J2ME-way of doing things, or was just because it's "cool"? Perhaps like most things Java, the culture that prefers multiple levels of indirection and abstractions, they just added another layer of abstraction for "just in case"?

    Read the article

  • Android design advice - services & broadcast receivers

    - by basudz
    I'm in the process of learning the Android SDK and creating some projects to get a grasp on the system. The current project I'm working with works just fine but I'd like to get some advice about other ways I can go about designing it. Here's what it needs to do. When a text message is received from a specific number, it should fire off a toast message that repeats at a certain interval for a specific duration. To make this work, I created an SMS BroadcastReceiver and checked the incoming messages for the number I'm looking for. If found, an IntentService would be started that would pull out the interval and duration from saved shared prefs. The IntentService would then fire off a broadcast. The BroadcastReceiver for this would catch it and use the AlarmManager to handle the toast message repetitions. This all works just fine, but I'm wondering if there's a cleaner or more efficient way of going about doing this? Any suggestions or advice?

    Read the article

  • Android addTextChangedListener onTextChanged not fired when Backspace is pressed?

    - by tsil
    I use addTextChangeListener to filter a list items. When the user enters a character on the editText, items are filtered based on user input. For example, if the user enters "stackoverflow", all items that contains "stackoverflow" are displayed. It works fine except that once the user press backspace to delete character(s), items are no longer filtered until he deletes all characters. For example, my items are: "stackoverflow 1", "stackoverflow 2", "stackoverflow 3", "stackoverflow 4". If user input is "stackoverflow", all items are displayed. If user input is "stackoverflow 1", only "stackoverflow 1" is displayed. Then user deletes the last 2 characters (1 and the space). User input is now "stackoverflow" but "stackoverflow 1" is still displayed and the other items are not displayed. This is my custom filter: private class ServiceFilter extends Filter { @Override protected FilterResults performFiltering(CharSequence constraint) { FilterResults results = new FilterResults(); if (constraint == null || constraint.length() == 0) { // No filter implemented we return all the list results.values = origServiceList; results.count = origServiceList.size(); } else { List<ServiceModel> nServiceList = new ArrayList<ServiceModel>(); for (ServiceModel s : serviceList) { if (s.getName().toLowerCase().contains(constraint.toString().toLowerCase())) { nServiceList.add(s); } } results.values = nServiceList; results.count = nServiceList.size(); } return results; } @Override protected void publishResults(CharSequence constraint, FilterResults results) { if (results.count == 0) { notifyDataSetInvalidated(); } else { serviceList = (List<ServiceModel>) results.values; notifyDataSetChanged(); } } } And how I handle text change event: inputSearch.addTextChangedListener(new TextWatcher() { @Override public void afterTextChanged(Editable arg0) { // TODO Auto-generated method stub } @Override public void beforeTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) { // TODO Auto-generated method stub } @Override public void onTextChanged(CharSequence cs, int arg1, int arg2, int arg3) { if (cs.length() >= 1) { mAdapter.getFilter().filter(cs); } else { mAdapter = new ServiceAdapter(MyActivity.this, R.layout.ussd_list_item, serviceList); listView.setAdapter(mAdapter); } } });

    Read the article

  • How do I place widgets above and below a listview with Relative Layout

    - by Jay Askren
    I have a list view and want to put stuff both above(on the y axis) and below(y axis) it including images, text views, and a row of buttons. Below is a simplified version of what I am creating. Unfortunately the list covers(i.e. above on the z axis) the header so the header text is not visible instead of being underneath (on the y axis) <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content"> <TextView android:id="@+id/footer" android:text="footer" android:layout_height="wrap_content" android:layout_width="fill_parent" android:layout_alignParentBottom="true" /> <ListView android:id="@+id/list_view" android:layout_height="fill_parent" android:layout_width="fill_parent" android:layout_above="@id/footer" android:background="#ff9999ff"/> <TextView android:id="@+id/header" android:text="header" android:layout_height="wrap_content" android:layout_width="fill_parent" android:layout_alignParentTop="true" android:layout_above="@id/list_view" android:baselineAlignBottom="false" /> </RelativeLayout> Here is the corresponding Activity class: public class SampleListActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.list_activity); } }

    Read the article

  • Is there a difference between starting an application from the OS or from adb

    - by aruwen
    I do have a curious error in my application. My app crashes (don't mind the crash, I roughly know why - classloader) when I start the application from the OS directly, then kill it from the background via any Task Killer (this is one of the few ways to reproduce the crash consistently - simulating the OS freeing memory and closing the application) and try to restart it again. The thing is, if I start the application via adb shell using the following command: adb shell am start -a android.intent.action.MAIN -n com.my.packagename/myLaunchActivity I cannot reproduce the crash. So is there any difference in how Android OS calls the application as opposed to the above call? EDIT: added the manifest (just changed names) <?xml version="1.0" ?> <manifest android:versionCode="5" android:versionName="1.05" package="com.my.sample" xmlns:android="http://schemas.android.com/apk/res/android"> <uses-sdk android:minSdkVersion="7"/> <application android:icon="@drawable/square_my_logo" android:label="@string/app_name"> <activity android:label="@string/app_name" android:name="com.my.InfoActivity" android:screenOrientation="landscape"></activity> <activity android:label="@string/app_name" android:name="com.my2.KickStart" android:screenOrientation="landscape"/> <activity android:label="@string/app_name" android:name="com.my2.Launcher" android:screenOrientation="landscape"> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> </application> <uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/></manifest> starting the com.my2.Launcher from the adb shell

    Read the article

< Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >