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.

Unable to find explicit activity class Android Eclipse error

android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.my_package/com.example.my_package.MainClass}; have you declared this activity in your AndroidManifest.xml?

Is MainClass.java in AndroidManifest as a activity ?
AndroidManifest.xml example

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="//schemas.android.com/apk/res/android"
      package="com.example.my_packag"
      android:versionCode="1"
      android:versionName="1.0">
    <uses-sdk android:minSdkVersion="7" />

    <application android:icon="@drawable/icon" android:label="@string/app_name">
        <activity android:name=".MainClass"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

    </application>
</manifest>

396LW NO topic_id




AD

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


93

Android Emulator PC keyboard shortcuts | android-emulator-pc-keyboard-shortcuts


Basic shortcuts for Android Emulator.
























Emulated Device Key Keyboard Key
Home HOME
Menu (left softkey) F2 or Page-up button
Star (right softkey) Shift-F2 or Page Down
Back ESC
Call/dial button F3
Hangup/end call button F4
Search F5
Power button F7
Audio volume up button KEYPAD_PLUS, Ctrl-5
Audio volume down button KEYPAD_MINUS, Ctrl-F6
Camera button Ctrl-KEYPAD_5, Ctrl-F3
Switch to previous layout orientation (for example, portrait, landscape) KEYPAD_7, Ctrl-F11
Switch to next layout orientation (for example, portrait, landscape) KEYPAD_9, Ctrl-F12
Toggle cell networking on/off F8
Toggle code profiling F9 (only with -trace startup option)
Toggle fullscreen mode Alt-Enter
Toggle trackball mode F6
Enter trackball mode temporarily (while key is pressed) Delete
DPad left/up/right/down KEYPAD_4/8/6/2
DPad center click KEYPAD_5
Onion alpha increase/decrease KEYPAD_MULTIPLY(*) / KEYPAD_DIVIDE(/)


More about Android Emulator
258

Shuffle Array of String Java Example | shuffle-array-of-string-java-example



       String[] sAr = new String[] {"one","two","three"};
       List<String> wordList = Arrays.asList(sAr);
       Collections.shuffle( wordList);
       String[]myShuffledArray = wordList.toArray(new String[wordList.size()]);


185

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();
     }
222

Disable enable internet connection in Android Emulator | disable-enable-internet-connection-in-android-emulator


If you try function for checking internet connection you can disable internet on the emulator:
Settings - Wireless and networks - Mobile networks - Data enabled (checked - unchecked )


 public boolean isNetworkAvailable() {
        ConnectivityManager cm = (ConnectivityManager) 
          getSystemService(Context.CONNECTIVITY_SERVICE);
        NetworkInfo networkInfo = cm.getActiveNetworkInfo();
        if (networkInfo != null && networkInfo.isConnected()) {
            return true;
        }
        return false;
    }