Skip to main content

Posts

Showing posts with the label android-widget

AutoStart Application not working properly

I am having a Simple AutoStart Application with TimerTask implementation, that works fine in almost many devices. The problem is that it is not working in Samsung Galaxy Y(2.3.6) and DELL XCD35(2.2) . When the device boots TimerTask works for some seconds and then shuts down. I check in the Application->Manage Application , I saw that the Applcation was already in Force Stop State. That means some how my Application gets stopped after some seconds. So, what is the reason for this weird behaviour in these two devices, if anyone has the solution do share it.

how to get html content from a webview?

which is the most simplest method to get html code from webview. i have tried several methods from stackoverflow and google.but cant find an exact method.please mention an exact way. public class htmldecoder extends Activity implements OnClickListener,TextWatcher { TextView txturl; Button btgo; WebView wvbrowser; TextView txtcode; ImageButton btcode; LinearLayout llayout; int flagbtcode; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.htmldecoder); txturl=(TextView)findViewById(R.id.txturl); btgo=(Button)findViewById(R.id.btgo); btgo.setOnClickListener(this); wvbrowser=(WebView)findViewById(R.id.wvbrowser); wvbrowser.setWebViewClient(new HelloWebViewClient()); wvbrowser.getSettings().setJavaScriptEnabled(true); wvbrowser.getSettings().setPluginsEnabled(true); wvbrowser.getSettings().setJavaScriptCanOpenWindowsAutomatically(true); wvbrowser.addJavascriptInterfa

Clickable widgets in android

The developer documentation has seemed to have failed me here. I can create a static widget without thinking, I can even create a widget like the analogue clock widget that will update itself, however, I can not for the life of me figure out how to create a widget that reacts to when a user clicks on it. Here is the best code sample that the developer documentation gives to what a widget activity should contain (the only other hint being the API demos, which only creates a static widget): public class ExampleAppWidgetProvider extends AppWidgetProvider { public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { final int N = appWidgetIds.length; // Perform this loop procedure for each App Widget that belongs to this provider for (int i=0; i<N; i++) { int appWidgetId = appWidgetIds[i]; // Create an Intent to launch ExampleActivity Intent intent = new Intent(context, ExampleActivity.c

Android: How to fire onListItemClick in Listactivity with buttons in list?

I have a simple ListActivity that uses a custom ListAdapter to generate the views in the list. Normally the ListAdapter would just fill the views with TextViews, but now I want to put a button there as well. It is my understanding and experience however that putting a focusable view in the list item prevents the firing of onListItemClick() in the ListActivity when the list item is clicked. The button still functions normally within the list item, but when something besides the button is pressed, I want onListItemClick to be triggered. How can I make this work?

Android Creating button dynamically and fill layout

I'm creating a button dynamically. The number of button is depend on the size of arraylist. the problem is, after creating the button I will add to the layout using addview method. The problem is I'm using linear layout, as by default orientation for linear layout is horizontal, so the button will fill the layout horizontally. Because of that some of the button is not visible. What I'm trying to achieve is something look like this My code is like below: Button[] tv = new Button[arraylist.size()]; for(int i=0;i<arraylist.size();i++){ tv[i] = new Button(getApplicationContext()); tv[i].setText(arraylist.get(i).toString()); tv[i].setTextColor(Color.parseColor("#000000")); tv[i].setTextSize(20); tv[i].setPadding(15, 5, 15, 5); linearlayout.addView(tv[i]); } If I set the orientation of linear layout to vertical the button will fill vertically. So if there any solution to create the button dynamical