Okhelp.cz

Recepty, články, nápady, programování. Dříve dum-zahrada, finance, internet a know-how.okhelp.cz Pro lepší výsledky hledání používejte i diakritiku.

Android Widget OnClick Example


AD MOB

Open link in browser after user do click on widget area:

private Context _context;
	@Override
		public void onStart(Intent intent, int startId) {
                        _context = this;
			String definePage ="//old.chmi.cz/meteo/rad/rad_data.php";
			 Intent defineIntent = new Intent(Intent.ACTION_VIEW,
			 Uri.parse(definePage));
			 PendingIntent pendingIntent = PendingIntent.getActivity(_context,
			 0 /* no requestCode */, defineIntent, 0 /* no flags */);
			 updateViews.setOnClickPendingIntent(R.id.widget, pendingIntent);


397LW NO topic_id




AD

Další témata ....(Topics)


186

Set Drawable programmatically Android example | set-drawable-programmatically-android-example



// start_dark.png is stored in path	/package_name/res/drawable/start_dark.png
Drawable dw = getApplicationContext().getResources().getDrawable(R.drawable.start_dark);
Button hButtonStart = (Button)findViewById(R.id.buttonStart);
hButtonStart.setCompoundDrawablesWithIntrinsicBounds(dw, null, null, null);

50

How get package resource apk path on device Android example | how-get-package-resource-path-android-example


On Android device is path to *.apk like this example:
/data/app/cz.okhelp.my_package.apk


How get package *.apk path on device dynamically Android example

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        String sPackagePath = getPackageResourcePath();
     }
211

The container JRE System Library JavaSE references non existing library | the-container-jre-system-library-javase-references-non-existing-library


Eclipse Error: The container JRE System Library JavaSE references non existing library QTJava.zip

Workaround:
Windows->Preferences->Java->Installed JRE
Press Add and select your JRE folder path for example:
c:\Program Files\Java\jre7\
and check your choice.

eclipse instaled jres path dialog
364

Center View in RelativeLayout Android | center-view-in-relativelayout-android


RelativeLayout like parent, child Srollview is centered horizontal.
Second RelativeLayout in SrollView have gravity center, every child will centered horizontally and vertically.


<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="//schemas.android.com/apk/res/android"
    android:layout_width="match_parent" android:layout_height="match_parent"
    android:gravity="center_horizontal">

    <ScrollView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/scrollView2" >

        <RelativeLayout
            android:layout_width="320dp"
            android:layout_height="wrap_content"
            android:background="#e6f825"
            android:gravity="center">

            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="New Button"
                android:id="@+id/button" />
        </RelativeLayout>
    </ScrollView>

</RelativeLayout>
271

How to add or remove widgets home screen android 4 | how-to-add-or-remove-widgets-home-screen-android-4


Video tutorial
How to add or remove widgets home screen Android 4.




Editace: 2013-07-01 12:29:20
Počet článků v kategorii: 397
Url:android-widget-onclick-example

AD
11 Share
Share
Tweet