")"给我一个错误..现在有11"("和10")"最后它看起来像这样
doclink.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
if(!uri.contains("https://www.facebook.com/")) {
String natgeo = "natgeo";
String uri = "fb://Page/" + natgeo;
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
startActivity(intent);
}
else{
String natgeo = "natgeo";
String uri = "https://www.facebook.com/" + natgeo;
Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
startActivity(i);
}
}};
我尝试了很多次但是错了,有人可以帮忙吗?
没有错误,当我在手机中运行时,"运行此"按钮出现,当我勾选它去Facebook时,它给了我这个错误,说"不幸的是,A已停止"
package com.example.a;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.widget.Button;
import android.view.View;
import android.view.View.OnClickListener;
public class MainActivity extends Activity {
Button dadclink;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
addListenerOnButton();
}
public void addListenerOnButton() {
dadclink = (Button) findViewById(R.id.dadclink);
dadclink.setOnClickListener(new OnClickListener() {
@SuppressWarnings("null")
@Override
public void onClick(View arg0) {
String uri = null;
String uri2 = uri;
if (!uri2.contains("https://www.facebook.com/")) {
String natgeo = "natgeo";
String uri1 = "fb://Page/" + natgeo;
Intent intent = new Intent(Intent.ACTION_VIEW, Uri
.parse(uri1));
startActivity(intent);
} else {
String natgeo = "natgeo";
String uri1 = "https://www.facebook.com/" + natgeo;
Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(uri1));
startActivity(i);
}
}
});
}
}
09-28 18:05:51.815: I/DEBUG(30): debuggerd: Jun 30 2010 13:59:20
09-28 18:05:51.915: I/Vold(28): Vold 2.1 (the revenge) firing up
09-28 18:05:51.925: I/Netd(29): Netd 1.0 starting
09-28 18:05:52.295: W/Vold(28): No UMS switch available
09-28 18:05:52.505: I/qemu-props(50): connected to 'boot-properties' qemud service.
09-28 18:05:52.515: I/qemu-props(50): received: dalvik.vm.heapsize=64m
09-28 18:05:52.525: I/qemu-props(50): received: ro.config.low_ram=true
09-28 18:05:52.525: I/qemu-props(50): received: qemu.sf.lcd_density=320
09-28 18:05:52.535: I/qemu-props(50): received: qemu.hw.mainkeys=0
09-28 18:05:52.535: I/qemu-props(50): received: qemu.sf.fake_camera=none
09-28 18:05:52.547: I/qemu-props(50): received:
09-28 18:05:52.547: I/qemu-props(50): invalid format, ignored.
09-28 18:05:53.785: I/(33): ServiceManager: 0xacd0
09-28 18:05:53.815: I/CameraService(33): CameraService started: pid=33
09-28 18:05:53.835: I/AudioFlinger(33): AudioFlinger's thread 0xb3f0 ready to run
09-28 18:05:54.307: I/SamplingProfilerIntegration(32): Profiler is disabled.
09-28 18:05:54.365: I/Zygote(32): Preloading classes...
09-28 18:05:54.365: E/Zygote(32): setreuid() failed. errno: 2
09-28 18:05:55.465: W/MediaProfiles(32): could not find media config xml file
09-28 18:06:02.315: I/Zygote(32): ...preloaded 1265 classes in 7952ms.
09-28 18:06:02.324: E/Zygote(32): setreuid() failed. errno: 17
09-28 18:06:02.524: I/Zygote(32): Preloading resources...
09-28 18:06:02.614: W/Zygote(32): Preloaded drawable resource #0x1080093 (res/drawable-hdpi/sym_def_app_icon.png) that varies with configuration!!
09-28 18:06:02.624: W/Zygote(32): Preloaded drawable resource #0x1080002 (res/drawable-hdpi/arrow_down_float.png) that varies with configuration!!
09-28 18:06:02.734: W/Zygote(32): Preloaded drawable resource #0x10800b3 (res/drawable/btn_check.xml) that varies with configuration!!
09-28 18:06:02.744: W/Zygote(32): Preloaded drawable resource #0x10800b6 (res/drawable-hdpi/btn_check_label_background.9.png) that varies with configuration!!
09-28 18:06:02.744: W/Zygote(32): Preloaded drawable resource #0x10800b7 (res/drawable-hdpi/btn_check_off.png) that varies with configuration!!
09-28 18:06:02.754: W/Zygote(32): Preloaded drawable resource #0x10800bc (res/drawable-hdpi/btn_check_on.png) that varies with configuration!!
09-28 18:06:02.804: W/Zygote(32): Preloaded drawable resource #0x1080004 (res/drawable/btn_default.xml) that varies with configuration!!
09-28 18:06:02.846: W/Zygote(32): Preloaded drawable resource #0x1080005 (res/drawable/btn_default_small.xml) that varies with configuration!!
09-28 18:06:02.994: W/Zygote(32): Preloaded drawable resource #0x1080006 (res/drawable/btn_dropdown.xml) that varies with configuration!!
09-28 18:06:03.084: W/Zygote(32): Preloaded drawable resource #0x1080008 (res/drawable/btn_plus.xml) that varies with configuration!!
09-28 18:06:03.224: W/Zygote(32): Preloaded drawable resource #0x1080007 (res/drawable/btn_minus.xml) that varies with configuration!!
09-28 18:06:03.368: W/Zygote(32): Preloaded drawable resource #0x1080009 (res/drawable/btn_radio.xml) that varies with configuration!!
09-28 18:06:03.514: W/Zygote(32): Preloaded drawable resource #0x108000a (res/drawable/btn_star.xml) that varies with configuration!!
09-28 18:06:03.534: W/Zygote(32): Preloaded drawable resource #0x1080131 (res/drawable/btn_toggle.xml) that varies with configuration!!
09-28 18:06:03.544: W/Zygote(32): Preloaded drawable resource #0x1080194 (res/drawable-hdpi/ic_emergency.png) that varies with configuration!!
09-28 18:06:03.544: W/Zygote(32): Preloaded drawable resource #0x1080012 (res/drawable-hdpi/divider_horizontal_bright.9.png) that varies with configuration!!
09-28 18:06:03.554: W/Zygote(32): Preloaded drawable resource #0x1080014 (res/drawable-hdpi/divider_horizontal_dark.9.png) that varies with configuration!!
09-28 18:06:03.604: W/Zygote(32): Preloaded drawable resource #0x1080016 (res/drawable/edit_text.xml) that varies with configuration!!
09-28 18:06:03.624: W/Zygote(32): Preloaded drawable resource #0x108016d (res/drawable/expander_group.xml) that varies with configuration!!
09-28 18:06:03.684: W/Zygote(32): Preloaded drawable resource #0x1080062 (res/drawable/list_selector_background.xml) that varies with configuration!!
09-28 18:06:03.694: W/Zygote(32): Preloaded drawable resource #0x1080227 (res/drawable-hdpi/menu_background.9.png) that varies with configuration!!
09-28 18:06:03.694: W/Zygote(32): Preloaded drawable resource #0x1080228 (res/drawable-hdpi/menu_background_fill_parent_width.9.png) that varies with configuration!!
09-28 18:06:03.734: W/Zygote(32): Preloaded drawable resource #0x1080229 (res/drawable/menu_selector.xml) that varies with configuration!!
09-28 18:06:03.754: W/Zygote(32): Preloaded drawable resource #0x1080234 (res/drawable-hdpi/panel_background.9.png) that varies with configuration!!
09-28 18:06:03.874: W/Zygote(32): Preloaded drawable resource #0x108023b (res/drawable-hdpi/popup_bottom_bright.9.png) that varies with configuration!!
09-28 18:06:03.884: W/Zygote(32): Preloaded drawable resource #0x108023c (res/drawable-hdpi/popup_bottom_dark.9.png) that varies with configuration!!
09-28 18:06:03.904: W/Zygote(32): Preloaded drawable resource #0x108023d (res/drawable-hdpi/popup_bottom_medium.9.png) that varies with configuration!!
09-28 18:06:03.904: W/Zygote(32): Preloaded drawable resource #0x108023e (res/drawable-hdpi/popup_center_bright.9.png) that varies with configuration!!
09-28 18:06:03.914: W/Zygote(32): Preloaded drawable resource #0x108023f (res/drawable-hdpi/popup_center_dark.9.png) that varies with configuration!!
09-28 18:06:03.924: W/Zygote(32): Preloaded drawable resource #0x1080242 (res/drawable-hdpi/popup_full_dark.9.png) that varies with configuration!!
09-28 18:06:03.934: W/Zygote(32): Preloaded drawable resource #0x1080245 (res/drawable-hdpi/popup_top_bright.9.png) that varies with configuration!!
09-28 18:06:03.944: W/Zygote(32): Preloaded drawable resource #0x1080246 (res/drawable-hdpi/popup_top_dark.9.png) that varies with configuration!!
09-28 18:06:03.984: W/Zygote(32): Preloaded drawable resource #0x108006d (res/drawable/progress_indeterminate_horizontal.xml) that varies with configuration!!
09-28 18:06:03.984: W/Zygote(32): Preloaded drawable resource #0x108024c (res/drawable/progress_small.xml) that varies with configuration!!
09-28 18:06:03.997: W/Zygote(32): Preloaded drawable resource #0x108024d (res/drawable/progress_small_titlebar.xml) that varies with configuration!!
09-28 18:06:04.004: W/Zygote(32): Preloaded drawable resource #0x1080270 (res/drawable-hdpi/scrollbar_handle_horizontal.9.png) that varies with configuration!!
09-28 18:06:04.004: W/Zygote(32): Preloaded drawable resource #0x1080271 (res/drawable-hdpi/scrollbar_handle_vertical.9.png) that varies with configuration!!
09-28 18:06:04.024: W/Zygote(32): Preloaded drawable resource #0x1080071 (res/drawable/spinner_dropdown_background.xml) that varies with configuration!!
09-28 18:06:04.044: W/Zygote(32): Preloaded drawable resource #0x1080354 (res/drawable-hdpi/title_bar_shadow.9.png) that varies with configuration!!
09-28 18:06:04.044: W/Zygote(32): Preloaded drawable resource #0x10801d6 (res/drawable-hdpi/indicator_code_lock_drag_direction_green_up.png) that varies with configuration!!
09-28 18:06:04.054: W/Zygote(32): Preloaded drawable resource #0x10801d7 (res/drawable-hdpi/indicator_code_lock_drag_direction_red_up.png) that varies with configuration!!
09-28 18:06:04.074: W/Zygote(32): Preloaded drawable resource #0x10801d8 (res/drawable-hdpi/indicator_code_lock_point_area_default.png) that varies with configuration!!
09-28 18:06:04.104: W/Zygote(32): Preloaded drawable resource #0x10801d9 (res/drawable-hdpi/indicator_code_lock_point_area_green.png) that varies with configuration!!
09-28 18:06:04.184: W/Zygote(32): Preloaded drawable resource #0x10801da (res/drawable-hdpi/indicator_code_lock_point_area_red.png) that varies with configuration!!
09-28 18:06:04.207: W/Zygote(32): Preloaded drawable resource #0x10801e8 (res/drawable-hdpi/jog_tab_bar_left_end_confirm_gray.9.png) that varies with configuration!!
09-28 18:06:04.226: W/Zygote(32): Preloaded drawable resource #0x10801ec (res/drawable-hdpi/jog_tab_bar_left_end_normal.9.png) that varies with configuration!!
09-28 18:06:04.245: W/Zygote(32): Preloaded drawable resource #0x10801ed (res/drawable-hdpi/jog_tab_bar_left_end_pressed.9.png) that varies with configuration!!
09-28 18:06:04.265: W/Zygote(32): Preloaded drawable resource #0x10801f1 (res/drawable-hdpi/jog_tab_bar_right_end_confirm_gray.9.png) that varies with configuration!!
09-28 18:06:04.344: W/Zygote(32): Preloaded drawable resource #0x10801f5 (res/drawable-hdpi/jog_tab_bar_right_end_normal.9.png) that varies with configuration!!
09-28 18:06:04.364: W/Zygote(32): Preloaded drawable resource #0x10801f6 (res/drawable-hdpi/jog_tab_bar_right_end_pressed.9.png) that varies with configuration!!
09-28 18:06:04.394: W/Zygote(32): Preloaded drawable resource #0x10801fb (res/drawable-hdpi/jog_tab_left_confirm_gray.png) that varies with configuration!!
09-28 18:06:04.478: W/Zygote(32): Preloaded drawable resource #0x1080200 (res/drawable-hdpi/jog_tab_left_normal.png) that varies with configuration!!
09-28 18:06:04.504: W/Zygote(32): Preloaded drawable resource #0x1080201 (res/drawable-hdpi/jog_tab_left_pressed.png) that varies with configuration!!
09-28 18:06:04.544: W/Zygote(32): Preloaded drawable resource #0x1080203 (res/drawable-hdpi/jog_tab_right_confirm_gray.png) that varies with configuration!!
09-28 18:06:04.574: W/Zygote(32): Preloaded drawable resource #0x1080209 (res/drawable-hdpi/jog_tab_right_normal.png) that varies with configuration!!
09-28 18:06:04.594: W/Zygote(32): Preloaded drawable resource #0x108020a (res/drawable-hdpi/jog_tab_right_pressed.png) that varies with configuration!!
09-28 18:06:04.614: W/Zygote(32): Preloaded drawable resource #0x108020d (res/drawable-hdpi/jog_tab_target_gray.png) that varies with configuration!!
09-28 18:06:04.614: I/Zygote(32): ...preloaded 61 resources in 2085ms.
09-28 18:06:04.634: I/Zygote(32): ...preloaded 15 resources in 20ms.
09-28 18:06:04.824: I/dalvikvm(32): System server process 60 has been created
09-28 18:06:04.824: I/Zygote(32): Accepting command socket connections
09-28 18:06:05.154: E/BatteryService(60): usbOnlinePath not found
09-28 18:06:05.164: E/BatteryService(60): batteryVoltagePath not found
09-28 18:06:05.164: E/BatteryService(60): batteryTemperaturePath not found
09-28 18:06:05.164: I/sysproc(60): Entered system_init()
09-28 18:06:05.174: I/sysproc(60): ServiceManager: 0xa4390
09-28 18:06:05.174: I/SurfaceFlinger(60): SurfaceFlinger is starting
09-28 18:06:05.174: I/SurfaceFlinger(60): SurfaceFlinger's main thread ready to run. Initializing graphics H/W...
09-28 18:06:05.184: E/SurfaceFlinger(60): Couldn't open /sys/power/wait_for_fb_sleep or /sys/power/wait_for_fb_wake
09-28 18:06:05.224: I/gralloc(60): using (fd=24)
09-28 18:06:05.224: I/gralloc(60): id =
09-28 18:06:05.224: I/gralloc(60): xres = 768 px
09-28 18:06:05.224: I/gralloc(60): yres = 1280 px
09-28 18:06:05.224: I/gralloc(60): xres_virtual = 768 px
09-28 18:06:05.224: I/gralloc(60): yres_virtual = 2560 px
09-28 18:06:05.224: I/gralloc(60): bpp = 16
09-28 18:06:05.224: I/gralloc(60): r = 11:5
09-28 18:06:05.224: I/gralloc(60): g = 5:6
09-28 18:06:05.224: I/gralloc(60): b = 0:5
09-28 18:06:05.224: I/gralloc(60): width = 118 mm (165.315247 dpi)
09-28 18:06:05.224: I/gralloc(60): height = 197 mm (165.035538 dpi)
09-28 18:06:05.224: I/gralloc(60): refresh rate = 60.00 Hz
09-28 18:06:05.274: I/SurfaceFlinger(60): EGL informations:
09-28 18:06:05.274: I/SurfaceFlinger(60): # of configs : 8
09-28 18:06:05.274: I/SurfaceFlinger(60): vendor : Android
09-28 18:06:05.284: I/SurfaceFlinger(60): version : 1.4 Android META-EGL
09-28 18:06:05.284: I/SurfaceFlinger(60): extensions: EGL_KHR_image EGL_KHR_image_base EGL_KHR_image_pixmap EGL_ANDROID_image_native_buffer EGL_ANDROID_swap_rectangle EGL_ANDROID_get_render_buffer
09-28 18:06:05.284: I/SurfaceFlinger(60): Client API: OpenGL ES
09-28 18:06:05.284: I/SurfaceFlinger(60): EGLSurface: 5-6-5-0, config=0x1000000
09-28 18:06:05.284: I/SurfaceFlinger(60): flags : 001c0000
09-28 18:06:05.284: I/SurfaceFlinger(60): OpenGL informations:
09-28 18:06:05.284: I/SurfaceFlinger(60): vendor : Android
09-28 18:06:05.284: I/SurfaceFlinger(60): renderer : Android PixelFlinger 1.3
09-28 18:06:05.284: I/SurfaceFlinger(60): version : OpenGL ES-CM 1.0
09-28 18:06:05.284: I/SurfaceFlinger(60): extensions: GL_OES_byte_coordinates GL_OES_fixed_point GL_OES_single_precision GL_OES_read_format GL_OES_compressed_paletted_texture GL_OES_draw_texture GL_OES_matrix_get GL_OES_query_matrix GL_OES_EGL_image GL_OES_compressed_ETC1_RGB8_texture GL_ARB_texture_compression GL_ARB_texture_non_power_of_two GL_ANDROID_user_clip_plane GL_ANDROID_vertex_buffer_object GL_ANDROID_generate_mipmap
09-28 18:06:05.284: I/SurfaceFlinger(60): GL_MAX_TEXTURE_SIZE = 4096
09-28 18:06:05.284: I/SurfaceFlinger(60): GL_MAX_VIEWPORT_DIMS = 4096
09-28 18:06:05.297: I/sysproc(60): System server: starting Android runtime.
09-28 18:06:05.297: I/sysproc(60): System server: starting Android services.
09-28 18:06:05.304: I/SystemServer(60): Entered the Android system server!
09-28 18:06:05.304: I/sysproc(60): System server: entering thread pool.
09-28 18:06:05.316: I/SystemServer(60): Entropy Service
09-28 18:06:05.344: W/EntropyService(60): unable to load initial entropy (first boot?)
09-28 18:06:05.344: W/EntropyService(60): java.io.FileNotFoundException: /data/system/entropy.dat (Not a directory)
09-28 18:06:05.344: W/EntropyService(60): at org.apache.harmony.luni.platform.OSFileSystem.openImpl(Native Method)
09-28 18:06:05.344: W/EntropyService(60): at org.apache.harmony.luni.platform.OSFileSystem.open(OSFileSystem.java:152)
09-28 18:06:05.344: W/EntropyService(60): at java.io.FileInputStream.<init>(FileInputStream.java:82)
09-28 18:06:05.344: W/EntropyService(60): at java.io.FileInputStream.<init>(FileInputStream.java:134)
09-28 18:06:05.344: W/EntropyService(60): at com.android.server.RandomBlock.fromFile(RandomBlock.java:45)
09-28 18:06:05.344: W/EntropyService(60): at com.android.server.EntropyService.loadInitialEntropy(EntropyService.java:99)
09-28 18:06:05.344: W/EntropyService(60): at com.android.server.EntropyService.<init>(EntropyService.java:86)
09-28 18:06:05.344: W/EntropyService(60): at com.android.server.EntropyService.<init>(EntropyService.java:76)
09-28 18:06:05.344: W/EntropyService(60): at com.android.server.ServerThread.run(SystemServer.java:107)
09-28 18:06:05.394: W/EntropyService(60): unable to write entropy
09-28 18:06:05.394: W/EntropyService(60): java.io.FileNotFoundException: /data/system/entropy.dat (Not a directory)
09-28 18:06:05.394: W/EntropyService(60): at org.apache.harmony.luni.platform.OSFileSystem.openImpl(Native Method)
09-28 18:06:05.394: W/EntropyService(60): at org.apache.harmony.luni.platform.OSFileSystem.open(OSFileSystem.java:152)
09-28 18:06:05.394: W/EntropyService(60): at java.io.RandomAccessFile.<init>(RandomAccessFile.java:145)
09-28 18:06:05.394: W/EntropyService(60): at java.io.RandomAccessFile.<init>(RandomAccessFile.java:186)
09-28 18:06:05.394: W/EntropyService(60): at com.android.server.RandomBlock.toFile(RandomBlock.java:69)
09-28 18:06:05.394: W/EntropyService(60): at com.android.server.EntropyService.writeEntropy(EntropyService.java:107)
09-28 18:06:05.394: W/EntropyService(60): at com.android.server.EntropyService.<init>(EntropyService.java:88)
09-28 18:06:05.394: W/EntropyService(60): at com.android.server.EntropyService.<init>(EntropyService.java:76)
09-28 18:06:05.394: W/EntropyService(60): at com.android.server.ServerThread.run(SystemServer.java:107)
09-28 18:06:05.414: I/SystemServer(60): Power Manager
09-28 18:06:05.434: I/SystemServer(60): Activity Manager
09-28 18:06:05.474: I/ActivityManager(60): Memory class: 64
09-28 18:06:05.534: W/BatteryStats(60): Error writing battery statistics
09-28 18:06:05.534: W/BatteryStats(60): java.io.FileNotFoundException: /data/system/batterystats.bin.tmp (Not a directory)
09-28 18:06:05.534: W/BatteryStats(60): at org.apache.harmony.luni.platform.OSFileSystem.openImpl(Native Method)
09-28 18:06:05.534: W/BatteryStats(60): at org.apache.harmony.luni.platform.OSFileSystem.open(OSFileSystem.java:152)
09-28 18:06:05.534: W/BatteryStats(60): at java.io.FileOutputStream.<init>(FileOutputStream.java:97)
09-28 18:06:05.534: W/BatteryStats(60): at java.io.FileOutputStream.<init>(FileOutputStream.java:69)
09-28 18:06:05.534: W/BatteryStats(60): at com.android.internal.os.BatteryStatsImpl.writeLocked(BatteryStatsImpl.java:3077)
09-28 18:06:05.534: W/BatteryStats(60): at com.android.server.am.ActivityManagerService.<init>(ActivityManagerService.java:1430)
09-28 18:06:05.534: W/BatteryStats(60): at com.android.server.am.ActivityManagerService.<init>(ActivityManagerService.java:129)
09-28 18:06:05.534: W/BatteryStats(60): at com.android.server.am.ActivityManagerService$AThread.run(ActivityManagerService.java:1338)
09-28 18:06:05.554: W/UsageStats(60): Error : java.io.IOException: Not a directory reading data from file:/data/system/usagestats/usage-20140928
09-28 18:06:05.684: W/zipro(70): Unable to open zip '/data/local/bootanimation.zip': No such file or directory
09-28 18:06:05.684: W/zipro(70): Unable to open zip '/system/media/bootanimation.zip': No such file or directory
09-28 18:06:05.925: I/ARMAssembler(60): generated scanline__00000077:03010104_00000004_00000000 [ 22 ipp] (41 ins) at [0x4652f8:0x46539c] in 4376427 ns
09-28 18:06:06.224: I/ARMAssembler(70): generated scanline__00000077:03545404_00000A01_00000000 [ 30 ipp] (51 ins) at [0x1c5a8:0x1c674] in 3088498 ns
09-28 18:06:06.555: I/SystemServer(60): Telephony Registry
09-28 18:06:06.555: I/SystemServer(60): Package Manager
09-28 18:06:06.574: I/Installer(60): connecting...
09-28 18:06:06.584: I/installd(34): new connection
09-28 18:06:06.714: I/PackageManager(60): Libs: android.test.runner:/system/framework/android.test.runner.jar javax.obex:/system/framework/javax.obex.jar
09-28 18:06:06.714: I/PackageManager(60): Features: android.hardware.camera android.hardware.camera.autofocus
09-28 18:06:06.714: I/PackageManager(60): No current settings file!
09-28 18:06:06.714: W/PackageManager(60): Running ENG build: no pre-dexopt!
09-28 18:06:07.074: I/PackageManager(60): /system/framework/framework-res.apk changed; collecting certs
答案 0 :(得分:1)
在最后一行中,您有2 }
。
应该是这样的:
doclink.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
//your code
}
});